X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/runtime/BooleanConstructor.cpp diff --git a/runtime/BooleanConstructor.cpp b/runtime/BooleanConstructor.cpp index bdf3322..0a25076 100644 --- a/runtime/BooleanConstructor.cpp +++ b/runtime/BooleanConstructor.cpp @@ -23,55 +23,64 @@ #include "BooleanPrototype.h" #include "JSGlobalObject.h" +#include "JSCInlines.h" namespace JSC { -ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor); +STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanConstructor); -BooleanConstructor::BooleanConstructor(ExecState* exec, PassRefPtr structure, BooleanPrototype* booleanPrototype) - : InternalFunction(&exec->globalData(), structure, Identifier(exec, booleanPrototype->classInfo()->className)) +const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(BooleanConstructor) }; + +BooleanConstructor::BooleanConstructor(VM& vm, Structure* structure) + : InternalFunction(vm, structure) +{ +} + +void BooleanConstructor::finishCreation(VM& vm, BooleanPrototype* booleanPrototype) { - putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); + Base::finishCreation(vm, booleanPrototype->classInfo()->className); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor - putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); + putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontDelete | DontEnum); } // ECMA 15.6.2 JSObject* constructBoolean(ExecState* exec, const ArgList& args) { - BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure()); - obj->setInternalValue(jsBoolean(args.at(exec, 0).toBoolean(exec))); + BooleanObject* obj = BooleanObject::create(exec->vm(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure()); + obj->setInternalValue(exec->vm(), jsBoolean(args.at(0).toBoolean(exec))); return obj; } -static JSObject* constructWithBooleanConstructor(ExecState* exec, JSObject*, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* exec) { - return constructBoolean(exec, args); + ArgList args(exec); + return JSValue::encode(constructBoolean(exec, args)); } -ConstructType BooleanConstructor::getConstructData(ConstructData& constructData) +ConstructType BooleanConstructor::getConstructData(JSCell*, ConstructData& constructData) { constructData.native.function = constructWithBooleanConstructor; return ConstructTypeHost; } // ECMA 15.6.1 -static JSValuePtr callBooleanConstructor(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* exec) { - return jsBoolean(args.at(exec, 0).toBoolean(exec)); + return JSValue::encode(jsBoolean(exec->argument(0).toBoolean(exec))); } -CallType BooleanConstructor::getCallData(CallData& callData) +CallType BooleanConstructor::getCallData(JSCell*, CallData& callData) { callData.native.function = callBooleanConstructor; return CallTypeHost; } -JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSValuePtr immediateBooleanValue) +JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSGlobalObject* globalObject, JSValue immediateBooleanValue) { - BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure()); - obj->setInternalValue(immediateBooleanValue); + BooleanObject* obj = BooleanObject::create(exec->vm(), globalObject->booleanObjectStructure()); + obj->setInternalValue(exec->vm(), immediateBooleanValue); return obj; }