X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..4be4e30906bcb8ee30b4d189205cb70bad6707ce:/runtime/BooleanConstructor.cpp?ds=sidebyside diff --git a/runtime/BooleanConstructor.cpp b/runtime/BooleanConstructor.cpp index a1a4ed4..453983b 100644 --- a/runtime/BooleanConstructor.cpp +++ b/runtime/BooleanConstructor.cpp @@ -23,25 +23,33 @@ #include "BooleanPrototype.h" #include "JSGlobalObject.h" +#include "Operations.h" namespace JSC { -ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor); +ASSERT_HAS_TRIVIAL_DESTRUCTOR(BooleanConstructor); -BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype) - : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, booleanPrototype->classInfo()->className)) +const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) }; + +BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* structure) + : InternalFunction(globalObject, structure) +{ +} + +void BooleanConstructor::finishCreation(ExecState* exec, BooleanPrototype* booleanPrototype) { - putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); + Base::finishCreation(exec->vm(), booleanPrototype->classInfo()->className); + putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor - putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum); + putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum); } // ECMA 15.6.2 JSObject* constructBoolean(ExecState* exec, const ArgList& args) { - BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure()); - obj->setInternalValue(exec->globalData(), jsBoolean(args.at(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; } @@ -51,7 +59,7 @@ static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* e return JSValue::encode(constructBoolean(exec, args)); } -ConstructType BooleanConstructor::getConstructData(ConstructData& constructData) +ConstructType BooleanConstructor::getConstructData(JSCell*, ConstructData& constructData) { constructData.native.function = constructWithBooleanConstructor; return ConstructTypeHost; @@ -63,7 +71,7 @@ static EncodedJSValue JSC_HOST_CALL callBooleanConstructor(ExecState* 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; @@ -71,8 +79,8 @@ CallType BooleanConstructor::getCallData(CallData& callData) JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSGlobalObject* globalObject, JSValue immediateBooleanValue) { - BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), globalObject->booleanObjectStructure()); - obj->setInternalValue(exec->globalData(), immediateBooleanValue); + BooleanObject* obj = BooleanObject::create(exec->vm(), globalObject->booleanObjectStructure()); + obj->setInternalValue(exec->vm(), immediateBooleanValue); return obj; }