diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/BooleanConstructor.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/BooleanConstructor.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp index c39ff7281..09fa26096 100644 --- a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp +++ b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2003, 2008, 2016 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,13 +23,13 @@ #include "BooleanPrototype.h" #include "JSGlobalObject.h" -#include "JSCInlines.h" +#include "Operations.h" namespace JSC { STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanConstructor); -const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(BooleanConstructor) }; +const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) }; BooleanConstructor::BooleanConstructor(VM& vm, Structure* structure) : InternalFunction(vm, structure) @@ -46,13 +46,17 @@ void BooleanConstructor::finishCreation(VM& vm, BooleanPrototype* booleanPrototy } // ECMA 15.6.2 +JSObject* constructBoolean(ExecState* exec, const ArgList& args) +{ + BooleanObject* obj = BooleanObject::create(exec->vm(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure()); + obj->setInternalValue(exec->vm(), jsBoolean(args.at(0).toBoolean(exec))); + return obj; +} + static EncodedJSValue JSC_HOST_CALL constructWithBooleanConstructor(ExecState* exec) { - JSValue boolean = jsBoolean(exec->argument(0).toBoolean(exec)); - Structure* booleanStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure()); - BooleanObject* obj = BooleanObject::create(exec->vm(), booleanStructure); - obj->setInternalValue(exec->vm(), boolean); - return JSValue::encode(obj); + ArgList args(exec); + return JSValue::encode(constructBoolean(exec, args)); } ConstructType BooleanConstructor::getConstructData(JSCell*, ConstructData& constructData) |