diff options
| author | John Reck <jreck@google.com> | 2010-11-04 12:00:17 -0700 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2010-11-09 11:35:04 -0800 |
| commit | e14391e94c850b8bd03680c23b38978db68687a8 (patch) | |
| tree | 3fed87e6620fecaf3edc7259ae58a11662bedcb2 /JavaScriptCore/runtime | |
| parent | 1bd705833a68f07850cf7e204b26f8d328d16951 (diff) | |
| download | external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.zip external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.gz external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.bz2 | |
Merge Webkit at r70949: Initial merge by git.
Change-Id: I77b8645c083b5d0da8dba73ed01d4014aab9848e
Diffstat (limited to 'JavaScriptCore/runtime')
46 files changed, 348 insertions, 416 deletions
diff --git a/JavaScriptCore/runtime/Arguments.cpp b/JavaScriptCore/runtime/Arguments.cpp index 5c5e522..39886a8 100644 --- a/JavaScriptCore/runtime/Arguments.cpp +++ b/JavaScriptCore/runtime/Arguments.cpp @@ -191,7 +191,7 @@ bool Arguments::getOwnPropertySlot(ExecState* exec, const Identifier& propertyNa } if (propertyName == exec->propertyNames().length && LIKELY(!d->overrodeLength)) { - slot.setValue(jsNumber(exec, d->numArguments)); + slot.setValue(jsNumber(d->numArguments)); return true; } @@ -222,7 +222,7 @@ bool Arguments::getOwnPropertyDescriptor(ExecState* exec, const Identifier& prop } if (propertyName == exec->propertyNames().length && LIKELY(!d->overrodeLength)) { - descriptor.setDescriptor(jsNumber(exec, d->numArguments), DontEnum); + descriptor.setDescriptor(jsNumber(d->numArguments), DontEnum); return true; } diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp index e5d0dac..632d466 100644 --- a/JavaScriptCore/runtime/ArrayConstructor.cpp +++ b/JavaScriptCore/runtime/ArrayConstructor.cpp @@ -45,7 +45,7 @@ ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject putDirectWithoutTransition(exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); // ES5 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum); diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp index 6002ebb..ab0c3d4 100644 --- a/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -379,12 +379,12 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPop(ExecState* exec) JSValue result; unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); if (length == 0) { - putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length)); + putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length)); result = jsUndefined(); } else { result = thisObj->get(exec, length - 1); thisObj->deleteProperty(exec, length - 1); - putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1)); + putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - 1)); } return JSValue::encode(result); } @@ -395,7 +395,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec) if (isJSArray(&exec->globalData(), thisValue) && exec->argumentCount() == 1) { JSArray* array = asArray(thisValue); array->push(exec, exec->argument(0)); - return JSValue::encode(jsNumber(exec, array->length())); + return JSValue::encode(jsNumber(array->length())); } JSObject* thisObj = thisValue.toThisObject(exec); @@ -403,8 +403,8 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec) for (unsigned n = 0; n < exec->argumentCount(); n++) thisObj->put(exec, length + n, exec->argument(n)); length += exec->argumentCount(); - putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length)); - return JSValue::encode(jsNumber(exec, length)); + putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length)); + return JSValue::encode(jsNumber(length)); } EncodedJSValue JSC_HOST_CALL arrayProtoFuncReverse(ExecState* exec) @@ -438,7 +438,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec) unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); if (length == 0) { - putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length)); + putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length)); result = jsUndefined(); } else { result = thisObj->get(exec, 0); @@ -453,7 +453,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncShift(ExecState* exec) } thisObj->deleteProperty(exec, length - 1); } - putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - 1)); + putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - 1)); } return JSValue::encode(result); } @@ -600,7 +600,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSplice(ExecState* exec) for (unsigned k = 0; k < additionalArgs; ++k) thisObj->put(exec, k + begin, exec->argument(k + 2)); - putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(exec, length - deleteCount + additionalArgs)); + putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - deleteCount + additionalArgs)); return JSValue::encode(result); } @@ -625,7 +625,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncUnShift(ExecState* exec) } for (unsigned k = 0; k < nrArgs; ++k) thisObj->put(exec, k, exec->argument(k)); - JSValue result = jsNumber(exec, length + nrArgs); + JSValue result = jsNumber(length + nrArgs); putProperty(exec, thisObj, exec->propertyNames().length, result); return JSValue::encode(result); } @@ -649,14 +649,14 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) { JSFunction* f = asFunction(function); JSArray* array = asArray(thisObj); - CachedCall cachedCall(exec, f, 3, exec->exceptionSlot()); + CachedCall cachedCall(exec, f, 3); for (; k < length && !exec->hadException(); ++k) { if (!array->canGetIndex(k)) break; JSValue v = array->getIndex(k); cachedCall.setThis(applyThis); cachedCall.setArgument(0, v); - cachedCall.setArgument(1, jsNumber(exec, k)); + cachedCall.setArgument(1, jsNumber(k)); cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); @@ -677,7 +677,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec) MarkedArgumentBuffer eachArguments; eachArguments.append(v); - eachArguments.append(jsNumber(exec, k)); + eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); @@ -707,14 +707,14 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec) if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) { JSFunction* f = asFunction(function); JSArray* array = asArray(thisObj); - CachedCall cachedCall(exec, f, 3, exec->exceptionSlot()); + CachedCall cachedCall(exec, f, 3); for (; k < length && !exec->hadException(); ++k) { if (UNLIKELY(!array->canGetIndex(k))) break; cachedCall.setThis(applyThis); cachedCall.setArgument(0, array->getIndex(k)); - cachedCall.setArgument(1, jsNumber(exec, k)); + cachedCall.setArgument(1, jsNumber(k)); cachedCall.setArgument(2, thisObj); resultArray->JSArray::put(exec, k, cachedCall.call()); @@ -730,7 +730,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec) MarkedArgumentBuffer eachArguments; eachArguments.append(v); - eachArguments.append(jsNumber(exec, k)); + eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); JSValue result = call(exec, function, callType, callData, applyThis, eachArguments); @@ -764,14 +764,14 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) { JSFunction* f = asFunction(function); JSArray* array = asArray(thisObj); - CachedCall cachedCall(exec, f, 3, exec->exceptionSlot()); + CachedCall cachedCall(exec, f, 3); for (; k < length && !exec->hadException(); ++k) { if (UNLIKELY(!array->canGetIndex(k))) break; cachedCall.setThis(applyThis); cachedCall.setArgument(0, array->getIndex(k)); - cachedCall.setArgument(1, jsNumber(exec, k)); + cachedCall.setArgument(1, jsNumber(k)); cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); if (!result.toBoolean(cachedCall.newCallFrame(exec))) @@ -787,7 +787,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec) MarkedArgumentBuffer eachArguments; eachArguments.append(slot.getValue(exec, k)); - eachArguments.append(jsNumber(exec, k)); + eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); @@ -818,14 +818,14 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec) if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) { JSFunction* f = asFunction(function); JSArray* array = asArray(thisObj); - CachedCall cachedCall(exec, f, 3, exec->exceptionSlot()); + CachedCall cachedCall(exec, f, 3); for (; k < length && !exec->hadException(); ++k) { if (UNLIKELY(!array->canGetIndex(k))) break; cachedCall.setThis(applyThis); cachedCall.setArgument(0, array->getIndex(k)); - cachedCall.setArgument(1, jsNumber(exec, k)); + cachedCall.setArgument(1, jsNumber(k)); cachedCall.setArgument(2, thisObj); cachedCall.call(); @@ -838,7 +838,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec) MarkedArgumentBuffer eachArguments; eachArguments.append(slot.getValue(exec, k)); - eachArguments.append(jsNumber(exec, k)); + eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); call(exec, function, callType, callData, applyThis, eachArguments); @@ -865,14 +865,14 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) { JSFunction* f = asFunction(function); JSArray* array = asArray(thisObj); - CachedCall cachedCall(exec, f, 3, exec->exceptionSlot()); + CachedCall cachedCall(exec, f, 3); for (; k < length && !exec->hadException(); ++k) { if (UNLIKELY(!array->canGetIndex(k))) break; cachedCall.setThis(applyThis); cachedCall.setArgument(0, array->getIndex(k)); - cachedCall.setArgument(1, jsNumber(exec, k)); + cachedCall.setArgument(1, jsNumber(k)); cachedCall.setArgument(2, thisObj); JSValue result = cachedCall.call(); if (result.toBoolean(cachedCall.newCallFrame(exec))) @@ -886,7 +886,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec) MarkedArgumentBuffer eachArguments; eachArguments.append(slot.getValue(exec, k)); - eachArguments.append(jsNumber(exec, k)); + eachArguments.append(jsNumber(k)); eachArguments.append(thisObj); bool predicateResult = call(exec, function, callType, callData, applyThis, eachArguments).toBoolean(exec); @@ -935,7 +935,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) } if (callType == CallTypeJS && array) { - CachedCall cachedCall(exec, asFunction(function), 4, exec->exceptionSlot()); + CachedCall cachedCall(exec, asFunction(function), 4); for (; i < length && !exec->hadException(); ++i) { cachedCall.setThis(jsNull()); cachedCall.setArgument(0, rv); @@ -945,7 +945,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) else break; // length has been made unsafe while we enumerate fallback to slow path cachedCall.setArgument(1, v); - cachedCall.setArgument(2, jsNumber(exec, i)); + cachedCall.setArgument(2, jsNumber(i)); cachedCall.setArgument(3, array); rv = cachedCall.call(); } @@ -961,7 +961,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec) MarkedArgumentBuffer eachArguments; eachArguments.append(rv); eachArguments.append(prop); - eachArguments.append(jsNumber(exec, i)); + eachArguments.append(jsNumber(i)); eachArguments.append(thisObj); rv = call(exec, function, callType, callData, jsNull(), eachArguments); @@ -1005,7 +1005,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) } if (callType == CallTypeJS && array) { - CachedCall cachedCall(exec, asFunction(function), 4, exec->exceptionSlot()); + CachedCall cachedCall(exec, asFunction(function), 4); for (; i < length && !exec->hadException(); ++i) { unsigned idx = length - i - 1; cachedCall.setThis(jsNull()); @@ -1013,7 +1013,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) if (UNLIKELY(!array->canGetIndex(idx))) break; // length has been made unsafe while we enumerate fallback to slow path cachedCall.setArgument(1, array->getIndex(idx)); - cachedCall.setArgument(2, jsNumber(exec, idx)); + cachedCall.setArgument(2, jsNumber(idx)); cachedCall.setArgument(3, array); rv = cachedCall.call(); } @@ -1030,7 +1030,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec) MarkedArgumentBuffer eachArguments; eachArguments.append(rv); eachArguments.append(prop); - eachArguments.append(jsNumber(exec, idx)); + eachArguments.append(jsNumber(idx)); eachArguments.append(thisObj); rv = call(exec, function, callType, callData, jsNull(), eachArguments); @@ -1053,10 +1053,10 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncIndexOf(ExecState* exec) if (!e) continue; if (JSValue::strictEqual(exec, searchElement, e)) - return JSValue::encode(jsNumber(exec, index)); + return JSValue::encode(jsNumber(index)); } - return JSValue::encode(jsNumber(exec, -1)); + return JSValue::encode(jsNumber(-1)); } EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) @@ -1067,7 +1067,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); if (!length) - return JSValue::encode(jsNumber(exec, -1)); + return JSValue::encode(jsNumber(-1)); unsigned index = length - 1; JSValue fromValue = exec->argument(1); @@ -1076,7 +1076,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) if (fromDouble < 0) { fromDouble += length; if (fromDouble < 0) - return JSValue::encode(jsNumber(exec, -1)); + return JSValue::encode(jsNumber(-1)); } if (fromDouble < length) index = static_cast<unsigned>(fromDouble); @@ -1089,10 +1089,10 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncLastIndexOf(ExecState* exec) if (!e) continue; if (JSValue::strictEqual(exec, searchElement, e)) - return JSValue::encode(jsNumber(exec, index)); + return JSValue::encode(jsNumber(index)); } while (index--); - return JSValue::encode(jsNumber(exec, -1)); + return JSValue::encode(jsNumber(-1)); } } // namespace JSC diff --git a/JavaScriptCore/runtime/BooleanConstructor.cpp b/JavaScriptCore/runtime/BooleanConstructor.cpp index 953bddc..0167e03 100644 --- a/JavaScriptCore/runtime/BooleanConstructor.cpp +++ b/JavaScriptCore/runtime/BooleanConstructor.cpp @@ -34,7 +34,7 @@ BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalOb putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum); } // ECMA 15.6.2 diff --git a/JavaScriptCore/runtime/CachedTranscendentalFunction.h b/JavaScriptCore/runtime/CachedTranscendentalFunction.h index 04f7f62..67c7af8 100644 --- a/JavaScriptCore/runtime/CachedTranscendentalFunction.h +++ b/JavaScriptCore/runtime/CachedTranscendentalFunction.h @@ -56,18 +56,18 @@ public: fastFree(m_cache); } - JSValue operator() (ExecState* exec, double operand) + JSValue operator() (double operand) { if (UNLIKELY(!m_cache)) initialize(); CacheEntry* entry = &m_cache[hash(operand)]; if (entry->operand == operand) - return jsDoubleNumber(exec, entry->result); + return jsDoubleNumber(entry->result); double result = orignalFunction(operand); entry->operand = operand; entry->result = result; - return jsDoubleNumber(exec, result); + return jsDoubleNumber(result); } private: diff --git a/JavaScriptCore/runtime/CallData.cpp b/JavaScriptCore/runtime/CallData.cpp index 2b9302a..018e2ca 100644 --- a/JavaScriptCore/runtime/CallData.cpp +++ b/JavaScriptCore/runtime/CallData.cpp @@ -35,7 +35,7 @@ namespace JSC { JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args) { ASSERT(callType == CallTypeJS || callType == CallTypeHost); - return exec->interpreter()->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args, exec->exceptionSlot()); + return exec->interpreter()->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args); } } // namespace JSC diff --git a/JavaScriptCore/runtime/Completion.cpp b/JavaScriptCore/runtime/Completion.cpp index 9af5171..eeb8b0d 100644 --- a/JavaScriptCore/runtime/Completion.cpp +++ b/JavaScriptCore/runtime/Completion.cpp @@ -59,10 +59,12 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec); - JSValue exception; - JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj, &exception); + JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj); + + if (exec->hadException()) { + JSValue exception = exec->exception(); + exec->clearException(); - if (exception) { ComplType exceptionType = Throw; if (exception.isObject()) exceptionType = asObject(exception)->exceptionType(); diff --git a/JavaScriptCore/runtime/ConstructData.cpp b/JavaScriptCore/runtime/ConstructData.cpp index 0d27e25..5da2a91 100644 --- a/JavaScriptCore/runtime/ConstructData.cpp +++ b/JavaScriptCore/runtime/ConstructData.cpp @@ -36,7 +36,7 @@ namespace JSC { JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args) { ASSERT(constructType == ConstructTypeJS || constructType == ConstructTypeHost); - return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args, exec->exceptionSlot()); + return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args); } } // namespace JSC diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp index 49e0405..dcbe12d 100644 --- a/JavaScriptCore/runtime/DateConstructor.cpp +++ b/JavaScriptCore/runtime/DateConstructor.cpp @@ -67,7 +67,7 @@ DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum); putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum); - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete); } // ECMA 15.9.3 @@ -159,12 +159,12 @@ CallType DateConstructor::getCallData(CallData& callData) static EncodedJSValue JSC_HOST_CALL dateParse(ExecState* exec) { - return JSValue::encode(jsNumber(exec, parseDate(exec, exec->argument(0).toString(exec)))); + return JSValue::encode(jsNumber(parseDate(exec, exec->argument(0).toString(exec)))); } -static EncodedJSValue JSC_HOST_CALL dateNow(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL dateNow(ExecState*) { - return JSValue::encode(jsNumber(exec, jsCurrentTime())); + return JSValue::encode(jsNumber(jsCurrentTime())); } static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec) @@ -186,7 +186,7 @@ static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec) || (n >= 5 && isnan(doubleArguments[4])) || (n >= 6 && isnan(doubleArguments[5])) || (n >= 7 && isnan(doubleArguments[6]))) - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNaN()); GregorianDateTime t; int year = JSC::toInt32(doubleArguments[0]); @@ -197,7 +197,7 @@ static EncodedJSValue JSC_HOST_CALL dateUTC(ExecState* exec) t.minute = JSC::toInt32(doubleArguments[4]); t.second = JSC::toInt32(doubleArguments[5]); double ms = (n >= 7) ? doubleArguments[6] : 0; - return JSValue::encode(jsNumber(exec, timeClip(gregorianDateTimeToMS(exec, t, ms, true)))); + return JSValue::encode(jsNumber(timeClip(gregorianDateTimeToMS(exec, t, ms, true)))); } } // namespace JSC diff --git a/JavaScriptCore/runtime/DateInstance.cpp b/JavaScriptCore/runtime/DateInstance.cpp index b43b183..8562e2d 100644 --- a/JavaScriptCore/runtime/DateInstance.cpp +++ b/JavaScriptCore/runtime/DateInstance.cpp @@ -34,22 +34,22 @@ namespace JSC { const ClassInfo DateInstance::info = {"Date", 0, 0, 0}; -DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure) +DateInstance::DateInstance(ExecState*, NonNullPassRefPtr<Structure> structure) : JSWrapperObject(structure) { - setInternalValue(jsNaN(exec)); + setInternalValue(jsNaN()); } -DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure, double time) +DateInstance::DateInstance(ExecState*, NonNullPassRefPtr<Structure> structure, double time) : JSWrapperObject(structure) { - setInternalValue(jsNumber(exec, timeClip(time))); + setInternalValue(jsNumber(timeClip(time))); } DateInstance::DateInstance(ExecState* exec, double time) : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure()) { - setInternalValue(jsNumber(exec, timeClip(time))); + setInternalValue(jsNumber(timeClip(time))); } const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp index 4983f29..085cb33 100644 --- a/JavaScriptCore/runtime/DatePrototype.cpp +++ b/JavaScriptCore/runtime/DatePrototype.cpp @@ -182,7 +182,7 @@ static JSCell* formatLocaleDate(ExecState* exec, DateInstance*, double timeInMil // We truncate the string returned from CFDateFormatter if it's absurdly long (> 200 characters). // That's not great error handling, but it just won't happen so it doesn't matter. UChar buffer[200]; - const size_t bufferLength = sizeof(buffer) / sizeof(buffer[0]); + const size_t bufferLength = WTF_ARRAY_LENGTH(buffer); size_t length = CFStringGetLength(string); ASSERT(length <= bufferLength); if (length > bufferLength) @@ -585,8 +585,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(1900 + gregorianDateTime->year)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec) @@ -599,8 +599,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, 1900 + gregorianDateTime->year)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(1900 + gregorianDateTime->year)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec) @@ -631,8 +631,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->month)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->month)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec) @@ -645,8 +645,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->month)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->month)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec) @@ -659,8 +659,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->monthDay)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec) @@ -673,8 +673,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->monthDay)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->monthDay)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec) @@ -687,8 +687,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->weekDay)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec) @@ -701,8 +701,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->weekDay)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->weekDay)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec) @@ -715,8 +715,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->hour)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->hour)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec) @@ -729,8 +729,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->hour)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->hour)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec) @@ -743,8 +743,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->minute)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->minute)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec) @@ -757,8 +757,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->minute)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->minute)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec) @@ -771,8 +771,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->second)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->second)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec) @@ -785,8 +785,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, gregorianDateTime->second)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(gregorianDateTime->second)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec) @@ -798,11 +798,11 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec) DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); if (isnan(milli)) - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNaN()); double secs = floor(milli / msPerSecond); double ms = milli - secs * msPerSecond; - return JSValue::encode(jsNumber(exec, ms)); + return JSValue::encode(jsNumber(ms)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec) @@ -814,11 +814,11 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec) DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); if (isnan(milli)) - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNaN()); double secs = floor(milli / msPerSecond); double ms = milli - secs * msPerSecond; - return JSValue::encode(jsNumber(exec, ms)); + return JSValue::encode(jsNumber(ms)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec) @@ -831,8 +831,8 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, -gregorianDateTime->utcOffset / minutesPerHour)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(-gregorianDateTime->utcOffset / minutesPerHour)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec) @@ -844,7 +844,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec) DateInstance* thisDateObj = asDateInstance(thisValue); double milli = timeClip(exec->argument(0).toNumber(exec)); - JSValue result = jsNumber(exec, milli); + JSValue result = jsNumber(milli); thisDateObj->setInternalValue(result); return JSValue::encode(result); } @@ -859,7 +859,7 @@ static EncodedJSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, double milli = thisDateObj->internalNumber(); if (!exec->argumentCount() || isnan(milli)) { - JSValue result = jsNaN(exec); + JSValue result = jsNaN(); thisDateObj->setInternalValue(result); return JSValue::encode(result); } @@ -871,17 +871,17 @@ static EncodedJSValue setNewValueFromTimeArgs(ExecState* exec, int numArgsToUse, ? thisDateObj->gregorianDateTimeUTC(exec) : thisDateObj->gregorianDateTime(exec); if (!other) - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNaN()); GregorianDateTime gregorianDateTime; gregorianDateTime.copyFrom(*other); if (!fillStructuresUsingTimeArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) { - JSValue result = jsNaN(exec); + JSValue result = jsNaN(); thisDateObj->setInternalValue(result); return JSValue::encode(result); } - JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC)); + JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC)); thisDateObj->setInternalValue(result); return JSValue::encode(result); } @@ -894,7 +894,7 @@ static EncodedJSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, DateInstance* thisDateObj = asDateInstance(thisValue); if (!exec->argumentCount()) { - JSValue result = jsNaN(exec); + JSValue result = jsNaN(); thisDateObj->setInternalValue(result); return JSValue::encode(result); } @@ -911,17 +911,17 @@ static EncodedJSValue setNewValueFromDateArgs(ExecState* exec, int numArgsToUse, ? thisDateObj->gregorianDateTimeUTC(exec) : thisDateObj->gregorianDateTime(exec); if (!other) - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNaN()); gregorianDateTime.copyFrom(*other); } if (!fillStructuresUsingDateArgs(exec, numArgsToUse, &ms, &gregorianDateTime)) { - JSValue result = jsNaN(exec); + JSValue result = jsNaN(); thisDateObj->setInternalValue(result); return JSValue::encode(result); } - JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC)); + JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, inputIsUTC)); thisDateObj->setInternalValue(result); return JSValue::encode(result); } @@ -1018,7 +1018,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec) DateInstance* thisDateObj = asDateInstance(thisValue); if (!exec->argumentCount()) { - JSValue result = jsNaN(exec); + JSValue result = jsNaN(); thisDateObj->setInternalValue(result); return JSValue::encode(result); } @@ -1040,13 +1040,13 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec) double year = exec->argument(0).toIntegerPreserveNaN(exec); if (!isfinite(year)) { - JSValue result = jsNaN(exec); + JSValue result = jsNaN(); thisDateObj->setInternalValue(result); return JSValue::encode(result); } gregorianDateTime.year = toInt32((year > 99 || year < 0) ? year - 1900 : year); - JSValue result = jsNumber(exec, gregorianDateTimeToMS(exec, gregorianDateTime, ms, false)); + JSValue result = jsNumber(gregorianDateTimeToMS(exec, gregorianDateTime, ms, false)); thisDateObj->setInternalValue(result); return JSValue::encode(result); } @@ -1061,10 +1061,10 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec) const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTime(exec); if (!gregorianDateTime) - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNaN()); // NOTE: IE returns the full year even in getYear. - return JSValue::encode(jsNumber(exec, gregorianDateTime->year)); + return JSValue::encode(jsNumber(gregorianDateTime->year)); } EncodedJSValue JSC_HOST_CALL dateProtoFuncToJSON(ExecState* exec) diff --git a/JavaScriptCore/runtime/Error.cpp b/JavaScriptCore/runtime/Error.cpp index e35424b..fd97beb 100644 --- a/JavaScriptCore/runtime/Error.cpp +++ b/JavaScriptCore/runtime/Error.cpp @@ -45,43 +45,43 @@ static const char* expressionEndOffsetPropertyName = "expressionEndOffset"; JSObject* createError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); - return ErrorInstance::create(globalObject->globalData(), globalObject->errorStructure(), message); + return ErrorInstance::create(&globalObject->globalData(), globalObject->errorStructure(), message); } JSObject* createEvalError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); - return ErrorInstance::create(globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message); + return ErrorInstance::create(&globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message); } JSObject* createRangeError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); - return ErrorInstance::create(globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message); + return ErrorInstance::create(&globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message); } JSObject* createReferenceError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); - return ErrorInstance::create(globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message); + return ErrorInstance::create(&globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message); } JSObject* createSyntaxError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); - return ErrorInstance::create(globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message); + return ErrorInstance::create(&globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message); } JSObject* createTypeError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); - return ErrorInstance::create(globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message); + return ErrorInstance::create(&globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message); } JSObject* createURIError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); - return ErrorInstance::create(globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message); + return ErrorInstance::create(&globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message); } JSObject* createError(ExecState* exec, const UString& message) @@ -125,19 +125,19 @@ static void addErrorSourceInfo(JSGlobalData* globalData, JSObject* error, int li const UString& sourceURL = source.provider()->url(); if (line != -1) - error->putWithAttributes(globalData, Identifier(globalData, linePropertyName), jsNumber(globalData, line), ReadOnly | DontDelete); + error->putWithAttributes(globalData, Identifier(globalData, linePropertyName), jsNumber(line), ReadOnly | DontDelete); if (sourceID != -1) - error->putWithAttributes(globalData, Identifier(globalData, sourceIdPropertyName), jsNumber(globalData, (double)sourceID), ReadOnly | DontDelete); + error->putWithAttributes(globalData, Identifier(globalData, sourceIdPropertyName), jsNumber((double)sourceID), ReadOnly | DontDelete); if (!sourceURL.isNull()) error->putWithAttributes(globalData, Identifier(globalData, sourceURLPropertyName), jsString(globalData, sourceURL), ReadOnly | DontDelete); } static void addErrorDivotInfo(JSGlobalData* globalData, JSObject* error, int divotPoint, int startOffset, int endOffset, bool withCaret) { - error->putWithAttributes(globalData, Identifier(globalData, expressionBeginOffsetPropertyName), jsNumber(globalData, divotPoint - startOffset), ReadOnly | DontDelete); - error->putWithAttributes(globalData, Identifier(globalData, expressionEndOffsetPropertyName), jsNumber(globalData, divotPoint + endOffset), ReadOnly | DontDelete); + error->putWithAttributes(globalData, Identifier(globalData, expressionBeginOffsetPropertyName), jsNumber(divotPoint - startOffset), ReadOnly | DontDelete); + error->putWithAttributes(globalData, Identifier(globalData, expressionEndOffsetPropertyName), jsNumber(divotPoint + endOffset), ReadOnly | DontDelete); if (withCaret) - error->putWithAttributes(globalData, Identifier(globalData, expressionCaretOffsetPropertyName), jsNumber(globalData, divotPoint), ReadOnly | DontDelete); + error->putWithAttributes(globalData, Identifier(globalData, expressionCaretOffsetPropertyName), jsNumber(divotPoint), ReadOnly | DontDelete); } JSObject* addErrorInfo(JSGlobalData* globalData, JSObject* error, int line, const SourceCode& source) diff --git a/JavaScriptCore/runtime/ErrorConstructor.cpp b/JavaScriptCore/runtime/ErrorConstructor.cpp index a0874d4..4326a4d 100644 --- a/JavaScriptCore/runtime/ErrorConstructor.cpp +++ b/JavaScriptCore/runtime/ErrorConstructor.cpp @@ -34,7 +34,7 @@ ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject { // ECMA 15.11.3.1 Error.prototype putDirectWithoutTransition(exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); } // ECMA 15.9.3 diff --git a/JavaScriptCore/runtime/ExceptionHelpers.cpp b/JavaScriptCore/runtime/ExceptionHelpers.cpp index a1e28d1..5fbaa18 100644 --- a/JavaScriptCore/runtime/ExceptionHelpers.cpp +++ b/JavaScriptCore/runtime/ExceptionHelpers.cpp @@ -187,14 +187,19 @@ JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error, return exception; } -JSValue throwOutOfMemoryError(ExecState* exec) +JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const UString& propertyName) +{ + return createReferenceError(exec, makeUString("Strict mode forbids implicit creation of global property '", propertyName, "'")); +} + +JSObject* throwOutOfMemoryError(ExecState* exec) { return throwError(exec, createError(exec, "Out of memory")); } -JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const UString& propertyName) +JSObject* throwStackOverflowError(ExecState* exec) { - return createReferenceError(exec, makeUString("Strict mode forbids implicit creation of global property '", propertyName, "'")); -} + return throwError(exec, createStackOverflowError(exec)); +} } // namespace JSC diff --git a/JavaScriptCore/runtime/ExceptionHelpers.h b/JavaScriptCore/runtime/ExceptionHelpers.h index 9b6f1f2..a7b2ca7 100644 --- a/JavaScriptCore/runtime/ExceptionHelpers.h +++ b/JavaScriptCore/runtime/ExceptionHelpers.h @@ -53,9 +53,11 @@ namespace JSC { JSObject* createNotAConstructorError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*); JSValue createNotAFunctionError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*); JSObject* createNotAnObjectError(ExecState*, JSNotAnObjectErrorStub*, unsigned bytecodeOffset, CodeBlock*); - JSValue throwOutOfMemoryError(ExecState*); JSObject* createErrorForInvalidGlobalAssignment(ExecState*, const UString&); + JSObject* throwOutOfMemoryError(ExecState*); + JSObject* throwStackOverflowError(ExecState*); + } // namespace JSC #endif // ExceptionHelpers_h diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp index 9b59720..45b4802 100644 --- a/JavaScriptCore/runtime/FunctionConstructor.cpp +++ b/JavaScriptCore/runtime/FunctionConstructor.cpp @@ -43,7 +43,7 @@ FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* global putDirectWithoutTransition(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly); // Number of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum); } static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec) @@ -97,7 +97,7 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi } JSGlobalObject* globalObject = exec->lexicalGlobalObject(); - JSGlobalData* globalData = globalObject->globalData(); + JSGlobalData& globalData = globalObject->globalData(); SourceCode source = makeSource(program, sourceURL, lineNumber); JSObject* exception = 0; RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &exception); @@ -106,7 +106,7 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi return throwError(exec, exception); } - ScopeChain scopeChain(globalObject, globalData, globalObject, exec->globalThisValue()); + ScopeChain scopeChain(globalObject, &globalData, globalObject, exec->globalThisValue()); return new (exec) JSFunction(exec, function, scopeChain.node()); } diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp index ef42cdc..cd7739d 100644 --- a/JavaScriptCore/runtime/FunctionPrototype.cpp +++ b/JavaScriptCore/runtime/FunctionPrototype.cpp @@ -41,7 +41,7 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*); FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) : InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier) { - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); } void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction) diff --git a/JavaScriptCore/runtime/GetterSetter.h b/JavaScriptCore/runtime/GetterSetter.h index 27ffbe7..e7b1938 100644 --- a/JavaScriptCore/runtime/GetterSetter.h +++ b/JavaScriptCore/runtime/GetterSetter.h @@ -64,8 +64,8 @@ namespace JSC { inline GetterSetter* asGetterSetter(JSValue value) { - ASSERT(asCell(value)->isGetterSetter()); - return static_cast<GetterSetter*>(asCell(value)); + ASSERT(value.asCell()->isGetterSetter()); + return static_cast<GetterSetter*>(value.asCell()); } diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp index dae807f..b8b92f4 100644 --- a/JavaScriptCore/runtime/JSArray.cpp +++ b/JavaScriptCore/runtime/JSArray.cpp @@ -278,7 +278,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { if (propertyName == exec->propertyNames().length) { - slot.setValue(jsNumber(exec, length())); + slot.setValue(jsNumber(length())); return true; } @@ -293,7 +293,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { - descriptor.setDescriptor(jsNumber(exec, length()), DontDelete | DontEnum); + descriptor.setDescriptor(jsNumber(length()), DontDelete | DontEnum); return true; } @@ -1085,7 +1085,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType, tree.abstractor().m_nodes.grow(nodeCount); if (callType == CallTypeJS) - tree.abstractor().m_cachedCall = adoptPtr(new CachedCall(exec, asFunction(compareFunction), 2, exec->exceptionSlot())); + tree.abstractor().m_cachedCall = adoptPtr(new CachedCall(exec, asFunction(compareFunction), 2)); if (!tree.abstractor().m_nodes.begin()) { throwOutOfMemoryError(exec); diff --git a/JavaScriptCore/runtime/JSByteArray.cpp b/JavaScriptCore/runtime/JSByteArray.cpp index 88519cf..6af9d75 100644 --- a/JavaScriptCore/runtime/JSByteArray.cpp +++ b/JavaScriptCore/runtime/JSByteArray.cpp @@ -40,7 +40,7 @@ JSByteArray::JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure> structure , m_storage(storage) , m_classInfo(classInfo) { - putDirect(exec->globalData().propertyNames->length, jsNumber(exec, m_storage->length()), ReadOnly | DontDelete); + putDirect(exec->globalData().propertyNames->length, jsNumber(m_storage->length()), ReadOnly | DontDelete); } #if !ASSERT_DISABLED diff --git a/JavaScriptCore/runtime/JSByteArray.h b/JavaScriptCore/runtime/JSByteArray.h index e9a6c64..44bae2d 100644 --- a/JavaScriptCore/runtime/JSByteArray.h +++ b/JavaScriptCore/runtime/JSByteArray.h @@ -36,10 +36,10 @@ namespace JSC { friend class JSGlobalData; public: bool canAccessIndex(unsigned i) { return i < m_storage->length(); } - JSValue getIndex(ExecState* exec, unsigned i) + JSValue getIndex(ExecState*, unsigned i) { ASSERT(canAccessIndex(i)); - return jsNumber(exec, m_storage->data()[i]); + return jsNumber(m_storage->data()[i]); } void setIndex(unsigned i, int value) @@ -106,7 +106,7 @@ namespace JSC { JSByteArray* asByteArray(JSValue value); inline JSByteArray* asByteArray(JSValue value) { - return static_cast<JSByteArray*>(asCell(value)); + return static_cast<JSByteArray*>(value.asCell()); } inline bool isJSByteArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsByteArrayVPtr; } diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h index 1a7f8b2..7d4929d 100644 --- a/JavaScriptCore/runtime/JSCell.h +++ b/JavaScriptCore/runtime/JSCell.h @@ -216,14 +216,14 @@ namespace JSC { inline CallType getCallData(JSValue value, CallData& callData) { - CallType result = value.isCell() ? asCell(value)->getCallData(callData) : CallTypeNone; + CallType result = value.isCell() ? value.asCell()->getCallData(callData) : CallTypeNone; ASSERT(result == CallTypeNone || value.isValidCallee()); return result; } inline ConstructType getConstructData(JSValue value, ConstructData& constructData) { - ConstructType result = value.isCell() ? asCell(value)->getConstructData(constructData) : ConstructTypeNone; + ConstructType result = value.isCell() ? value.asCell()->getConstructData(constructData) : ConstructTypeNone; ASSERT(result == ConstructTypeNone || value.isValidCallee()); return result; } diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp index fdaa509..0697fc3 100644 --- a/JavaScriptCore/runtime/JSFunction.cpp +++ b/JavaScriptCore/runtime/JSFunction.cpp @@ -74,7 +74,7 @@ JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPas , m_scopeChain(globalObject->globalScopeChain()) { putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); - putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); + putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); } #endif @@ -87,7 +87,7 @@ JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPas { putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); #if ENABLE(JIT) - putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); + putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); #else UNUSED_PARAM(length); UNUSED_PARAM(func); @@ -192,11 +192,11 @@ JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, const Identi return exec->interpreter()->retrieveCaller(exec, thisObj); } -JSValue JSFunction::lengthGetter(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, const Identifier&) { JSFunction* thisObj = asFunction(slotBase); ASSERT(!thisObj->isHostFunction()); - return jsNumber(exec, thisObj->jsExecutable()->parameterCount()); + return jsNumber(thisObj->jsExecutable()->parameterCount()); } bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -266,7 +266,7 @@ bool JSFunction::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pro } if (propertyName == exec->propertyNames().length) { - descriptor.setDescriptor(jsNumber(exec, jsExecutable()->parameterCount()), ReadOnly | DontEnum | DontDelete); + descriptor.setDescriptor(jsNumber(jsExecutable()->parameterCount()), ReadOnly | DontEnum | DontDelete); return true; } diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp index 903e573..a8fb7bf 100644 --- a/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -116,7 +116,7 @@ JSGlobalObject::~JSGlobalObject() for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it) (*it)->clearGlobalObject(); - RegisterFile& registerFile = globalData()->interpreter->registerFile(); + RegisterFile& registerFile = globalData().interpreter->registerFile(); if (registerFile.clearGlobalObject(this)) registerFile.setNumGlobals(0); d()->destructor(d()); @@ -301,13 +301,13 @@ void JSGlobalObject::reset(JSValue prototype) // Set global values. GlobalPropertyInfo staticGlobals[] = { GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, this, MathObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete), - GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(exec), DontEnum | DontDelete | ReadOnly), - GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(exec, Inf), DontEnum | DontDelete | ReadOnly), + GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(), DontEnum | DontDelete | ReadOnly), + GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(Inf), DontEnum | DontDelete | ReadOnly), GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly), GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(this, JSONObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete) }; - addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo)); + addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); // Set global functions. @@ -349,9 +349,9 @@ void JSGlobalObject::markChildren(MarkStack& markStack) for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it) (*it)->markAggregate(markStack); - RegisterFile& registerFile = globalData()->interpreter->registerFile(); + RegisterFile& registerFile = globalData().interpreter->registerFile(); if (registerFile.globalObject() == this) - registerFile.markGlobals(markStack, &globalData()->heap); + registerFile.markGlobals(markStack, &globalData().heap); markIfNeeded(markStack, d()->regExpConstructor); markIfNeeded(markStack, d()->errorConstructor); diff --git a/JavaScriptCore/runtime/JSGlobalObject.h b/JavaScriptCore/runtime/JSGlobalObject.h index 36fa70b..93a1b88 100644 --- a/JavaScriptCore/runtime/JSGlobalObject.h +++ b/JavaScriptCore/runtime/JSGlobalObject.h @@ -276,7 +276,7 @@ namespace JSC { void resetPrototype(JSValue prototype); - JSGlobalData* globalData() { return d()->globalData.get(); } + JSGlobalData& globalData() { return *d()->globalData.get(); } JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); } static PassRefPtr<Structure> createStructure(JSValue prototype) diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index ed06fa5..284806e 100644 --- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -455,7 +455,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec) if (error) return throwVMError(exec, error); - return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot())); + return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node())); } EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec) @@ -464,7 +464,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec) int32_t radix = exec->argument(1).toInt32(exec); if (radix != 0 && radix != 10) - return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix))); + return JSValue::encode(jsNumber(parseInt(value.toString(exec), radix))); if (value.isInt32()) return JSValue::encode(value); @@ -472,18 +472,18 @@ EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec) if (value.isDouble()) { double d = value.asDouble(); if (isfinite(d)) - return JSValue::encode(jsNumber(exec, (d > 0) ? floor(d) : ceil(d))); + return JSValue::encode(jsNumber((d > 0) ? floor(d) : ceil(d))); if (isnan(d) || isinf(d)) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, 0)); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(0)); } - return JSValue::encode(jsNumber(exec, parseInt(value.toString(exec), radix))); + return JSValue::encode(jsNumber(parseInt(value.toString(exec), radix))); } EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec) { - return JSValue::encode(jsNumber(exec, parseFloat(exec->argument(0).toString(exec)))); + return JSValue::encode(jsNumber(parseFloat(exec->argument(0).toString(exec)))); } EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec) diff --git a/JavaScriptCore/runtime/JSNumberCell.h b/JavaScriptCore/runtime/JSNumberCell.h index a25c531..0040067 100644 --- a/JavaScriptCore/runtime/JSNumberCell.h +++ b/JavaScriptCore/runtime/JSNumberCell.h @@ -36,81 +36,60 @@ namespace JSC { extern const double Inf; #if USE(JSVALUE64) - ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState*, double d) + ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d) { *this = JSImmediate::fromNumberOutsideIntegerRange(d); } - inline JSValue::JSValue(ExecState*, double d) + inline JSValue::JSValue(double d) { JSValue v = JSImmediate::from(d); ASSERT(v); *this = v; } - inline JSValue::JSValue(ExecState*, int i) + inline JSValue::JSValue(int i) { JSValue v = JSImmediate::from(i); ASSERT(v); *this = v; } - inline JSValue::JSValue(ExecState*, unsigned i) + inline JSValue::JSValue(unsigned i) { JSValue v = JSImmediate::from(i); ASSERT(v); *this = v; } - inline JSValue::JSValue(ExecState*, long i) + inline JSValue::JSValue(long i) { JSValue v = JSImmediate::from(i); ASSERT(v); *this = v; } - inline JSValue::JSValue(ExecState*, unsigned long i) + inline JSValue::JSValue(unsigned long i) { JSValue v = JSImmediate::from(i); ASSERT(v); *this = v; } - inline JSValue::JSValue(ExecState*, long long i) + inline JSValue::JSValue(long long i) { JSValue v = JSImmediate::from(static_cast<double>(i)); ASSERT(v); *this = v; } - inline JSValue::JSValue(ExecState*, unsigned long long i) + inline JSValue::JSValue(unsigned long long i) { JSValue v = JSImmediate::from(static_cast<double>(i)); ASSERT(v); *this = v; } - inline JSValue::JSValue(JSGlobalData*, double d) - { - JSValue v = JSImmediate::from(d); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(JSGlobalData*, int i) - { - JSValue v = JSImmediate::from(i); - ASSERT(v); - *this = v; - } - - inline JSValue::JSValue(JSGlobalData*, unsigned i) - { - JSValue v = JSImmediate::from(i); - ASSERT(v); - *this = v; - } - inline bool JSValue::isDouble() const { return JSImmediate::isDouble(asValue()); @@ -136,45 +115,40 @@ namespace JSC { #if USE(JSVALUE64) - inline JSValue::JSValue(ExecState*, char i) + inline JSValue::JSValue(char i) { ASSERT(JSImmediate::from(i)); *this = JSImmediate::from(i); } - inline JSValue::JSValue(ExecState*, unsigned char i) + inline JSValue::JSValue(unsigned char i) { ASSERT(JSImmediate::from(i)); *this = JSImmediate::from(i); } - inline JSValue::JSValue(ExecState*, short i) + inline JSValue::JSValue(short i) { ASSERT(JSImmediate::from(i)); *this = JSImmediate::from(i); } - inline JSValue::JSValue(ExecState*, unsigned short i) + inline JSValue::JSValue(unsigned short i) { ASSERT(JSImmediate::from(i)); *this = JSImmediate::from(i); } - inline JSValue jsNaN(ExecState* exec) - { - return jsNumber(exec, NaN); - } - - inline JSValue jsNaN(JSGlobalData* globalData) + inline JSValue jsNaN() { - return jsNumber(globalData, NaN); + return jsNumber(NaN); } // --- JSValue inlines ---------------------------- ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const { - return isNumber() ? asValue() : jsNumber(exec, this->toNumber(exec)); + return isNumber() ? asValue() : jsNumber(this->toNumber(exec)); } inline bool JSValue::getNumber(double &result) const diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp index 0794189..b5477a1 100644 --- a/JavaScriptCore/runtime/JSONObject.cpp +++ b/JavaScriptCore/runtime/JSONObject.cpp @@ -133,7 +133,7 @@ static inline JSValue unwrapBoxedPrimitive(ExecState* exec, JSValue value) return value; JSObject* object = asObject(value); if (object->inherits(&NumberObject::info)) - return jsNumber(exec, object->toNumber(exec)); + return jsNumber(object->toNumber(exec)); if (object->inherits(&StringObject::info)) return jsString(exec, object->toString(exec)); if (object->inherits(&BooleanObject::info)) @@ -189,7 +189,7 @@ JSValue PropertyNameForFunctionCall::value(ExecState* exec) const if (m_identifier) m_value = jsString(exec, m_identifier->ustring()); else - m_value = jsNumber(exec, m_number); + m_value = jsNumber(m_number); } return m_value; } @@ -329,7 +329,7 @@ void Stringifier::appendQuotedString(UStringBuilder& builder, const UString& val static const char hexDigits[] = "0123456789abcdef"; UChar ch = data[i]; UChar hex[] = { '\\', 'u', hexDigits[(ch >> 12) & 0xF], hexDigits[(ch >> 8) & 0xF], hexDigits[(ch >> 4) & 0xF], hexDigits[ch & 0xF] }; - builder.append(hex, sizeof(hex) / sizeof(UChar)); + builder.append(hex, WTF_ARRAY_LENGTH(hex)); break; } } @@ -357,7 +357,7 @@ inline JSValue Stringifier::toJSON(JSValue value, const PropertyNameForFunctionC return value; JSValue list[] = { propertyName.value(m_exec) }; - ArgList args(list, sizeof(list) / sizeof(JSValue)); + ArgList args(list, WTF_ARRAY_LENGTH(list)); return call(m_exec, object, callType, callData, value, args); } @@ -371,7 +371,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(UStringBuilder& // Call the replacer function. if (m_replacerCallType != CallTypeNone) { JSValue list[] = { propertyName.value(m_exec), value }; - ArgList args(list, sizeof(list) / sizeof(JSValue)); + ArgList args(list, WTF_ARRAY_LENGTH(list)); value = call(m_exec, m_replacer, m_replacerCallType, m_replacerCallData, holder, args); if (m_exec->hadException()) return StringifyFailed; @@ -868,7 +868,7 @@ EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec) UString JSONStringify(ExecState* exec, JSValue value, unsigned indent) { - JSValue result = Stringifier(exec, jsNull(), jsNumber(exec, indent)).stringify(value); + JSValue result = Stringifier(exec, jsNull(), jsNumber(indent)).stringify(value); if (result.isUndefinedOrNull()) return UString(); return result.getString(exec); diff --git a/JavaScriptCore/runtime/JSString.cpp b/JavaScriptCore/runtime/JSString.cpp index bc0120f..340a898 100644 --- a/JavaScriptCore/runtime/JSString.cpp +++ b/JavaScriptCore/runtime/JSString.cpp @@ -236,7 +236,7 @@ bool JSString::getOwnPropertySlot(ExecState* exec, const Identifier& propertyNam bool JSString::getStringPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { - descriptor.setDescriptor(jsNumber(exec, m_length), DontEnum | DontDelete | ReadOnly); + descriptor.setDescriptor(jsNumber(m_length), DontEnum | DontDelete | ReadOnly); return true; } diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h index 12ced10..4d81a2f 100644 --- a/JavaScriptCore/runtime/JSString.h +++ b/JavaScriptCore/runtime/JSString.h @@ -379,8 +379,8 @@ namespace JSC { void appendValueInConstructAndIncrementLength(ExecState* exec, unsigned& index, JSValue v) { if (v.isString()) { - ASSERT(asCell(v)->isString()); - JSString* s = static_cast<JSString*>(asCell(v)); + ASSERT(v.asCell()->isString()); + JSString* s = static_cast<JSString*>(v.asCell()); ASSERT(s->fiberCount() == 1); appendStringInConstruct(index, s); m_length += s->length(); @@ -451,8 +451,8 @@ namespace JSC { inline JSString* asString(JSValue value) { - ASSERT(asCell(value)->isString()); - return static_cast<JSString*>(asCell(value)); + ASSERT(value.asCell()->isString()); + return static_cast<JSString*>(value.asCell()); } inline JSString* jsEmptyString(JSGlobalData* globalData) @@ -559,7 +559,7 @@ namespace JSC { ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { if (propertyName == exec->propertyNames().length) { - slot.setValue(jsNumber(exec, m_length)); + slot.setValue(jsNumber(m_length)); return true; } diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h index b5dcbec..cad9662 100644 --- a/JavaScriptCore/runtime/JSValue.h +++ b/JavaScriptCore/runtime/JSValue.h @@ -101,21 +101,18 @@ namespace JSC { JSValue(const JSCell* ptr); // Numbers - JSValue(EncodeAsDoubleTag, ExecState*, double); - JSValue(ExecState*, double); - JSValue(ExecState*, char); - JSValue(ExecState*, unsigned char); - JSValue(ExecState*, short); - JSValue(ExecState*, unsigned short); - JSValue(ExecState*, int); - JSValue(ExecState*, unsigned); - JSValue(ExecState*, long); - JSValue(ExecState*, unsigned long); - JSValue(ExecState*, long long); - JSValue(ExecState*, unsigned long long); - JSValue(JSGlobalData*, double); - JSValue(JSGlobalData*, int); - JSValue(JSGlobalData*, unsigned); + JSValue(EncodeAsDoubleTag, double); + explicit JSValue(double); + explicit JSValue(char); + explicit JSValue(unsigned char); + explicit JSValue(short); + explicit JSValue(unsigned short); + explicit JSValue(int); + explicit JSValue(unsigned); + explicit JSValue(long); + explicit JSValue(unsigned long); + explicit JSValue(long long); + explicit JSValue(unsigned long long); operator bool() const; bool operator==(const JSValue& other) const; @@ -226,12 +223,12 @@ namespace JSC { JSObject* synthesizeObject(ExecState*) const; #if USE(JSVALUE32_64) - enum { Int32Tag = 0xffffffff }; - enum { CellTag = 0xfffffffe }; - enum { TrueTag = 0xfffffffd }; - enum { FalseTag = 0xfffffffc }; - enum { NullTag = 0xfffffffb }; - enum { UndefinedTag = 0xfffffffa }; + enum { NullTag = 0xffffffff }; + enum { UndefinedTag = 0xfffffffe }; + enum { Int32Tag = 0xfffffffd }; + enum { CellTag = 0xfffffffc }; + enum { TrueTag = 0xfffffffb }; + enum { FalseTag = 0xfffffffa }; enum { EmptyValueTag = 0xfffffff9 }; enum { DeletedValueTag = 0xfffffff8 }; @@ -294,79 +291,64 @@ namespace JSC { return b ? JSValue(JSValue::JSTrue) : JSValue(JSValue::JSFalse); } - ALWAYS_INLINE JSValue jsDoubleNumber(ExecState* exec, double d) + ALWAYS_INLINE JSValue jsDoubleNumber(double d) { - return JSValue(JSValue::EncodeAsDouble, exec, d); + return JSValue(JSValue::EncodeAsDouble, d); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, double d) + ALWAYS_INLINE JSValue jsNumber(double d) { - return JSValue(exec, d); + return JSValue(d); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, char i) + ALWAYS_INLINE JSValue jsNumber(char i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned char i) + ALWAYS_INLINE JSValue jsNumber(unsigned char i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, short i) + ALWAYS_INLINE JSValue jsNumber(short i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned short i) + ALWAYS_INLINE JSValue jsNumber(unsigned short i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, int i) + ALWAYS_INLINE JSValue jsNumber(int i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned i) + ALWAYS_INLINE JSValue jsNumber(unsigned i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, long i) + ALWAYS_INLINE JSValue jsNumber(long i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned long i) + ALWAYS_INLINE JSValue jsNumber(unsigned long i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, long long i) + ALWAYS_INLINE JSValue jsNumber(long long i) { - return JSValue(exec, i); + return JSValue(i); } - ALWAYS_INLINE JSValue jsNumber(ExecState* exec, unsigned long long i) + ALWAYS_INLINE JSValue jsNumber(unsigned long long i) { - return JSValue(exec, i); - } - - ALWAYS_INLINE JSValue jsNumber(JSGlobalData* globalData, double d) - { - return JSValue(globalData, d); - } - - ALWAYS_INLINE JSValue jsNumber(JSGlobalData* globalData, int i) - { - return JSValue(globalData, i); - } - - ALWAYS_INLINE JSValue jsNumber(JSGlobalData* globalData, unsigned i) - { - return JSValue(globalData, i); + return JSValue(i); } inline bool operator==(const JSValue a, const JSCell* b) { return a == JSValue(b); } @@ -375,14 +357,6 @@ namespace JSC { inline bool operator!=(const JSValue a, const JSCell* b) { return a != JSValue(b); } inline bool operator!=(const JSCell* a, const JSValue b) { return JSValue(a) != b; } - // FIXME: We should deprecate this and just use JSValue::asCell() instead. - JSCell* asCell(JSValue); - - inline JSCell* asCell(JSValue value) - { - return value.asCell(); - } - ALWAYS_INLINE int32_t JSValue::toInt32(ExecState* exec) const { if (isInt32()) @@ -397,9 +371,9 @@ namespace JSC { } #if USE(JSVALUE32_64) - inline JSValue jsNaN(ExecState* exec) + inline JSValue jsNaN() { - return JSValue(exec, nonInlineNaN()); + return JSValue(nonInlineNaN()); } // JSValue member functions. @@ -573,115 +547,90 @@ namespace JSC { return reinterpret_cast<JSCell*>(u.asBits.payload); } - ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState*, double d) + ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, double d) { u.asDouble = d; } - inline JSValue::JSValue(ExecState* exec, double d) + inline JSValue::JSValue(double d) { const int32_t asInt32 = static_cast<int32_t>(d); if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 u.asDouble = d; return; } - *this = JSValue(exec, static_cast<int32_t>(d)); + *this = JSValue(static_cast<int32_t>(d)); } - inline JSValue::JSValue(ExecState* exec, char i) + inline JSValue::JSValue(char i) { - *this = JSValue(exec, static_cast<int32_t>(i)); + *this = JSValue(static_cast<int32_t>(i)); } - inline JSValue::JSValue(ExecState* exec, unsigned char i) + inline JSValue::JSValue(unsigned char i) { - *this = JSValue(exec, static_cast<int32_t>(i)); + *this = JSValue(static_cast<int32_t>(i)); } - inline JSValue::JSValue(ExecState* exec, short i) + inline JSValue::JSValue(short i) { - *this = JSValue(exec, static_cast<int32_t>(i)); + *this = JSValue(static_cast<int32_t>(i)); } - inline JSValue::JSValue(ExecState* exec, unsigned short i) + inline JSValue::JSValue(unsigned short i) { - *this = JSValue(exec, static_cast<int32_t>(i)); + *this = JSValue(static_cast<int32_t>(i)); } - inline JSValue::JSValue(ExecState*, int i) + inline JSValue::JSValue(int i) { u.asBits.tag = Int32Tag; u.asBits.payload = i; } - inline JSValue::JSValue(ExecState* exec, unsigned i) + inline JSValue::JSValue(unsigned i) { if (static_cast<int32_t>(i) < 0) { - *this = JSValue(exec, static_cast<double>(i)); + *this = JSValue(static_cast<double>(i)); return; } - *this = JSValue(exec, static_cast<int32_t>(i)); + *this = JSValue(static_cast<int32_t>(i)); } - inline JSValue::JSValue(ExecState* exec, long i) + inline JSValue::JSValue(long i) { if (static_cast<int32_t>(i) != i) { - *this = JSValue(exec, static_cast<double>(i)); + *this = JSValue(static_cast<double>(i)); return; } - *this = JSValue(exec, static_cast<int32_t>(i)); + *this = JSValue(static_cast<int32_t>(i)); } - inline JSValue::JSValue(ExecState* exec, unsigned long i) + inline JSValue::JSValue(unsigned long i) { if (static_cast<uint32_t>(i) != i) { - *this = JSValue(exec, static_cast<double>(i)); + *this = JSValue(static_cast<double>(i)); return; } - *this = JSValue(exec, static_cast<uint32_t>(i)); + *this = JSValue(static_cast<uint32_t>(i)); } - inline JSValue::JSValue(ExecState* exec, long long i) + inline JSValue::JSValue(long long i) { if (static_cast<int32_t>(i) != i) { - *this = JSValue(exec, static_cast<double>(i)); + *this = JSValue(static_cast<double>(i)); return; } - *this = JSValue(exec, static_cast<int32_t>(i)); + *this = JSValue(static_cast<int32_t>(i)); } - inline JSValue::JSValue(ExecState* exec, unsigned long long i) + inline JSValue::JSValue(unsigned long long i) { if (static_cast<uint32_t>(i) != i) { - *this = JSValue(exec, static_cast<double>(i)); - return; - } - *this = JSValue(exec, static_cast<uint32_t>(i)); - } - - inline JSValue::JSValue(JSGlobalData* globalData, double d) - { - const int32_t asInt32 = static_cast<int32_t>(d); - if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 - u.asDouble = d; - return; - } - *this = JSValue(globalData, static_cast<int32_t>(d)); - } - - inline JSValue::JSValue(JSGlobalData*, int i) - { - u.asBits.tag = Int32Tag; - u.asBits.payload = i; - } - - inline JSValue::JSValue(JSGlobalData* globalData, unsigned i) - { - if (static_cast<int32_t>(i) < 0) { - *this = JSValue(globalData, static_cast<double>(i)); + *this = JSValue(static_cast<double>(i)); return; } - *this = JSValue(globalData, static_cast<int32_t>(i)); + *this = JSValue(static_cast<uint32_t>(i)); } inline bool JSValue::isNumber() const @@ -722,7 +671,7 @@ namespace JSC { ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const { - return isNumber() ? asValue() : jsNumber(exec, this->toNumber(exec)); + return isNumber() ? asValue() : jsNumber(this->toNumber(exec)); } inline bool JSValue::getNumber(double& result) const diff --git a/JavaScriptCore/runtime/LiteralParser.cpp b/JavaScriptCore/runtime/LiteralParser.cpp index f1df15f..ed69f4d 100644 --- a/JavaScriptCore/runtime/LiteralParser.cpp +++ b/JavaScriptCore/runtime/LiteralParser.cpp @@ -393,7 +393,7 @@ JSValue LiteralParser::parse(ParserState initialState) case TokNumber: { Lexer::LiteralParserToken numberToken = m_lexer.currentToken(); m_lexer.next(); - lastValue = jsNumber(m_exec, numberToken.numberToken); + lastValue = jsNumber(numberToken.numberToken); break; } case TokNull: diff --git a/JavaScriptCore/runtime/MathObject.cpp b/JavaScriptCore/runtime/MathObject.cpp index 8d2ae2d..080d7d2 100644 --- a/JavaScriptCore/runtime/MathObject.cpp +++ b/JavaScriptCore/runtime/MathObject.cpp @@ -89,14 +89,14 @@ const ClassInfo MathObject::info = { "Math", 0, 0, ExecState::mathTable }; MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure) : JSObjectWithGlobalObject(globalObject, structure) { - putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly); - putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly); - putDirectWithoutTransition(Identifier(exec, "LN10"), jsNumber(exec, log(10.0)), DontDelete | DontEnum | ReadOnly); - putDirectWithoutTransition(Identifier(exec, "LOG2E"), jsNumber(exec, 1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly); - putDirectWithoutTransition(Identifier(exec, "LOG10E"), jsNumber(exec, 1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly); - putDirectWithoutTransition(Identifier(exec, "PI"), jsNumber(exec, piDouble), DontDelete | DontEnum | ReadOnly); - putDirectWithoutTransition(Identifier(exec, "SQRT1_2"), jsNumber(exec, sqrt(0.5)), DontDelete | DontEnum | ReadOnly); - putDirectWithoutTransition(Identifier(exec, "SQRT2"), jsNumber(exec, sqrt(2.0)), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exp(1.0)), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(log(2.0)), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "LN10"), jsNumber(log(10.0)), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "LOG2E"), jsNumber(1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "LOG10E"), jsNumber(1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "PI"), jsNumber(piDouble), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "SQRT1_2"), jsNumber(sqrt(0.5)), DontDelete | DontEnum | ReadOnly); + putDirectWithoutTransition(Identifier(exec, "SQRT2"), jsNumber(sqrt(2.0)), DontDelete | DontEnum | ReadOnly); } // ECMA 15.8 @@ -115,54 +115,54 @@ bool MathObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pro EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec) { - return JSValue::encode(jsNumber(exec, fabs(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsNumber(fabs(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(acos(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(asin(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(atan(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec) { double arg0 = exec->argument(0).toNumber(exec); double arg1 = exec->argument(1).toNumber(exec); - return JSValue::encode(jsDoubleNumber(exec, atan2(arg0, arg1))); + return JSValue::encode(jsDoubleNumber(atan2(arg0, arg1))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec) { - return JSValue::encode(jsNumber(exec, ceil(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsNumber(ceil(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(cos(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(exp(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec) { - return JSValue::encode(jsNumber(exec, floor(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsNumber(floor(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(log(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec) @@ -178,7 +178,7 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec) if (val > result || (val == 0 && result == 0 && !signbit(val))) result = val; } - return JSValue::encode(jsNumber(exec, result)); + return JSValue::encode(jsNumber(result)); } EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec) @@ -194,7 +194,7 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec) if (val < result || (val == 0 && result == 0 && signbit(val))) result = val; } - return JSValue::encode(jsNumber(exec, result)); + return JSValue::encode(jsNumber(result)); } EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec) @@ -205,37 +205,37 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec) double arg2 = exec->argument(1).toNumber(exec); if (isnan(arg2)) - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNaN()); if (isinf(arg2) && fabs(arg) == 1) - return JSValue::encode(jsNaN(exec)); - return JSValue::encode(jsNumber(exec, pow(arg, arg2))); + return JSValue::encode(jsNaN()); + return JSValue::encode(jsNumber(pow(arg, arg2))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, exec->lexicalGlobalObject()->weakRandomNumber())); + return JSValue::encode(jsDoubleNumber(exec->lexicalGlobalObject()->weakRandomNumber())); } EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec) { double arg = exec->argument(0).toNumber(exec); double integer = ceil(arg); - return JSValue::encode(jsNumber(exec, integer - (integer - arg > 0.5))); + return JSValue::encode(jsNumber(integer - (integer - arg > 0.5))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec) { - return JSValue::encode(exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec))); + return JSValue::encode(exec->globalData().cachedSin(exec->argument(0).toNumber(exec))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(sqrt(exec->argument(0).toNumber(exec)))); } EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec) { - return JSValue::encode(jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec)))); + return JSValue::encode(jsDoubleNumber(tan(exec->argument(0).toNumber(exec)))); } } // namespace JSC diff --git a/JavaScriptCore/runtime/NativeErrorConstructor.cpp b/JavaScriptCore/runtime/NativeErrorConstructor.cpp index 31f9bc3..eb508eb 100644 --- a/JavaScriptCore/runtime/NativeErrorConstructor.cpp +++ b/JavaScriptCore/runtime/NativeErrorConstructor.cpp @@ -37,7 +37,7 @@ NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* { NativeErrorPrototype* prototype = new (exec) NativeErrorPrototype(exec, globalObject, prototypeStructure, nameAndMessage, this); - putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5 + putDirect(exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5 putDirect(exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum); m_errorStructure = ErrorInstance::createStructure(prototype); } diff --git a/JavaScriptCore/runtime/NumberConstructor.cpp b/JavaScriptCore/runtime/NumberConstructor.cpp index a197952..5369ca0 100644 --- a/JavaScriptCore/runtime/NumberConstructor.cpp +++ b/JavaScriptCore/runtime/NumberConstructor.cpp @@ -61,7 +61,7 @@ NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObje putDirectWithoutTransition(exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } bool NumberConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -74,29 +74,29 @@ bool NumberConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifi return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, descriptor); } -static JSValue numberConstructorNaNValue(ExecState* exec, JSValue, const Identifier&) +static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&) { - return jsNaN(exec); + return jsNaN(); } -static JSValue numberConstructorNegInfinity(ExecState* exec, JSValue, const Identifier&) +static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, -Inf); + return jsNumber(-Inf); } -static JSValue numberConstructorPosInfinity(ExecState* exec, JSValue, const Identifier&) +static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, Inf); + return jsNumber(Inf); } -static JSValue numberConstructorMaxValue(ExecState* exec, JSValue, const Identifier&) +static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, 1.7976931348623157E+308); + return jsNumber(1.7976931348623157E+308); } -static JSValue numberConstructorMinValue(ExecState* exec, JSValue, const Identifier&) +static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, 5E-324); + return jsNumber(5E-324); } // ECMA 15.7.1 @@ -104,7 +104,7 @@ static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* ex { NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure()); double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0; - object->setInternalValue(jsNumber(exec, n)); + object->setInternalValue(jsNumber(n)); return JSValue::encode(object); } @@ -117,7 +117,7 @@ ConstructType NumberConstructor::getConstructData(ConstructData& constructData) // ECMA 15.7.2 static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec) { - return JSValue::encode(jsNumber(exec, !exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec))); + return JSValue::encode(jsNumber(!exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec))); } CallType NumberConstructor::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp index 4a2ca74..0b86c00 100644 --- a/JavaScriptCore/runtime/NumberPrototype.cpp +++ b/JavaScriptCore/runtime/NumberPrototype.cpp @@ -49,7 +49,7 @@ static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*); NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure) : NumberObject(structure) { - setInternalValue(jsNumber(exec, 0)); + setInternalValue(jsNumber(0)); // The constructor will be added later, after NumberConstructor has been constructed diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp index b1f9d70..ca3dcd7 100644 --- a/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -50,7 +50,7 @@ ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObje putDirectWithoutTransition(exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().getPrototypeOf, objectConstructorGetPrototypeOf), DontEnum); putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 2, exec->propertyNames().getOwnPropertyDescriptor, objectConstructorGetOwnPropertyDescriptor), DontEnum); diff --git a/JavaScriptCore/runtime/Operations.cpp b/JavaScriptCore/runtime/Operations.cpp index cf236bf..f129a80 100644 --- a/JavaScriptCore/runtime/Operations.cpp +++ b/JavaScriptCore/runtime/Operations.cpp @@ -55,7 +55,7 @@ NEVER_INLINE JSValue jsAddSlowCase(CallFrame* callFrame, JSValue v1, JSValue v2) if (p2.isString()) return jsString(callFrame, p1.toString(callFrame), asString(p2)); - return jsNumber(callFrame, p1.toNumber(callFrame) + p2.toNumber(callFrame)); + return jsNumber(p1.toNumber(callFrame) + p2.toNumber(callFrame)); } JSValue jsTypeStringForValue(CallFrame* callFrame, JSValue v) @@ -85,7 +85,7 @@ bool jsIsObjectType(JSValue v) if (!v.isCell()) return v.isNull(); - JSType type = asCell(v)->structure()->typeInfo().type(); + JSType type = v.asCell()->structure()->typeInfo().type(); if (type == NumberType || type == StringType) return false; if (type == ObjectType) { diff --git a/JavaScriptCore/runtime/Operations.h b/JavaScriptCore/runtime/Operations.h index 9226953..1252345 100644 --- a/JavaScriptCore/runtime/Operations.h +++ b/JavaScriptCore/runtime/Operations.h @@ -398,7 +398,7 @@ namespace JSC { { double left = 0.0, right; if (v1.getNumber(left) && v2.getNumber(right)) - return jsNumber(callFrame, left + right); + return jsNumber(left + right); if (v1.isString()) { return v2.isString() @@ -412,7 +412,7 @@ namespace JSC { inline size_t normalizePrototypeChain(CallFrame* callFrame, JSValue base, JSValue slotBase, const Identifier& propertyName, size_t& slotOffset) { - JSCell* cell = asCell(base); + JSCell* cell = base.asCell(); size_t count = 0; while (slotBase != cell) { @@ -424,7 +424,7 @@ namespace JSC { if (v.isNull()) return 0; - cell = asCell(v); + cell = v.asCell(); // Since we're accessing a prototype in a loop, it's a good bet that it // should not be treated as a dictionary. @@ -449,7 +449,7 @@ namespace JSC { if (v.isNull()) return count; - base = asCell(v); + base = v.asCell(); // Since we're accessing a prototype in a loop, it's a good bet that it // should not be treated as a dictionary. diff --git a/JavaScriptCore/runtime/Protect.h b/JavaScriptCore/runtime/Protect.h index a0d5443..06cf97f 100644 --- a/JavaScriptCore/runtime/Protect.h +++ b/JavaScriptCore/runtime/Protect.h @@ -52,13 +52,13 @@ namespace JSC { inline void gcProtect(JSValue value) { if (value && value.isCell()) - gcProtect(asCell(value)); + gcProtect(value.asCell()); } inline void gcUnprotect(JSValue value) { if (value && value.isCell()) - gcUnprotect(asCell(value)); + gcUnprotect(value.asCell()); } // FIXME: Share more code with RefPtr template? The only differences are the ref/deref operation diff --git a/JavaScriptCore/runtime/PrototypeFunction.cpp b/JavaScriptCore/runtime/PrototypeFunction.cpp index b0bf2bd..3529080 100644 --- a/JavaScriptCore/runtime/PrototypeFunction.cpp +++ b/JavaScriptCore/runtime/PrototypeFunction.cpp @@ -37,7 +37,7 @@ PrototypeFunction::PrototypeFunction(ExecState* exec, JSGlobalObject* globalObje , m_function(function) { ASSERT_ARG(function, function); - putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); + putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); } PrototypeFunction::PrototypeFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> prototypeFunctionStructure, int length, const Identifier& name, NativeFunction function) @@ -45,7 +45,7 @@ PrototypeFunction::PrototypeFunction(ExecState* exec, JSGlobalObject* globalObje , m_function(function) { ASSERT_ARG(function, function); - putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); + putDirect(exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); } CallType PrototypeFunction::getCallData(CallData& callData) diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp index b9aa587..21ca170 100644 --- a/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -103,7 +103,7 @@ RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObje putDirectWithoutTransition(exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly | DontDelete | DontEnum); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum); } RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate* data) @@ -142,7 +142,7 @@ void RegExpMatchesArray::fillArrayInstance(ExecState* exec) } PutPropertySlot slot; - JSArray::put(exec, exec->propertyNames().index, jsNumber(exec, d->lastOvector()[0]), slot); + JSArray::put(exec, exec->propertyNames().index, jsNumber(d->lastOvector()[0]), slot); JSArray::put(exec, exec->propertyNames().input, jsString(exec, d->input), slot); delete d; diff --git a/JavaScriptCore/runtime/RegExpObject.cpp b/JavaScriptCore/runtime/RegExpObject.cpp index 7d14814..7fda5b1 100644 --- a/JavaScriptCore/runtime/RegExpObject.cpp +++ b/JavaScriptCore/runtime/RegExpObject.cpp @@ -101,9 +101,9 @@ JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, const Identifier&) return jsString(exec, asRegExpObject(slotBase)->regExp()->pattern()); } -JSValue regExpObjectLastIndex(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpObjectLastIndex(ExecState*, JSValue slotBase, const Identifier&) { - return jsNumber(exec, asRegExpObject(slotBase)->lastIndex()); + return jsNumber(asRegExpObject(slotBase)->lastIndex()); } void RegExpObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) diff --git a/JavaScriptCore/runtime/StringConstructor.cpp b/JavaScriptCore/runtime/StringConstructor.cpp index 159386d..101650c 100644 --- a/JavaScriptCore/runtime/StringConstructor.cpp +++ b/JavaScriptCore/runtime/StringConstructor.cpp @@ -62,7 +62,7 @@ StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObje putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum); #endif // no. of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } // ECMA 15.5.2 diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp index 37436f9..b5ea8fa 100644 --- a/JavaScriptCore/runtime/StringPrototype.cpp +++ b/JavaScriptCore/runtime/StringPrototype.cpp @@ -136,7 +136,7 @@ StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, { putAnonymousValue(0, globalObject); // The constructor will be added later, after StringConstructor has been built - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum); + putDirectWithoutTransition(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); } bool StringPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot) @@ -326,7 +326,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) // reg->numSubpatterns() + 1 for pattern args, + 2 for match start and sourceValue int argCount = reg->numSubpatterns() + 1 + 2; JSFunction* func = asFunction(replacement); - CachedCall cachedCall(exec, func, argCount, exec->exceptionSlot()); + CachedCall cachedCall(exec, func, argCount); if (exec->hadException()) return JSValue::encode(jsNull()); while (true) { @@ -351,7 +351,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) cachedCall.setArgument(i, jsSubstring(exec, source, matchStart, matchLen)); } - cachedCall.setArgument(i++, jsNumber(exec, completeMatchStart)); + cachedCall.setArgument(i++, jsNumber(completeMatchStart)); cachedCall.setArgument(i++, sourceVal); cachedCall.setThis(exec->globalThisValue()); @@ -398,7 +398,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) args.append(jsSubstring(exec, source, matchStart, matchLen)); } - args.append(jsNumber(exec, completeMatchStart)); + args.append(jsNumber(completeMatchStart)); args.append(sourceVal); replacements.append(call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec)); @@ -454,7 +454,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec) if (callType != CallTypeNone) { MarkedArgumentBuffer args; args.append(jsSubstring(exec, source, matchPos, matchLen)); - args.append(jsNumber(exec, matchPos)); + args.append(jsNumber(matchPos)); args.append(sourceVal); replacementString = call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec); @@ -510,13 +510,13 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncCharCodeAt(ExecState* exec) if (a0.isUInt32()) { uint32_t i = a0.asUInt32(); if (i < len) - return JSValue::encode(jsNumber(exec, s.characters()[i])); - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(s.characters()[i])); + return JSValue::encode(jsNaN()); } double dpos = a0.toInteger(exec); if (dpos >= 0 && dpos < len) - return JSValue::encode(jsNumber(exec, s[static_cast<int>(dpos)])); - return JSValue::encode(jsNaN(exec)); + return JSValue::encode(jsNumber(s[static_cast<int>(dpos)])); + return JSValue::encode(jsNaN()); } EncodedJSValue JSC_HOST_CALL stringProtoFuncConcat(ExecState* exec) @@ -560,8 +560,8 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncIndexOf(ExecState* exec) size_t result = s.find(u2, pos); if (result == notFound) - return JSValue::encode(jsNumber(exec, -1)); - return JSValue::encode(jsNumber(exec, result)); + return JSValue::encode(jsNumber(-1)); + return JSValue::encode(jsNumber(result)); } EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec) @@ -589,8 +589,8 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec) size_t result = s.reverseFind(u2, static_cast<unsigned>(dpos)); if (result == notFound) - return JSValue::encode(jsNumber(exec, -1)); - return JSValue::encode(jsNumber(exec, result)); + return JSValue::encode(jsNumber(-1)); + return JSValue::encode(jsNumber(result)); } EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec) @@ -672,7 +672,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec) int pos; int matchLength = 0; regExpConstructor->performMatch(reg.get(), u, 0, pos, matchLength); - return JSValue::encode(jsNumber(exec, pos)); + return JSValue::encode(jsNumber(pos)); } EncodedJSValue JSC_HOST_CALL stringProtoFuncSlice(ExecState* exec) @@ -909,7 +909,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncToUpperCase(ExecState* exec) EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec) { if (exec->argumentCount() < 1) - return JSValue::encode(jsNumber(exec, 0)); + return JSValue::encode(jsNumber(0)); JSValue thisValue = exec->hostThisValue(); if (thisValue.isUndefinedOrNull()) // CheckObjectCoercible @@ -917,7 +917,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec) UString s = thisValue.toThisString(exec); JSValue a0 = exec->argument(0); - return JSValue::encode(jsNumber(exec, localeCompare(s, a0.toString(exec)))); + return JSValue::encode(jsNumber(localeCompare(s, a0.toString(exec)))); } EncodedJSValue JSC_HOST_CALL stringProtoFuncBig(ExecState* exec) diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp index 17cd9b6..b3cd40c 100644 --- a/JavaScriptCore/runtime/UString.cpp +++ b/JavaScriptCore/runtime/UString.cpp @@ -90,7 +90,7 @@ UString::UString(const char* characters) UString UString::number(int i) { UChar buf[1 + sizeof(i) * 3]; - UChar* end = buf + sizeof(buf) / sizeof(UChar); + UChar* end = buf + WTF_ARRAY_LENGTH(buf); UChar* p = end; if (i == 0) @@ -119,7 +119,7 @@ UString UString::number(int i) UString UString::number(long long i) { UChar buf[1 + sizeof(i) * 3]; - UChar* end = buf + sizeof(buf) / sizeof(UChar); + UChar* end = buf + WTF_ARRAY_LENGTH(buf); UChar* p = end; if (i == 0) @@ -152,7 +152,7 @@ UString UString::number(long long i) UString UString::number(unsigned u) { UChar buf[sizeof(u) * 3]; - UChar* end = buf + sizeof(buf) / sizeof(UChar); + UChar* end = buf + WTF_ARRAY_LENGTH(buf); UChar* p = end; if (u == 0) @@ -170,7 +170,7 @@ UString UString::number(unsigned u) UString UString::number(long l) { UChar buf[1 + sizeof(l) * 3]; - UChar* end = buf + sizeof(buf) / sizeof(UChar); + UChar* end = buf + WTF_ARRAY_LENGTH(buf); UChar* p = end; if (l == 0) |
