Changeset 127505 in webkit
- Timestamp:
- Sep 4, 2012 2:19:25 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
r127191 r127505 569 569 } 570 570 571 return throwError(exec, createReferenceError(exec, "Static function property defined with NULL callAsFunction callback."));571 return throwError(exec, createReferenceError(exec, ASCIILiteral("Static function property defined with NULL callAsFunction callback."))); 572 572 } 573 573 … … 601 601 } 602 602 603 return throwError(exec, createReferenceError(exec, "hasProperty callback returned true for a property that doesn't exist."));603 return throwError(exec, createReferenceError(exec, ASCIILiteral("hasProperty callback returned true for a property that doesn't exist."))); 604 604 } 605 605 -
trunk/Source/JavaScriptCore/API/JSContextRef.cpp
r127191 r127505 174 174 if (asObject(exec->callee())->inherits(&InternalFunction::s_info)) { 175 175 functionName = asInternalFunction(exec->callee())->name(exec); 176 builder.append ("#0 ");176 builder.appendLiteral("#0 "); 177 177 builder.append(functionName); 178 builder.append ("() ");178 builder.appendLiteral("() "); 179 179 count++; 180 180 } -
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r121924 r127505 93 93 ExecState* exec = toJS(ctx); 94 94 APIEntryShim entryShim(exec); 95 return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, name ? name->ustring() : "anonymous"));95 return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, name ? name->ustring() : ASCIILiteral("anonymous"))); 96 96 } 97 97 -
trunk/Source/JavaScriptCore/ChangeLog
r127503 r127505 1 2012-09-04 Benjamin Poulain <bpoulain@apple.com> 2 3 Improve JSC use of Strings after the UString->String change 4 https://bugs.webkit.org/show_bug.cgi?id=95633 5 6 Reviewed by Geoffrey Garen. 7 8 This patch improve the use of strings in the JSC runtime. 9 10 The initialization of Identifier is left for future patches. 11 12 The improvements are the following: 13 -5% faster to raise one of the modified exception. 14 -3 times faster to execute Boolean::toString() 15 16 Most of the changes are just about using the new methods 17 for string literals. 18 19 With the changes, the binary on x86_64 gets 176 bytes smaller. 20 21 * API/JSCallbackObjectFunctions.h: 22 (JSC::::staticFunctionGetter): 23 (JSC::::callbackGetter): 24 * API/JSContextRef.cpp: 25 (JSContextCreateBacktrace): 26 * API/JSObjectRef.cpp: 27 (JSObjectMakeFunctionWithCallback): 28 * bytecode/CodeBlock.cpp: 29 (JSC::valueToSourceString): 30 (JSC::CodeBlock::nameForRegister): 31 * interpreter/Interpreter.cpp: 32 (JSC::Interpreter::addStackTraceIfNecessary): 33 * runtime/ArrayConstructor.cpp: 34 (JSC::constructArrayWithSizeQuirk): 35 * runtime/ArrayPrototype.cpp: 36 (JSC::shift): 37 (JSC::unshift): 38 (JSC::arrayProtoFuncPop): 39 (JSC::arrayProtoFuncReverse): 40 * runtime/BooleanPrototype.cpp: 41 (JSC::booleanProtoFuncToString): Instead of instanciating new strings, reuse the 42 keywords available in SmallStrings. Avoiding the creation of the JSString and StringImpl 43 makes the method significantly faster. 44 45 * runtime/DateConversion.cpp: 46 (JSC::formatDateTime): 47 * runtime/DatePrototype.cpp: 48 (JSC::formatLocaleDate): 49 (JSC::formateDateInstance): 50 (JSC::dateProtoFuncToISOString): 51 Change the way we use snprintf() for clarity and performance. 52 53 Instead of allocating one extra byte to put a zero "just in case", we use the size returned 54 by snprintf(). 55 To prevent any overflow from a programming mistake, we explicitely test for overflow and 56 return an empty string. 57 58 (JSC::dateProtoFuncToJSON): 59 * runtime/Error.cpp: 60 (JSC::createNotEnoughArgumentsError): 61 (JSC::throwTypeError): 62 (JSC::throwSyntaxError): 63 * runtime/Error.h: 64 (JSC::StrictModeTypeErrorFunction::create): 65 * runtime/ErrorPrototype.cpp: 66 (JSC::ErrorPrototype::finishCreation): 67 (JSC::errorProtoFuncToString): 68 Using a null String is correct because (8) uses jsString(), (9) tests for a length of 0. 69 70 * runtime/ExceptionHelpers.cpp: 71 (JSC::InterruptedExecutionError::defaultValue): 72 (JSC::TerminatedExecutionError::defaultValue): 73 (JSC::createStackOverflowError): 74 (JSC::createOutOfMemoryError): 75 * runtime/Executable.cpp: 76 (JSC::EvalExecutable::compileInternal): 77 (JSC::FunctionExecutable::paramString): 78 * runtime/FunctionConstructor.cpp: 79 (JSC::constructFunction): 80 (JSC::constructFunctionSkippingEvalEnabledCheck): 81 * runtime/FunctionPrototype.h: 82 (JSC::FunctionPrototype::create): 83 Using a null String for the name is correct because InternalFunction uses jsString() 84 to create the name value. 85 86 * runtime/InternalFunction.cpp: 87 (JSC::InternalFunction::finishCreation): 88 There is no need to create an empty string for a null string, jsString() handle both 89 cases as empty JSString. 90 91 * runtime/JSArray.cpp: 92 (JSC::reject): 93 (JSC::SparseArrayValueMap::put): 94 (JSC::JSArray::put): 95 (JSC::JSArray::putByIndexBeyondVectorLength): 96 (JSC::JSArray::putDirectIndexBeyondVectorLength): 97 (JSC::JSArray::setLength): 98 (JSC::JSArray::pop): 99 (JSC::JSArray::push): 100 * runtime/JSFunction.cpp: 101 (JSC::JSFunction::finishCreation): Same issue as InternalFunction::finishCreation. 102 103 (JSC::JSFunction::callerGetter): 104 (JSC::JSFunction::defineOwnProperty): 105 * runtime/JSGlobalData.cpp: 106 (JSC::enableAssembler): Use CFSTR() instead of CFStringCreateWithCString(). 107 CFStringCreateWithCString() copy the content and may choose to decode the data. 108 CFSTR() is much more efficient. 109 110 * runtime/JSGlobalObject.cpp: 111 (JSC::JSGlobalObject::reset): 112 JSFunction uses jsString() to create the name, we can use null strings instead 113 of creating empty strings. 114 115 (JSC::JSGlobalObject::createThrowTypeError): ditto. 116 * runtime/JSGlobalObjectFunctions.cpp: 117 (JSC::encode): 118 (JSC::decode): 119 (JSC::globalFuncEval): 120 * runtime/JSONObject.cpp: 121 (JSC::Stringifier::appendStringifiedValue): 122 (JSC::Stringifier::Holder::appendNextProperty): 123 (JSC::JSONProtoFuncParse): 124 (JSC::JSONProtoFuncStringify): 125 * runtime/JSObject.cpp: 126 (JSC::JSObject::put): 127 (JSC::JSObject::defaultValue): 128 (JSC::JSObject::hasInstance): 129 (JSC::JSObject::defineOwnProperty): 130 * runtime/JSString.cpp: 131 Return an empty JSString to avoid the creation of a temporary empty String. 132 133 (JSC::JSRopeString::getIndexSlowCase): 134 * runtime/JSString.h: 135 (JSC): Remove the versions of jsNontrivialString() taking a char*. All the callers 136 have been replaced by calls using ASCIILiteral. 137 138 * runtime/JSValue.cpp: 139 (JSC::JSValue::putToPrimitive): 140 * runtime/LiteralParser.cpp: 141 (JSC::::Lexer::lex): 142 (JSC::::Lexer::lexString): 143 (JSC::::Lexer::lexNumber): 144 (JSC::::parse): 145 * runtime/LiteralParser.h: 146 (JSC::LiteralParser::getErrorMessage): 147 * runtime/NumberPrototype.cpp: 148 (JSC::numberProtoFuncToExponential): 149 (JSC::numberProtoFuncToFixed): 150 (JSC::numberProtoFuncToPrecision): 151 (JSC::numberProtoFuncToString): 152 * runtime/ObjectConstructor.cpp: 153 (JSC::objectConstructorGetPrototypeOf): 154 (JSC::objectConstructorGetOwnPropertyDescriptor): 155 (JSC::objectConstructorGetOwnPropertyNames): 156 (JSC::objectConstructorKeys): 157 (JSC::toPropertyDescriptor): 158 (JSC::objectConstructorDefineProperty): 159 (JSC::objectConstructorDefineProperties): 160 (JSC::objectConstructorCreate): 161 (JSC::objectConstructorSeal): 162 (JSC::objectConstructorFreeze): 163 (JSC::objectConstructorPreventExtensions): 164 (JSC::objectConstructorIsSealed): 165 (JSC::objectConstructorIsFrozen): 166 (JSC::objectConstructorIsExtensible): 167 * runtime/ObjectPrototype.cpp: 168 (JSC::objectProtoFuncDefineGetter): 169 (JSC::objectProtoFuncDefineSetter): 170 (JSC::objectProtoFuncToString): 171 * runtime/RegExpConstructor.cpp: 172 (JSC::constructRegExp): 173 * runtime/RegExpObject.cpp: 174 (JSC::reject): 175 (JSC::regExpObjectSource): 176 * runtime/RegExpPrototype.cpp: 177 (JSC::regExpProtoFuncCompile): 178 * runtime/StringObject.cpp: 179 (JSC::StringObject::defineOwnProperty): 180 * runtime/StringPrototype.cpp: 181 (JSC::jsSpliceSubstrings): 182 (JSC::jsSpliceSubstringsWithSeparators): 183 1 184 2012-09-04 Filip Pizlo <fpizlo@apple.com> 2 185 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r127393 r127505 76 76 { 77 77 if (!val) 78 return "0";78 return ASCIILiteral("0"); 79 79 80 80 if (val.isString()) … … 3033 3033 } 3034 3034 if (needsActivation() && registerNumber == activationRegister()) 3035 return "activation";3035 return ASCIILiteral("activation"); 3036 3036 if (registerNumber == thisRegister()) 3037 return "this";3037 return ASCIILiteral("this"); 3038 3038 if (usesArguments()) { 3039 3039 if (registerNumber == argumentsRegister()) 3040 return "arguments";3040 return ASCIILiteral("arguments"); 3041 3041 if (unmodifiedArgumentsRegister(argumentsRegister()) == registerNumber) 3042 return "real arguments";3042 return ASCIILiteral("real arguments"); 3043 3043 } 3044 3044 if (registerNumber < 0) { -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r127393 r127505 743 743 else 744 744 globalObject = error->globalObject(); 745 746 // FIXME: JSStringJoiner could be more efficient than StringBuilder here. 745 747 StringBuilder builder; 746 748 for (unsigned i = 0; i < stackTrace.size(); i++) { -
trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
r116828 r127505 86 86 uint32_t n = args.at(0).toUInt32(exec); 87 87 if (n != args.at(0).toNumber(exec)) 88 return throwError(exec, createRangeError(exec, "Array size is not a small enough positive integer."));88 return throwError(exec, createRangeError(exec, ASCIILiteral("Array size is not a small enough positive integer."))); 89 89 return constructEmptyArray(exec, globalObject, n); 90 90 } -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r127202 r127505 206 206 return; 207 207 } else if (!thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, to)) { 208 throwTypeError(exec, "Unable to delete property.");208 throwTypeError(exec, ASCIILiteral("Unable to delete property.")); 209 209 return; 210 210 } … … 212 212 for (unsigned k = length; k > length - count; --k) { 213 213 if (!thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, k - 1)) { 214 throwTypeError(exec, "Unable to delete property.");214 throwTypeError(exec, ASCIILiteral("Unable to delete property.")); 215 215 return; 216 216 } … … 244 244 thisObj->methodTable()->putByIndex(thisObj, exec, to, value, true); 245 245 } else if (!thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, to)) { 246 throwTypeError(exec, "Unable to delete property.");246 throwTypeError(exec, ASCIILiteral("Unable to delete property.")); 247 247 return; 248 248 } … … 492 492 return JSValue::encode(jsUndefined()); 493 493 if (!thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, length - 1)) { 494 throwTypeError(exec, "Unable to delete property.");494 throwTypeError(exec, ASCIILiteral("Unable to delete property.")); 495 495 return JSValue::encode(jsUndefined()); 496 496 } … … 554 554 return JSValue::encode(jsUndefined()); 555 555 } else if (!thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, k)) { 556 throwTypeError(exec, "Unable to delete property.");556 throwTypeError(exec, ASCIILiteral("Unable to delete property.")); 557 557 return JSValue::encode(jsUndefined()); 558 558 } … … 563 563 return JSValue::encode(jsUndefined()); 564 564 } else if (!thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, lk1)) { 565 throwTypeError(exec, "Unable to delete property.");565 throwTypeError(exec, ASCIILiteral("Unable to delete property.")); 566 566 return JSValue::encode(jsUndefined()); 567 567 } -
trunk/Source/JavaScriptCore/runtime/BooleanPrototype.cpp
r116828 r127505 78 78 EncodedJSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec) 79 79 { 80 JSGlobalData* globalData = &exec->globalData(); 80 81 JSValue thisValue = exec->hostThisValue(); 81 82 if (thisValue == jsBoolean(false)) 82 return JSValue::encode( jsNontrivialString(exec, "false"));83 return JSValue::encode(globalData->smallStrings.falseString(globalData)); 83 84 84 85 if (thisValue == jsBoolean(true)) 85 return JSValue::encode( jsNontrivialString(exec, "true"));86 return JSValue::encode(globalData->smallStrings.trueString(globalData)); 86 87 87 88 if (!thisValue.inherits(&BooleanObject::s_info)) … … 89 90 90 91 if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false)) 91 return JSValue::encode( jsNontrivialString(exec, "false"));92 return JSValue::encode(globalData->smallStrings.falseString(globalData)); 92 93 93 94 ASSERT(asBooleanObject(thisValue)->internalValue() == jsBoolean(true)); 94 return JSValue::encode( jsNontrivialString(exec, "true"));95 return JSValue::encode(globalData->smallStrings.trueString(globalData)); 95 96 } 96 97 -
trunk/Source/JavaScriptCore/runtime/DateConversion.cpp
r127191 r127505 74 74 75 75 if (asUTCVariant) { 76 builder.append (", ");76 builder.appendLiteral(", "); 77 77 appendNumber<2>(builder, t.monthDay()); 78 78 builder.append(' '); … … 97 97 builder.append(':'); 98 98 appendNumber<2>(builder, t.second()); 99 builder.append (" GMT");99 builder.appendLiteral(" GMT"); 100 100 101 101 if (!asUTCVariant) { … … 115 115 #endif 116 116 if (timeZoneName[0]) { 117 builder.append (" (");117 builder.appendLiteral(" ("); 118 118 builder.append(timeZoneName); 119 119 builder.append(')'); -
trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp
r127191 r127505 335 335 const GregorianDateTime* gregorianDateTime = dateObject->gregorianDateTime(exec); 336 336 if (!gregorianDateTime) 337 return jsNontrivialString(exec, "Invalid Date");337 return jsNontrivialString(exec, ASCIILiteral("Invalid Date")); 338 338 return formatLocaleDate(exec, *gregorianDateTime, format); 339 339 } … … 353 353 : thisDateObj->gregorianDateTime(exec); 354 354 if (!gregorianDateTime) 355 return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));355 return JSValue::encode(jsNontrivialString(exec, String(ASCIILiteral("Invalid Date")))); 356 356 357 357 return JSValue::encode(jsNontrivialString(exec, formatDateTime(*gregorianDateTime, format, asUTCVariant))); … … 549 549 DateInstance* thisDateObj = asDateInstance(thisValue); 550 550 if (!isfinite(thisDateObj->internalNumber())) 551 return throwVMError(exec, createRangeError(exec, "Invalid Date"));551 return throwVMError(exec, createRangeError(exec, ASCIILiteral("Invalid Date"))); 552 552 553 553 const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); 554 554 if (!gregorianDateTime) 555 return JSValue::encode(jsNontrivialString(exec, "Invalid Date"));555 return JSValue::encode(jsNontrivialString(exec, String(ASCIILiteral("Invalid Date")))); 556 556 // Maximum amount of space we need in buffer: 7 (max. digits in year) + 2 * 5 (2 characters each for month, day, hour, minute, second) + 4 (. + 3 digits for milliseconds) 557 557 // 6 for formatting and one for null termination = 28. We add one extra character to allow us to force null termination. 558 char buffer[2 9];558 char buffer[28]; 559 559 // If the year is outside the bounds of 0 and 9999 inclusive we want to use the extended year format (ES 15.9.1.15.1). 560 560 int ms = static_cast<int>(fmod(thisDateObj->internalNumber(), msPerSecond)); 561 561 if (ms < 0) 562 562 ms += msPerSecond; 563 564 int charactersWritten; 563 565 if (gregorianDateTime->year() > 9999 || gregorianDateTime->year() < 0) 564 snprintf(buffer, sizeof(buffer) - 1, "%+07d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms);566 charactersWritten = snprintf(buffer, sizeof(buffer), "%+07d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); 565 567 else 566 snprintf(buffer, sizeof(buffer) - 1, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); 567 buffer[sizeof(buffer) - 1] = 0; 568 return JSValue::encode(jsNontrivialString(exec, buffer)); 568 charactersWritten = snprintf(buffer, sizeof(buffer), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", gregorianDateTime->year(), gregorianDateTime->month() + 1, gregorianDateTime->monthDay(), gregorianDateTime->hour(), gregorianDateTime->minute(), gregorianDateTime->second(), ms); 569 570 ASSERT(charactersWritten > 0 && static_cast<unsigned>(charactersWritten) < sizeof(buffer)); 571 if (static_cast<unsigned>(charactersWritten) >= sizeof(buffer)) 572 return JSValue::encode(jsEmptyString(exec)); 573 574 return JSValue::encode(jsNontrivialString(exec, String(buffer, charactersWritten))); 569 575 } 570 576 … … 1114 1120 CallType callType = getCallData(toISOValue, callData); 1115 1121 if (callType == CallTypeNone) 1116 return throwVMError(exec, createTypeError(exec, "toISOString is not a function"));1122 return throwVMError(exec, createTypeError(exec, ASCIILiteral("toISOString is not a function"))); 1117 1123 1118 1124 JSValue result = call(exec, asObject(toISOValue), callType, callData, object, exec->emptyList()); … … 1120 1126 return JSValue::encode(jsNull()); 1121 1127 if (result.isObject()) 1122 return throwVMError(exec, createTypeError(exec, "toISOString did not return a primitive value"));1128 return throwVMError(exec, createTypeError(exec, ASCIILiteral("toISOString did not return a primitive value"))); 1123 1129 return JSValue::encode(result); 1124 1130 } -
trunk/Source/JavaScriptCore/runtime/Error.cpp
r127191 r127505 82 82 JSObject* createNotEnoughArgumentsError(JSGlobalObject* globalObject) 83 83 { 84 return createTypeError(globalObject, "Not enough arguments");84 return createTypeError(globalObject, ASCIILiteral("Not enough arguments")); 85 85 } 86 86 … … 170 170 JSObject* throwTypeError(ExecState* exec) 171 171 { 172 return throwError(exec, createTypeError(exec, "Type error"));172 return throwError(exec, createTypeError(exec, ASCIILiteral("Type error"))); 173 173 } 174 174 175 175 JSObject* throwSyntaxError(ExecState* exec) 176 176 { 177 return throwError(exec, createSyntaxError(exec, "Syntax error"));177 return throwError(exec, createSyntaxError(exec, ASCIILiteral("Syntax error"))); 178 178 } 179 179 -
trunk/Source/JavaScriptCore/runtime/Error.h
r127191 r127505 90 90 { 91 91 StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message); 92 function->finishCreation(exec->globalData(), "");92 function->finishCreation(exec->globalData(), String()); 93 93 return function; 94 94 } -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
r127191 r127505 60 60 Base::finishCreation(exec->globalData(), ""); 61 61 ASSERT(inherits(&s_info)); 62 putDirect(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);62 putDirect(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, String(ASCIILiteral("Error"))), DontEnum); 63 63 } 64 64 … … 99 99 String nameString; 100 100 if (name.isUndefined()) 101 nameString = "Error";101 nameString = ASCIILiteral("Error"); 102 102 else { 103 103 nameString = name.toString(exec)->value(exec); … … 116 116 String messageString; 117 117 if (message.isUndefined()) 118 messageString = "";118 messageString = String(); 119 119 else { 120 120 messageString = message.toString(exec)->value(exec); -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
r127191 r127505 48 48 { 49 49 if (hint == PreferString) 50 return jsNontrivialString(exec, "JavaScript execution exceeded timeout.");50 return jsNontrivialString(exec, String(ASCIILiteral("JavaScript execution exceeded timeout."))); 51 51 return JSValue(std::numeric_limits<double>::quiet_NaN()); 52 52 } … … 75 75 { 76 76 if (hint == PreferString) 77 return jsNontrivialString(exec, "JavaScript execution terminated.");77 return jsNontrivialString(exec, String(ASCIILiteral("JavaScript execution terminated."))); 78 78 return JSValue(std::numeric_limits<double>::quiet_NaN()); 79 79 } … … 97 97 JSObject* createStackOverflowError(ExecState* exec) 98 98 { 99 return createRangeError(exec, "Maximum call stack size exceeded.");99 return createRangeError(exec, ASCIILiteral("Maximum call stack size exceeded.")); 100 100 } 101 101 102 102 JSObject* createStackOverflowError(JSGlobalObject* globalObject) 103 103 { 104 return createRangeError(globalObject, "Maximum call stack size exceeded.");104 return createRangeError(globalObject, ASCIILiteral("Maximum call stack size exceeded.")); 105 105 } 106 106 … … 154 154 JSObject* createOutOfMemoryError(JSGlobalObject* globalObject) 155 155 { 156 return createError(globalObject, "Out of memory");156 return createError(globalObject, ASCIILiteral("Out of memory")); 157 157 } 158 158 -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r127202 r127505 210 210 } else { 211 211 if (!lexicalGlobalObject->evalEnabled()) 212 return throwError(exec, createEvalError(exec, "Eval is disabled"));212 return throwError(exec, createEvalError(exec, ASCIILiteral("Eval is disabled"))); 213 213 RefPtr<EvalNode> evalNode = parse<EvalNode>(globalData, lexicalGlobalObject, m_source, 0, isStrictMode() ? JSParseStrict : JSParseNormal, EvalNode::isFunctionNode ? JSParseFunctionCode : JSParseProgramCode, lexicalGlobalObject->debugger(), exec, &exception); 214 214 if (!evalNode) { … … 676 676 for (size_t pos = 0; pos < parameters.size(); ++pos) { 677 677 if (!builder.isEmpty()) 678 builder.append (", ");678 builder.appendLiteral(", "); 679 679 builder.append(parameters[pos].ustring()); 680 680 } -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r127202 r127505 83 83 { 84 84 if (!globalObject->evalEnabled()) 85 return throwError(exec, createEvalError(exec, "Function constructor is disabled"));85 return throwError(exec, createEvalError(exec, ASCIILiteral("Function constructor is disabled"))); 86 86 return constructFunctionSkippingEvalEnabledCheck(exec, globalObject, args, functionName, sourceURL, position); 87 87 } … … 94 94 String program; 95 95 if (args.isEmpty()) 96 program = "(function() { \n})";96 program = ASCIILiteral("(function() { \n})"); 97 97 else if (args.size() == 1) 98 98 program = makeString("(function() { ", args.at(0).toString(exec)->value(exec), "\n})"); 99 99 else { 100 100 StringBuilder builder; 101 builder.append ("(function(");101 builder.appendLiteral("(function("); 102 102 builder.append(args.at(0).toString(exec)->value(exec)); 103 103 for (size_t i = 1; i < args.size() - 1; i++) { 104 builder.append( ",");104 builder.append(','); 105 105 builder.append(args.at(i).toString(exec)->value(exec)); 106 106 } 107 builder.append (") { ");107 builder.appendLiteral(") { "); 108 108 builder.append(args.at(args.size() - 1).toString(exec)->value(exec)); 109 builder.append ("\n})");109 builder.appendLiteral("\n})"); 110 110 program = builder.toString(); 111 111 } -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.h
r127191 r127505 33 33 { 34 34 FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(globalObject, structure); 35 prototype->finishCreation(exec, "");35 prototype->finishCreation(exec, String()); 36 36 return prototype; 37 37 } -
trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp
r127191 r127505 45 45 ASSERT(inherits(&s_info)); 46 46 ASSERT(methodTable()->getCallData != InternalFunction::s_info.methodTable.getCallData); 47 putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name .isNull() ? "" : name), DontDelete | ReadOnly | DontEnum);47 putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name), DontDelete | ReadOnly | DontEnum); 48 48 } 49 49 -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r127349 r127505 114 114 { 115 115 if (throwException) 116 throwTypeError(exec, message);116 throwTypeError(exec, ASCIILiteral(message)); 117 117 return false; 118 118 } … … 213 213 remove(result.iterator); 214 214 if (shouldThrow) 215 throwTypeError(exec, StrictModeReadonlyPropertyWriteError);215 throwTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)); 216 216 return; 217 217 } … … 220 220 if (entry.attributes & ReadOnly) { 221 221 if (shouldThrow) 222 throwTypeError(exec, StrictModeReadonlyPropertyWriteError);222 throwTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)); 223 223 return; 224 224 } … … 234 234 if (!setter) { 235 235 if (shouldThrow) 236 throwTypeError(exec, StrictModeReadonlyPropertyWriteError);236 throwTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)); 237 237 return; 238 238 } … … 724 724 unsigned newLength = value.toUInt32(exec); 725 725 if (value.toNumber(exec) != static_cast<double>(newLength)) { 726 throwError(exec, createRangeError(exec, "Invalid array length"));726 throwError(exec, createRangeError(exec, ASCIILiteral("Invalid array length"))); 727 727 return; 728 728 } … … 812 812 if (map->lengthIsReadOnly() || !isExtensible()) { 813 813 if (shouldThrow) 814 throwTypeError(exec, StrictModeReadonlyPropertyWriteError);814 throwTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)); 815 815 return; 816 816 } … … 1237 1237 if (!length) { 1238 1238 if (!isLengthWritable()) 1239 throwTypeError(exec, StrictModeReadonlyPropertyWriteError);1239 throwTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)); 1240 1240 return jsUndefined(); 1241 1241 } … … 1262 1262 // Call the [[Delete]] internal method of O with arguments indx and true. 1263 1263 if (!deletePropertyByIndex(this, exec, index)) { 1264 throwTypeError(exec, "Unable to delete property.");1264 throwTypeError(exec, ASCIILiteral("Unable to delete property.")); 1265 1265 return jsUndefined(); 1266 1266 } … … 1295 1295 // Per ES5.1 15.4.4.7 step 6 & 15.4.5.1 step 3.d. 1296 1296 if (!exec->hadException()) 1297 throwError(exec, createRangeError(exec, "Invalid array length"));1297 throwError(exec, createRangeError(exec, ASCIILiteral("Invalid array length"))); 1298 1298 return; 1299 1299 } -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r127202 r127505 97 97 ASSERT(inherits(&s_info)); 98 98 m_executable.set(exec->globalData(), this, executable); 99 putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name .isNull() ? "" : name), DontDelete | ReadOnly | DontEnum);99 putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name), DontDelete | ReadOnly | DontEnum); 100 100 putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); 101 101 } … … 204 204 if (function->isHostFunction() || !function->jsExecutable()->isStrictMode()) 205 205 return caller; 206 return throwTypeError(exec, "Function.caller used to retrieve strict caller");206 return throwTypeError(exec, ASCIILiteral("Function.caller used to retrieve strict caller")); 207 207 } 208 208 … … 415 415 if (descriptor.configurablePresent() && descriptor.configurable()) { 416 416 if (throwException) 417 throwError(exec, createTypeError(exec, "Attempting to configurable attribute of unconfigurable property."));417 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to configurable attribute of unconfigurable property."))); 418 418 return false; 419 419 } 420 420 if (descriptor.enumerablePresent() && descriptor.enumerable()) { 421 421 if (throwException) 422 throwError(exec, createTypeError(exec, "Attempting to change enumerable attribute of unconfigurable property."));422 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change enumerable attribute of unconfigurable property."))); 423 423 return false; 424 424 } 425 425 if (descriptor.isAccessorDescriptor()) { 426 426 if (throwException) 427 throwError(exec, createTypeError(exec, "Attempting to change access mechanism for an unconfigurable property."));427 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change access mechanism for an unconfigurable property."))); 428 428 return false; 429 429 } 430 430 if (descriptor.writablePresent() && descriptor.writable()) { 431 431 if (throwException) 432 throwError(exec, createTypeError(exec, "Attempting to change writable attribute of unconfigurable property."));432 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change writable attribute of unconfigurable property."))); 433 433 return false; 434 434 } 435 435 if (!valueCheck) { 436 436 if (throwException) 437 throwError(exec, createTypeError(exec, "Attempting to change value of a readonly property."));437 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change value of a readonly property."))); 438 438 return false; 439 439 } -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r127348 r127505 105 105 106 106 #if USE(CF) 107 RetainPtr<CFStringRef> canUseJITKey(AdoptCF, CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman)); 108 RetainPtr<CFBooleanRef> canUseJIT(AdoptCF, (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey.get(), kCFPreferencesCurrentApplication)); 107 #if COMPILER(GCC) && !COMPILER(CLANG) 108 // FIXME: remove this once the EWS have been upgraded to LLVM. 109 // Work around a bug of GCC with strict-aliasing. 110 RetainPtr<CFStringRef> canUseJITKeyRetain(AdoptCF, CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman)); 111 CFStringRef canUseJITKey = canUseJITKeyRetain.get(); 112 #else 113 CFStringRef canUseJITKey = CFSTR("JavaScriptCoreUseJIT"); 114 #endif // COMPILER(GCC) && !COMPILER(CLANG) 115 RetainPtr<CFBooleanRef> canUseJIT(AdoptCF, (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication)); 109 116 if (canUseJIT) 110 117 return kCFBooleanTrue == canUseJIT.get(); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r127363 r127505 212 212 m_objectPrototype.set(exec->globalData(), this, ObjectPrototype::create(exec, this, ObjectPrototype::createStructure(exec->globalData(), this, jsNull()))); 213 213 GetterSetter* protoAccessor = GetterSetter::create(exec); 214 protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoGetter));215 protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoSetter));214 protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, String(), globalFuncProtoGetter)); 215 protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, String(), globalFuncProtoSetter)); 216 216 m_objectPrototype->putDirectAccessor(exec->globalData(), exec->propertyNames().underscoreProto, protoAccessor, Accessor | DontEnum); 217 217 m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get()); … … 272 272 Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), this, m_errorPrototype.get()); 273 273 Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(exec->globalData(), this, m_functionPrototype.get()); 274 m_evalErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError"));275 m_rangeErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError"));276 m_referenceErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "ReferenceError"));277 m_syntaxErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "SyntaxError"));278 m_typeErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "TypeError"));279 m_URIErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError"));274 m_evalErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("EvalError"))); 275 m_rangeErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("RangeError"))); 276 m_referenceErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("ReferenceError"))); 277 m_syntaxErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("SyntaxError"))); 278 m_typeErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("TypeError"))); 279 m_URIErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("URIError"))); 280 280 281 281 m_objectPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, objectConstructor, DontEnum); … … 332 332 void JSGlobalObject::createThrowTypeError(ExecState* exec) 333 333 { 334 JSFunction* thrower = JSFunction::create(exec, this, 0, "", globalFuncThrowTypeError);334 JSFunction* thrower = JSFunction::create(exec, this, 0, String(), globalFuncThrowTypeError); 335 335 GetterSetter* getterSetter = GetterSetter::create(exec); 336 336 getterSetter->setGetter(exec->globalData(), thrower); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r127202 r127505 54 54 CString cstr = exec->argument(0).toString(exec)->value(exec).utf8(true); 55 55 if (!cstr.data()) 56 return throwError(exec, createURIError(exec, "String contained an illegal UTF-16 sequence."));56 return throwError(exec, createURIError(exec, ASCIILiteral("String contained an illegal UTF-16 sequence."))); 57 57 58 58 JSStringBuilder builder; … … 115 115 if (charLen == 0) { 116 116 if (strict) 117 return throwError(exec, createURIError(exec, "URI error"));117 return throwError(exec, createURIError(exec, ASCIILiteral("URI error"))); 118 118 // The only case where we don't use "strict" mode is the "unescape" function. 119 119 // For that, it's good to support the wonky "%u" syntax for compatibility with WinIE. … … 500 500 JSObject* unwrappedObject = thisObject->unwrappedObject(); 501 501 if (!unwrappedObject->isGlobalObject() || jsCast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee()) 502 return throwVMError(exec, createEvalError(exec, "The \"this\" value passed to eval must be the global object from which eval originated"));502 return throwVMError(exec, createEvalError(exec, ASCIILiteral("The \"this\" value passed to eval must be the global object from which eval originated"))); 503 503 504 504 JSValue x = exec->argument(0); -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r127349 r127505 362 362 363 363 if (value.isNull()) { 364 builder.append ("null");364 builder.appendLiteral("null"); 365 365 return StringifySucceeded; 366 366 } … … 372 372 373 373 if (value.isBoolean()) { 374 builder.append(value.isTrue() ? "true" : "false"); 374 if (value.isTrue()) 375 builder.appendLiteral("true"); 376 else 377 builder.appendLiteral("false"); 375 378 return StringifySucceeded; 376 379 } … … 385 388 double number = value.asNumber(); 386 389 if (!isfinite(number)) 387 builder.append ("null");390 builder.appendLiteral("null"); 388 391 else 389 392 builder.append(String::numberToStringECMAScript(number)); … … 399 402 if (object->methodTable()->getCallData(object, callData) != CallTypeNone) { 400 403 if (holder->inherits(&JSArray::s_info)) { 401 builder.append ("null");404 builder.appendLiteral("null"); 402 405 return StringifySucceeded; 403 406 } … … 408 411 for (unsigned i = 0; i < m_holderStack.size(); i++) { 409 412 if (m_holderStack[i].object() == object) { 410 throwError(m_exec, createTypeError(m_exec, "JSON.stringify cannot serialize cyclic structures."));413 throwError(m_exec, createTypeError(m_exec, ASCIILiteral("JSON.stringify cannot serialize cyclic structures."))); 411 414 return StringifyFailed; 412 415 } … … 570 573 switch (stringifyResult) { 571 574 case StringifyFailed: 572 builder.append ("null");575 builder.appendLiteral("null"); 573 576 break; 574 577 case StringifySucceeded: … … 810 813 { 811 814 if (!exec->argumentCount()) 812 return throwVMError(exec, createError(exec, "JSON.parse requires at least one parameter"));815 return throwVMError(exec, createError(exec, ASCIILiteral("JSON.parse requires at least one parameter"))); 813 816 String source = exec->argument(0).toString(exec)->value(exec); 814 817 if (exec->hadException()) … … 844 847 { 845 848 if (!exec->argumentCount()) 846 return throwVMError(exec, createError(exec, "No input to stringify"));849 return throwVMError(exec, createError(exec, ASCIILiteral("No input to stringify"))); 847 850 LocalScope scope(exec->globalData()); 848 851 Local<Unknown> value(exec->globalData(), exec->argument(0)); -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r127191 r127505 183 183 if (prototype.isNull()) { 184 184 if (!thisObject->putDirectInternal<PutModePut>(globalData, propertyName, value, 0, slot, getCallableObject(value)) && slot.isStrictMode()) 185 throwTypeError(exec, StrictModeReadonlyPropertyWriteError);185 throwTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)); 186 186 return; 187 187 } … … 196 196 if (attributes & ReadOnly) { 197 197 if (slot.isStrictMode()) 198 throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));198 throwError(exec, createTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError))); 199 199 return; 200 200 } … … 205 205 if (!setterFunc) { 206 206 if (slot.isStrictMode()) 207 throwError(exec, createTypeError(exec, "setting a property that has only a getter"));207 throwError(exec, createTypeError(exec, ASCIILiteral("setting a property that has only a getter"))); 208 208 return; 209 209 } … … 230 230 231 231 if (!thisObject->putDirectInternal<PutModePut>(globalData, propertyName, value, 0, slot, getCallableObject(value)) && slot.isStrictMode()) 232 throwTypeError(exec, StrictModeReadonlyPropertyWriteError);232 throwTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)); 233 233 return; 234 234 } … … 390 390 ASSERT(!exec->hadException()); 391 391 392 return throwError(exec, createTypeError(exec, "No default value"));392 return throwError(exec, createTypeError(exec, ASCIILiteral("No default value"))); 393 393 } 394 394 … … 410 410 411 411 if (!proto.isObject()) { 412 throwError(exec, createTypeError(exec, "instanceof called on an object with an invalid prototype property."));412 throwError(exec, createTypeError(exec, ASCIILiteral("instanceof called on an object with an invalid prototype property."))); 413 413 return false; 414 414 } … … 719 719 if (!object->isExtensible()) { 720 720 if (throwException) 721 throwError(exec, createTypeError(exec, "Attempting to define property on object that is not extensible."));721 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to define property on object that is not extensible."))); 722 722 return false; 723 723 } … … 737 737 if (descriptor.configurable()) { 738 738 if (throwException) 739 throwError(exec, createTypeError(exec, "Attempting to configurable attribute of unconfigurable property."));739 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to configurable attribute of unconfigurable property."))); 740 740 return false; 741 741 } 742 742 if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) { 743 743 if (throwException) 744 throwError(exec, createTypeError(exec, "Attempting to change enumerable attribute of unconfigurable property."));744 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change enumerable attribute of unconfigurable property."))); 745 745 return false; 746 746 } … … 760 760 if (!current.configurable()) { 761 761 if (throwException) 762 throwError(exec, createTypeError(exec, "Attempting to change access mechanism for an unconfigurable property."));762 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change access mechanism for an unconfigurable property."))); 763 763 return false; 764 764 } … … 772 772 if (!current.writable() && descriptor.writable()) { 773 773 if (throwException) 774 throwError(exec, createTypeError(exec, "Attempting to change writable attribute of unconfigurable property."));774 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change writable attribute of unconfigurable property."))); 775 775 return false; 776 776 } … … 778 778 if (descriptor.value() && !sameValue(exec, current.value(), descriptor.value())) { 779 779 if (throwException) 780 throwError(exec, createTypeError(exec, "Attempting to change value of a readonly property."));780 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change value of a readonly property."))); 781 781 return false; 782 782 } … … 794 794 if (descriptor.setterPresent() && !(current.setterPresent() && JSValue::strictEqual(exec, current.setter(), descriptor.setter()))) { 795 795 if (throwException) 796 throwError(exec, createTypeError(exec, "Attempting to change the setter of an unconfigurable property."));796 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change the setter of an unconfigurable property."))); 797 797 return false; 798 798 } 799 799 if (descriptor.getterPresent() && !(current.getterPresent() && JSValue::strictEqual(exec, current.getter(), descriptor.getter()))) { 800 800 if (throwException) 801 throwError(exec, createTypeError(exec, "Attempting to change the getter of an unconfigurable property."));801 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change the getter of an unconfigurable property."))); 802 802 return false; 803 803 } -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r127191 r127505 226 226 // Return a safe no-value result, this should never be used, since the excetion will be thrown. 227 227 if (exec->exception()) 228 return js String(exec, "");228 return jsEmptyString(exec); 229 229 ASSERT(!isRope()); 230 230 ASSERT(i < m_value.length()); -
trunk/Source/JavaScriptCore/runtime/JSString.h
r127212 r127505 51 51 JSString* jsNontrivialString(JSGlobalData*, const String&); 52 52 JSString* jsNontrivialString(ExecState*, const String&); 53 JSString* jsNontrivialString(JSGlobalData*, const char*);54 JSString* jsNontrivialString(ExecState*, const char*);55 53 56 54 // Should be used for strings that are owned by an object that will … … 354 352 } 355 353 356 inline JSString* jsNontrivialString(JSGlobalData* globalData, const char* s)357 {358 ASSERT(s);359 ASSERT(s[0]);360 ASSERT(s[1]);361 return JSString::create(*globalData, String(s).impl());362 }363 364 354 inline JSString* jsNontrivialString(JSGlobalData* globalData, const String& s) 365 355 { … … 469 459 inline JSString* jsSubstring(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring(&exec->globalData(), s, offset, length); } 470 460 inline JSString* jsNontrivialString(ExecState* exec, const String& s) { return jsNontrivialString(&exec->globalData(), s); } 471 inline JSString* jsNontrivialString(ExecState* exec, const char* s) { return jsNontrivialString(&exec->globalData(), s); }472 461 inline JSString* jsOwnedString(ExecState* exec, const String& s) { return jsOwnedString(&exec->globalData(), s); } 473 462 -
trunk/Source/JavaScriptCore/runtime/JSValue.cpp
r127191 r127505 144 144 if (!setterFunc) { 145 145 if (slot.isStrictMode()) 146 throwError(exec, createTypeError(exec, "setting a property that has only a getter"));146 throwError(exec, createTypeError(exec, ASCIILiteral("setting a property that has only a getter"))); 147 147 return; 148 148 } -
trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp
r127191 r127505 270 270 if (*m_ptr == '\'') { 271 271 if (mode == StrictJSON) { 272 m_lexErrorMessage = "Single quotes (\') are not allowed in JSON";272 m_lexErrorMessage = ASCIILiteral("Single quotes (\') are not allowed in JSON"); 273 273 return TokError; 274 274 } … … 357 357 ++m_ptr; 358 358 if (m_ptr >= m_end) { 359 m_lexErrorMessage = "Unterminated string";359 m_lexErrorMessage = ASCIILiteral("Unterminated string"); 360 360 return TokError; 361 361 } … … 396 396 case 'u': 397 397 if ((m_end - m_ptr) < 5) { 398 m_lexErrorMessage = "\\u must be followed by 4 hex digits";398 m_lexErrorMessage = ASCIILiteral("\\u must be followed by 4 hex digits"); 399 399 return TokError; 400 400 } // uNNNN == 5 characters … … 422 422 423 423 if (m_ptr >= m_end || *m_ptr != terminator) { 424 m_lexErrorMessage = "Unterminated string";424 m_lexErrorMessage = ASCIILiteral("Unterminated string"); 425 425 return TokError; 426 426 } … … 475 475 ++m_ptr; 476 476 } else { 477 m_lexErrorMessage = "Invalid number";477 m_lexErrorMessage = ASCIILiteral("Invalid number"); 478 478 return TokError; 479 479 } … … 484 484 // [0-9]+ 485 485 if (m_ptr >= m_end || !isASCIIDigit(*m_ptr)) { 486 m_lexErrorMessage = "Invalid digits after decimal point";486 m_lexErrorMessage = ASCIILiteral("Invalid digits after decimal point"); 487 487 return TokError; 488 488 } … … 519 519 // [0-9]+ 520 520 if (m_ptr >= m_end || !isASCIIDigit(*m_ptr)) { 521 m_lexErrorMessage = "Exponent symbols should be followed by an optional '+' or '-' and then by at least one number";521 m_lexErrorMessage = ASCIILiteral("Exponent symbols should be followed by an optional '+' or '-' and then by at least one number"); 522 522 return TokError; 523 523 } … … 556 556 if (m_lexer.next() == TokRBracket) { 557 557 if (lastToken == TokComma) { 558 m_parseErrorMessage = "Unexpected comma at the end of array expression";558 m_parseErrorMessage = ASCIILiteral("Unexpected comma at the end of array expression"); 559 559 return JSValue(); 560 560 } … … 575 575 576 576 if (m_lexer.currentToken().type != TokRBracket) { 577 m_parseErrorMessage = "Expected ']'";577 m_parseErrorMessage = ASCIILiteral("Expected ']'"); 578 578 return JSValue(); 579 579 } … … 595 595 // Check for colon 596 596 if (m_lexer.next() != TokColon) { 597 m_parseErrorMessage = "Expected ':' before value in object property definition";597 m_parseErrorMessage = ASCIILiteral("Expected ':' before value in object property definition"); 598 598 return JSValue(); 599 599 } … … 608 608 } 609 609 if (type != TokRBrace) { 610 m_parseErrorMessage = "Expected '}'";610 m_parseErrorMessage = ASCIILiteral("Expected '}'"); 611 611 return JSValue(); 612 612 } … … 620 620 TokenType type = m_lexer.next(); 621 621 if (type != TokString && (m_mode == StrictJSON || type != TokIdentifier)) { 622 m_parseErrorMessage = "Property name must be a string literal";622 m_parseErrorMessage = ASCIILiteral("Property name must be a string literal"); 623 623 return JSValue(); 624 624 } … … 627 627 // Check for colon 628 628 if (m_lexer.next() != TokColon) { 629 m_parseErrorMessage = "Expected ':'";629 m_parseErrorMessage = ASCIILiteral("Expected ':'"); 630 630 return JSValue(); 631 631 } … … 646 646 goto doParseObjectStartExpression; 647 647 if (m_lexer.currentToken().type != TokRBrace) { 648 m_parseErrorMessage = "Expected '}'";648 m_parseErrorMessage = ASCIILiteral("Expected '}'"); 649 649 return JSValue(); 650 650 } … … 691 691 break; 692 692 case TokRBracket: 693 m_parseErrorMessage = "Unexpected token ']'";693 m_parseErrorMessage = ASCIILiteral("Unexpected token ']'"); 694 694 return JSValue(); 695 695 case TokRBrace: 696 m_parseErrorMessage = "Unexpected token '}'";696 m_parseErrorMessage = ASCIILiteral("Unexpected token '}'"); 697 697 return JSValue(); 698 698 case TokIdentifier: { … … 705 705 } 706 706 case TokColon: 707 m_parseErrorMessage = "Unexpected token ':'";707 m_parseErrorMessage = ASCIILiteral("Unexpected token ':'"); 708 708 return JSValue(); 709 709 case TokLParen: 710 m_parseErrorMessage = "Unexpected token '('";710 m_parseErrorMessage = ASCIILiteral("Unexpected token '('"); 711 711 return JSValue(); 712 712 case TokRParen: 713 m_parseErrorMessage = "Unexpected token ')'";713 m_parseErrorMessage = ASCIILiteral("Unexpected token ')'"); 714 714 return JSValue(); 715 715 case TokComma: 716 m_parseErrorMessage = "Unexpected token ','";716 m_parseErrorMessage = ASCIILiteral("Unexpected token ','"); 717 717 return JSValue(); 718 718 case TokDot: 719 m_parseErrorMessage = "Unexpected token '.'";719 m_parseErrorMessage = ASCIILiteral("Unexpected token '.'"); 720 720 return JSValue(); 721 721 case TokAssign: 722 m_parseErrorMessage = "Unexpected token '='";722 m_parseErrorMessage = ASCIILiteral("Unexpected token '='"); 723 723 return JSValue(); 724 724 case TokSemi: 725 m_parseErrorMessage = "Unexpected token ';'";725 m_parseErrorMessage = ASCIILiteral("Unexpected token ';'"); 726 726 return JSValue(); 727 727 case TokEnd: 728 m_parseErrorMessage = "Unexpected EOF";728 m_parseErrorMessage = ASCIILiteral("Unexpected EOF"); 729 729 return JSValue(); 730 730 case TokError: 731 731 default: 732 732 // Error 733 m_parseErrorMessage = "Could not parse value expression";733 m_parseErrorMessage = ASCIILiteral("Could not parse value expression"); 734 734 return JSValue(); 735 735 } … … 749 749 } 750 750 case TokRBracket: 751 m_parseErrorMessage = "Unexpected token ']'";751 m_parseErrorMessage = ASCIILiteral("Unexpected token ']'"); 752 752 return JSValue(); 753 753 case TokLBrace: 754 m_parseErrorMessage = "Unexpected token '{'";754 m_parseErrorMessage = ASCIILiteral("Unexpected token '{'"); 755 755 return JSValue(); 756 756 case TokRBrace: 757 m_parseErrorMessage = "Unexpected token '}'";757 m_parseErrorMessage = ASCIILiteral("Unexpected token '}'"); 758 758 return JSValue(); 759 759 case TokIdentifier: 760 m_parseErrorMessage = "Unexpected identifier";760 m_parseErrorMessage = ASCIILiteral("Unexpected identifier"); 761 761 return JSValue(); 762 762 case TokColon: 763 m_parseErrorMessage = "Unexpected token ':'";763 m_parseErrorMessage = ASCIILiteral("Unexpected token ':'"); 764 764 return JSValue(); 765 765 case TokRParen: 766 m_parseErrorMessage = "Unexpected token ')'";766 m_parseErrorMessage = ASCIILiteral("Unexpected token ')'"); 767 767 return JSValue(); 768 768 case TokComma: 769 m_parseErrorMessage = "Unexpected token ','";769 m_parseErrorMessage = ASCIILiteral("Unexpected token ','"); 770 770 return JSValue(); 771 771 case TokTrue: 772 m_parseErrorMessage = "Unexpected token 'true'";772 m_parseErrorMessage = ASCIILiteral("Unexpected token 'true'"); 773 773 return JSValue(); 774 774 case TokFalse: 775 m_parseErrorMessage = "Unexpected token 'false'";775 m_parseErrorMessage = ASCIILiteral("Unexpected token 'false'"); 776 776 return JSValue(); 777 777 case TokNull: 778 m_parseErrorMessage = "Unexpected token 'null'";778 m_parseErrorMessage = ASCIILiteral("Unexpected token 'null'"); 779 779 return JSValue(); 780 780 case TokEnd: 781 m_parseErrorMessage = "Unexpected EOF";781 m_parseErrorMessage = ASCIILiteral("Unexpected EOF"); 782 782 return JSValue(); 783 783 case TokDot: 784 m_parseErrorMessage = "Unexpected token '.'";784 m_parseErrorMessage = ASCIILiteral("Unexpected token '.'"); 785 785 return JSValue(); 786 786 case TokAssign: 787 m_parseErrorMessage = "Unexpected token '='";787 m_parseErrorMessage = ASCIILiteral("Unexpected token '='"); 788 788 return JSValue(); 789 789 case TokSemi: 790 m_parseErrorMessage = "Unexpected token ';'";790 m_parseErrorMessage = ASCIILiteral("Unexpected token ';'"); 791 791 return JSValue(); 792 792 case TokError: 793 793 default: 794 m_parseErrorMessage = "Could not parse statement";794 m_parseErrorMessage = ASCIILiteral("Could not parse statement"); 795 795 return JSValue(); 796 796 } … … 802 802 if (m_lexer.next() == TokEnd) 803 803 return lastValue; 804 m_parseErrorMessage = "Unexpected content at end of JSON literal";804 m_parseErrorMessage = ASCIILiteral("Unexpected content at end of JSON literal"); 805 805 return JSValue(); 806 806 } -
trunk/Source/JavaScriptCore/runtime/LiteralParser.h
r127191 r127505 101 101 if (!m_parseErrorMessage.isEmpty()) 102 102 return String::format("JSON Parse error: %s", m_parseErrorMessage.ascii().data()).impl(); 103 return "JSON Parse error: Unable to parse JSON string";103 return ASCIILiteral("JSON Parse error: Unable to parse JSON string"); 104 104 } 105 105 -
trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp
r127191 r127505 379 379 bool isUndefined; 380 380 if (!getIntegerArgumentInRange(exec, 0, 20, decimalPlacesInExponent, isUndefined)) 381 return throwVMError(exec, createRangeError(exec, "toExponential() argument must be between 0 and 20"));381 return throwVMError(exec, createRangeError(exec, ASCIILiteral("toExponential() argument must be between 0 and 20"))); 382 382 383 383 // Handle NaN and Infinity. … … 410 410 bool isUndefined; // This is ignored; undefined treated as 0. 411 411 if (!getIntegerArgumentInRange(exec, 0, 20, decimalPlaces, isUndefined)) 412 return throwVMError(exec, createRangeError(exec, "toFixed() argument must be between 0 and 20"));412 return throwVMError(exec, createRangeError(exec, ASCIILiteral("toFixed() argument must be between 0 and 20"))); 413 413 414 414 // 15.7.4.5.7 states "If x >= 10^21, then let m = ToString(x)" … … 443 443 bool isUndefined; 444 444 if (!getIntegerArgumentInRange(exec, 1, 21, significantFigures, isUndefined)) 445 return throwVMError(exec, createRangeError(exec, "toPrecision() argument must be between 1 and 21"));445 return throwVMError(exec, createRangeError(exec, ASCIILiteral("toPrecision() argument must be between 1 and 21"))); 446 446 447 447 // To precision called with no argument is treated as ToString. … … 498 498 int32_t radix = extractRadixFromArgs(exec); 499 499 if (radix < 2 || radix > 36) 500 return throwVMError(exec, createRangeError(exec, "toString() radix argument must be between 2 and 36"));500 return throwVMError(exec, createRangeError(exec, ASCIILiteral("toString() radix argument must be between 2 and 36"))); 501 501 502 502 int32_t integerValue = static_cast<int32_t>(doubleValue); -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r127191 r127505 138 138 { 139 139 if (!exec->argument(0).isObject()) 140 return throwVMError(exec, createTypeError(exec, "Requested prototype of a value that is not an object."));140 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested prototype of a value that is not an object."))); 141 141 JSObject* object = asObject(exec->argument(0)); 142 142 if (!object->allowsAccessFrom(exec->trueCallerFrame())) … … 148 148 { 149 149 if (!exec->argument(0).isObject()) 150 return throwVMError(exec, createTypeError(exec, "Requested property descriptor of a value that is not an object."));150 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested property descriptor of a value that is not an object."))); 151 151 String propertyName = exec->argument(1).toString(exec)->value(exec); 152 152 if (exec->hadException()) … … 180 180 { 181 181 if (!exec->argument(0).isObject()) 182 return throwVMError(exec, createTypeError(exec, "Requested property names of a value that is not an object."));182 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested property names of a value that is not an object."))); 183 183 PropertyNameArray properties(exec); 184 184 asObject(exec->argument(0))->methodTable()->getOwnPropertyNames(asObject(exec->argument(0)), exec, properties, IncludeDontEnumProperties); … … 194 194 { 195 195 if (!exec->argument(0).isObject()) 196 return throwVMError(exec, createTypeError(exec, "Requested keys of a value that is not an object."));196 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Requested keys of a value that is not an object."))); 197 197 PropertyNameArray properties(exec); 198 198 asObject(exec->argument(0))->methodTable()->getOwnPropertyNames(asObject(exec->argument(0)), exec, properties, ExcludeDontEnumProperties); … … 208 208 { 209 209 if (!in.isObject()) { 210 throwError(exec, createTypeError(exec, "Property description must be an object."));210 throwError(exec, createTypeError(exec, ASCIILiteral("Property description must be an object."))); 211 211 return false; 212 212 } … … 250 250 CallData callData; 251 251 if (getCallData(get, callData) == CallTypeNone) { 252 throwError(exec, createTypeError(exec, "Getter must be a function."));252 throwError(exec, createTypeError(exec, ASCIILiteral("Getter must be a function."))); 253 253 return false; 254 254 } … … 265 265 CallData callData; 266 266 if (getCallData(set, callData) == CallTypeNone) { 267 throwError(exec, createTypeError(exec, "Setter must be a function."));267 throwError(exec, createTypeError(exec, ASCIILiteral("Setter must be a function."))); 268 268 return false; 269 269 } … … 276 276 277 277 if (desc.value()) { 278 throwError(exec, createTypeError(exec, "Invalid property. 'value' present on property with getter or setter."));278 throwError(exec, createTypeError(exec, ASCIILiteral("Invalid property. 'value' present on property with getter or setter."))); 279 279 return false; 280 280 } 281 281 282 282 if (desc.writablePresent()) { 283 throwError(exec, createTypeError(exec, "Invalid property. 'writable' present on property with getter or setter."));283 throwError(exec, createTypeError(exec, ASCIILiteral("Invalid property. 'writable' present on property with getter or setter."))); 284 284 return false; 285 285 } … … 290 290 { 291 291 if (!exec->argument(0).isObject()) 292 return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));292 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Properties can only be defined on Objects."))); 293 293 JSObject* O = asObject(exec->argument(0)); 294 294 String propertyName = exec->argument(1).toString(exec)->value(exec); … … 341 341 { 342 342 if (!exec->argument(0).isObject()) 343 return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));343 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Properties can only be defined on Objects."))); 344 344 return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), exec->argument(1).toObject(exec))); 345 345 } … … 348 348 { 349 349 if (!exec->argument(0).isObject() && !exec->argument(0).isNull()) 350 return throwVMError(exec, createTypeError(exec, "Object prototype may only be an Object or null."));350 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object prototype may only be an Object or null."))); 351 351 JSValue proto = exec->argument(0); 352 352 JSObject* newObject = proto.isObject() ? constructEmptyObject(exec, asObject(proto)->inheritorID(exec->globalData())) : constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure()); … … 354 354 return JSValue::encode(newObject); 355 355 if (!exec->argument(1).isObject()) 356 return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object."));356 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Property descriptor list must be an Object."))); 357 357 return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1)))); 358 358 } … … 363 363 JSValue obj = exec->argument(0); 364 364 if (!obj.isObject()) 365 return throwVMError(exec, createTypeError(exec, "Object.seal can only be called on Objects."));365 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object.seal can only be called on Objects."))); 366 366 JSObject* object = asObject(obj); 367 367 … … 400 400 JSValue obj = exec->argument(0); 401 401 if (!obj.isObject()) 402 return throwVMError(exec, createTypeError(exec, "Object.freeze can only be called on Objects."));402 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object.freeze can only be called on Objects."))); 403 403 JSObject* object = asObject(obj); 404 404 … … 440 440 JSValue obj = exec->argument(0); 441 441 if (!obj.isObject()) 442 return throwVMError(exec, createTypeError(exec, "Object.preventExtensions can only be called on Objects."));442 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object.preventExtensions can only be called on Objects."))); 443 443 asObject(obj)->preventExtensions(exec->globalData()); 444 444 return JSValue::encode(obj); … … 450 450 JSValue obj = exec->argument(0); 451 451 if (!obj.isObject()) 452 return throwVMError(exec, createTypeError(exec, "Object.isSealed can only be called on Objects."));452 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object.isSealed can only be called on Objects."))); 453 453 JSObject* object = asObject(obj); 454 454 … … 480 480 JSValue obj = exec->argument(0); 481 481 if (!obj.isObject()) 482 return throwVMError(exec, createTypeError(exec, "Object.isFrozen can only be called on Objects."));482 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object.isFrozen can only be called on Objects."))); 483 483 JSObject* object = asObject(obj); 484 484 … … 510 510 JSValue obj = exec->argument(0); 511 511 if (!obj.isObject()) 512 return throwVMError(exec, createTypeError(exec, "Object.isExtensible can only be called on Objects."));512 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object.isExtensible can only be called on Objects."))); 513 513 return JSValue::encode(jsBoolean(asObject(obj)->isExtensible())); 514 514 } -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp
r116828 r127505 158 158 CallData callData; 159 159 if (getCallData(get, callData) == CallTypeNone) 160 return throwVMError(exec, createSyntaxError(exec, "invalid getter usage"));160 return throwVMError(exec, createSyntaxError(exec, ASCIILiteral("invalid getter usage"))); 161 161 162 162 PropertyDescriptor descriptor; … … 178 178 CallData callData; 179 179 if (getCallData(set, callData) == CallTypeNone) 180 return throwVMError(exec, createSyntaxError(exec, "invalid setter usage"));180 return throwVMError(exec, createSyntaxError(exec, ASCIILiteral("invalid setter usage"))); 181 181 182 182 PropertyDescriptor descriptor; … … 248 248 JSValue thisValue = exec->hostThisValue(); 249 249 if (thisValue.isUndefinedOrNull()) 250 return JSValue::encode(jsNontrivialString(exec, thisValue.isUndefined() ? "[object Undefined]" : "[object Null]"));250 return JSValue::encode(jsNontrivialString(exec, String(thisValue.isUndefined() ? ASCIILiteral("[object Undefined]") : ASCIILiteral("[object Null]")))); 251 251 JSObject* thisObject = thisValue.toObject(exec); 252 252 -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r127191 r127505 263 263 if (arg0.inherits(&RegExpObject::s_info)) { 264 264 if (!arg1.isUndefined()) 265 return throwError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));265 return throwError(exec, createTypeError(exec, ASCIILiteral("Cannot supply flags when constructing one RegExp from another."))); 266 266 // If called as a function, this just returns the first argument (see 15.10.3.1). 267 267 if (callAsConstructor) { … … 282 282 return 0; 283 283 if (flags == InvalidFlags) 284 return throwError(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));284 return throwError(exec, createSyntaxError(exec, ASCIILiteral("Invalid flags supplied to RegExp constructor."))); 285 285 } 286 286 -
trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp
r127191 r127505 131 131 { 132 132 if (throwException) 133 throwTypeError(exec, message);133 throwTypeError(exec, ASCIILiteral(message)); 134 134 return false; 135 135 } … … 192 192 // that would match the same thing. 193 193 if (!length) 194 return js String(exec, "(?:)");194 return jsNontrivialString(exec, ASCIILiteral("(?:)")); 195 195 196 196 // early return for strings that don't contain a forwards slash and LineTerminator … … 252 252 result.append('r'); 253 253 else if (ch == 0x2028) 254 result.append ("u2028");254 result.appendLiteral("u2028"); 255 255 else 256 result.append ("u2029");256 result.appendLiteral("u2029"); 257 257 } else 258 258 result.append(ch); -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
r127191 r127505 107 107 if (arg0.inherits(&RegExpObject::s_info)) { 108 108 if (!arg1.isUndefined()) 109 return throwVMError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));109 return throwVMError(exec, createTypeError(exec, ASCIILiteral("Cannot supply flags when constructing one RegExp from another."))); 110 110 regExp = asRegExpObject(arg0)->regExp(); 111 111 } else { … … 120 120 return JSValue::encode(jsUndefined()); 121 121 if (flags == InvalidFlags) 122 return throwVMError(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));122 return throwVMError(exec, createSyntaxError(exec, ASCIILiteral("Invalid flags supplied to RegExp constructor."))); 123 123 } 124 124 regExp = RegExp::create(exec->globalData(), pattern, flags); -
trunk/Source/JavaScriptCore/runtime/StringObject.cpp
r127191 r127505 86 86 if (!object->isExtensible()) { 87 87 if (throwException) 88 throwError(exec, createTypeError(exec, "Attempting to define property on object that is not extensible."));88 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to define property on object that is not extensible."))); 89 89 return false; 90 90 } 91 91 if (descriptor.configurablePresent() && descriptor.configurable()) { 92 92 if (throwException) 93 throwError(exec, createTypeError(exec, "Attempting to configurable attribute of unconfigurable property."));93 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to configurable attribute of unconfigurable property."))); 94 94 return false; 95 95 } 96 96 if (descriptor.enumerablePresent() && descriptor.enumerable()) { 97 97 if (throwException) 98 throwError(exec, createTypeError(exec, "Attempting to change enumerable attribute of unconfigurable property."));98 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change enumerable attribute of unconfigurable property."))); 99 99 return false; 100 100 } 101 101 if (descriptor.isAccessorDescriptor()) { 102 102 if (throwException) 103 throwError(exec, createTypeError(exec, "Attempting to change access mechanism for an unconfigurable property."));103 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change access mechanism for an unconfigurable property."))); 104 104 return false; 105 105 } 106 106 if (descriptor.writablePresent() && descriptor.writable()) { 107 107 if (throwException) 108 throwError(exec, createTypeError(exec, "Attempting to change writable attribute of unconfigurable property."));108 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change writable attribute of unconfigurable property."))); 109 109 return false; 110 110 } … … 114 114 return true; 115 115 if (throwException) 116 throwError(exec, createTypeError(exec, "Attempting to change value of a readonly property."));116 throwError(exec, createTypeError(exec, ASCIILiteral("Attempting to change value of a readonly property."))); 117 117 return false; 118 118 } -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r127349 r127505 288 288 289 289 if (!totalLength) 290 return js String(exec, "");290 return jsEmptyString(exec); 291 291 292 292 if (source.is8Bit()) { … … 349 349 350 350 if (!totalLength) 351 return js String(exec, "");351 return jsEmptyString(exec); 352 352 353 353 if (source.is8Bit() && allSeperators8Bit) {
Note: See TracChangeset
for help on using the changeset viewer.