diff options
Diffstat (limited to 'JavaScriptCore/runtime/NumberConstructor.cpp')
| -rw-r--r-- | JavaScriptCore/runtime/NumberConstructor.cpp | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/JavaScriptCore/runtime/NumberConstructor.cpp b/JavaScriptCore/runtime/NumberConstructor.cpp index cc6c51d..5369ca0 100644 --- a/JavaScriptCore/runtime/NumberConstructor.cpp +++ b/JavaScriptCore/runtime/NumberConstructor.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "NumberConstructor.h" +#include "Lookup.h" #include "NumberObject.h" #include "NumberPrototype.h" @@ -29,11 +30,11 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(NumberConstructor); -static JSValue numberConstructorNaNValue(ExecState*, const Identifier&, const PropertySlot&); -static JSValue numberConstructorNegInfinity(ExecState*, const Identifier&, const PropertySlot&); -static JSValue numberConstructorPosInfinity(ExecState*, const Identifier&, const PropertySlot&); -static JSValue numberConstructorMaxValue(ExecState*, const Identifier&, const PropertySlot&); -static JSValue numberConstructorMinValue(ExecState*, const Identifier&, const PropertySlot&); +static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&); +static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&); +static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&); +static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&); +static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&); } // namespace JSC @@ -53,14 +54,14 @@ const ClassInfo NumberConstructor::info = { "Function", &InternalFunction::info, @end */ -NumberConstructor::NumberConstructor(ExecState* exec, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype) - : InternalFunction(&exec->globalData(), structure, Identifier(exec, numberPrototype->info.className)) +NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype) + : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, numberPrototype->info.className)) { // Number.Prototype 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) @@ -73,38 +74,38 @@ bool NumberConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifi return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberTable(exec), this, propertyName, descriptor); } -static JSValue numberConstructorNaNValue(ExecState* exec, const Identifier&, const PropertySlot&) +static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&) { - return jsNaN(exec); + return jsNaN(); } -static JSValue numberConstructorNegInfinity(ExecState* exec, const Identifier&, const PropertySlot&) +static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, -Inf); + return jsNumber(-Inf); } -static JSValue numberConstructorPosInfinity(ExecState* exec, const Identifier&, const PropertySlot&) +static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, Inf); + return jsNumber(Inf); } -static JSValue numberConstructorMaxValue(ExecState* exec, const Identifier&, const PropertySlot&) +static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, 1.7976931348623157E+308); + return jsNumber(1.7976931348623157E+308); } -static JSValue numberConstructorMinValue(ExecState* exec, const Identifier&, const PropertySlot&) +static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&) { - return jsNumber(exec, 5E-324); + return jsNumber(5E-324); } // ECMA 15.7.1 -static JSObject* constructWithNumberConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec) { NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure()); - double n = args.isEmpty() ? 0 : args.at(0).toNumber(exec); - object->setInternalValue(jsNumber(exec, n)); - return object; + double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0; + object->setInternalValue(jsNumber(n)); + return JSValue::encode(object); } ConstructType NumberConstructor::getConstructData(ConstructData& constructData) @@ -114,9 +115,9 @@ ConstructType NumberConstructor::getConstructData(ConstructData& constructData) } // ECMA 15.7.2 -static JSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL callNumberConstructor(ExecState* exec) { - return jsNumber(exec, args.isEmpty() ? 0 : args.at(0).toNumber(exec)); + return JSValue::encode(jsNumber(!exec->argumentCount() ? 0 : exec->argument(0).toNumber(exec))); } CallType NumberConstructor::getCallData(CallData& callData) |
