Commit df5483ca authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[builtins] Remove BooleanConstructor_ConstructStub builtin

This brings us closer to our goal of deprecating the `construct_stub`
field in `SharedFunctionInfo`.

Bug: v8:7503
Change-Id: I20e6c7d58e7cdcc7316e35568357a4ad3059a892
Reviewed-on: https://chromium-review.googlesource.com/940129Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51626}
parent c8f34835
...@@ -1909,7 +1909,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -1909,7 +1909,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate->initial_object_prototype(), Builtins::kBooleanConstructor); isolate->initial_object_prototype(), Builtins::kBooleanConstructor);
boolean_fun->shared()->DontAdaptArguments(); boolean_fun->shared()->DontAdaptArguments();
boolean_fun->shared()->SetConstructStub( boolean_fun->shared()->SetConstructStub(
*BUILTIN_CODE(isolate, BooleanConstructor_ConstructStub)); *BUILTIN_CODE(isolate, JSBuiltinsConstructStub));
boolean_fun->shared()->set_length(1); boolean_fun->shared()->set_length(1);
InstallWithIntrinsicDefaultProto(isolate, boolean_fun, InstallWithIntrinsicDefaultProto(isolate, boolean_fun,
Context::BOOLEAN_FUNCTION_INDEX); Context::BOOLEAN_FUNCTION_INDEX);
......
...@@ -11,17 +11,15 @@ namespace v8 { ...@@ -11,17 +11,15 @@ namespace v8 {
namespace internal { namespace internal {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ES6 section 19.3 Boolean Objects // ES #sec-boolean-objects
// ES6 section 19.3.1.1 Boolean ( value ) for the [[Call]] case. // ES #sec-boolean-constructor
BUILTIN(BooleanConstructor) { BUILTIN(BooleanConstructor) {
HandleScope scope(isolate); HandleScope scope(isolate);
if (args.new_target()->IsUndefined(isolate)) { // [[Call]]
Handle<Object> value = args.atOrUndefined(isolate, 1); Handle<Object> value = args.atOrUndefined(isolate, 1);
return isolate->heap()->ToBoolean(value->BooleanValue()); return isolate->heap()->ToBoolean(value->BooleanValue());
} } else { // [[Construct]]
// ES6 section 19.3.1.1 Boolean ( value ) for the [[Construct]] case.
BUILTIN(BooleanConstructor_ConstructStub) {
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<Object> value = args.atOrUndefined(isolate, 1); Handle<Object> value = args.atOrUndefined(isolate, 1);
Handle<JSFunction> target = args.target(); Handle<JSFunction> target = args.target();
...@@ -33,6 +31,7 @@ BUILTIN(BooleanConstructor_ConstructStub) { ...@@ -33,6 +31,7 @@ BUILTIN(BooleanConstructor_ConstructStub) {
Handle<JSValue>::cast(result)->set_value( Handle<JSValue>::cast(result)->set_value(
isolate->heap()->ToBoolean(value->BooleanValue())); isolate->heap()->ToBoolean(value->BooleanValue()));
return *result; return *result;
}
} }
} // namespace internal } // namespace internal
......
...@@ -382,8 +382,8 @@ namespace internal { ...@@ -382,8 +382,8 @@ namespace internal {
CPP(BigIntPrototypeValueOf) \ CPP(BigIntPrototypeValueOf) \
\ \
/* Boolean */ \ /* Boolean */ \
/* ES #sec-boolean-constructor */ \
CPP(BooleanConstructor) \ CPP(BooleanConstructor) \
CPP(BooleanConstructor_ConstructStub) \
/* ES6 #sec-boolean.prototype.tostring */ \ /* ES6 #sec-boolean.prototype.tostring */ \
TFJ(BooleanPrototypeToString, 0) \ TFJ(BooleanPrototypeToString, 0) \
/* ES6 #sec-boolean.prototype.valueof */ \ /* ES6 #sec-boolean.prototype.valueof */ \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment