summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime/BooleanConstructor.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/BooleanConstructor.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
index 09fa26096..c39ff7281 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 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2008, 2016 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 "Operations.h"
+#include "JSCInlines.h"
namespace JSC {
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanConstructor);
-const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) };
+const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(BooleanConstructor) };
BooleanConstructor::BooleanConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
@@ -46,17 +46,13 @@ 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)
{
- ArgList args(exec);
- return JSValue::encode(constructBoolean(exec, args));
+ 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);
}
ConstructType BooleanConstructor::getConstructData(JSCell*, ConstructData& constructData)