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,28 +11,27 @@ namespace v8 { ...@@ -11,28 +11,27 @@ 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);
Handle<Object> value = args.atOrUndefined(isolate, 1); if (args.new_target()->IsUndefined(isolate)) { // [[Call]]
return isolate->heap()->ToBoolean(value->BooleanValue()); Handle<Object> value = args.atOrUndefined(isolate, 1);
} return isolate->heap()->ToBoolean(value->BooleanValue());
} else { // [[Construct]]
// ES6 section 19.3.1.1 Boolean ( value ) for the [[Construct]] case. HandleScope scope(isolate);
BUILTIN(BooleanConstructor_ConstructStub) { Handle<Object> value = args.atOrUndefined(isolate, 1);
HandleScope scope(isolate); Handle<JSFunction> target = args.target();
Handle<Object> value = args.atOrUndefined(isolate, 1); Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
Handle<JSFunction> target = args.target(); DCHECK(*target == target->native_context()->boolean_function());
Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); Handle<JSObject> result;
DCHECK(*target == target->native_context()->boolean_function()); ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
Handle<JSObject> result; JSObject::New(target, new_target));
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Handle<JSValue>::cast(result)->set_value(
JSObject::New(target, new_target)); isolate->heap()->ToBoolean(value->BooleanValue()));
Handle<JSValue>::cast(result)->set_value( return *result;
isolate->heap()->ToBoolean(value->BooleanValue())); }
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