Commit c8f34835 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[builtins] Remove the ObjectConstructor_ConstructStub builtin.

This is the first step on the way to eventually get rid of the
construct_stub field in SharedFunctionInfos.

Bug: v8:7503
Change-Id: Ib14627613851c7f2a5ab795c642bb74176285863
Reviewed-on: https://chromium-review.googlesource.com/940222Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51625}
parent 265ef0b6
...@@ -762,7 +762,7 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) { ...@@ -762,7 +762,7 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) {
object_fun->shared()->set_length(1); object_fun->shared()->set_length(1);
object_fun->shared()->DontAdaptArguments(); object_fun->shared()->DontAdaptArguments();
object_fun->shared()->SetConstructStub( object_fun->shared()->SetConstructStub(
*BUILTIN_CODE(isolate_, ObjectConstructor_ConstructStub)); *BUILTIN_CODE(isolate_, JSBuiltinsConstructStub));
native_context()->set_object_function(*object_fun); native_context()->set_object_function(*object_fun);
{ {
......
...@@ -636,49 +636,58 @@ Node* ConstructorBuiltinsAssembler::EmitCreateEmptyObjectLiteral( ...@@ -636,49 +636,58 @@ Node* ConstructorBuiltinsAssembler::EmitCreateEmptyObjectLiteral(
return result; return result;
} }
// ES #sec-object-constructor
TF_BUILTIN(ObjectConstructor, ConstructorBuiltinsAssembler) { TF_BUILTIN(ObjectConstructor, ConstructorBuiltinsAssembler) {
int const kValueArg = 0; int const kValueArg = 0;
Node* argc = Node* argc =
ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount));
CodeStubArguments args(this, argc); CodeStubArguments args(this, argc);
Node* value = args.GetOptionalArgumentValue(kValueArg);
Node* context = Parameter(BuiltinDescriptor::kContext); Node* context = Parameter(BuiltinDescriptor::kContext);
Node* new_target = Parameter(BuiltinDescriptor::kNewTarget);
CSA_ASSERT(this, IsUndefined(Parameter(BuiltinDescriptor::kNewTarget))); VARIABLE(var_result, MachineRepresentation::kTagged);
Label if_subclass(this, Label::kDeferred), if_notsubclass(this),
Label return_to_object(this); return_result(this);
GotoIf(IsUndefined(new_target), &if_notsubclass);
GotoIf(Word32And(IsNotUndefined(value), IsNotNull(value)), &return_to_object);
args.PopAndReturn(EmitCreateEmptyObjectLiteral(context));
BIND(&return_to_object);
args.PopAndReturn(ToObject(context, value));
}
TF_BUILTIN(ObjectConstructor_ConstructStub, ConstructorBuiltinsAssembler) {
int const kValueArg = 0;
Node* argc =
ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount));
CodeStubArguments args(this, argc);
Node* value = args.GetOptionalArgumentValue(kValueArg);
Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset, Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset,
MachineType::TaggedPointer()); MachineType::TaggedPointer());
Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); Branch(WordEqual(new_target, target), &if_notsubclass, &if_subclass);
Node* context = Parameter(BuiltinDescriptor::kContext);
CSA_ASSERT(this, IsNotUndefined(new_target)); BIND(&if_subclass);
{
Node* result =
CallBuiltin(Builtins::kFastNewObject, context, target, new_target);
var_result.Bind(result);
Goto(&return_result);
}
BIND(&if_notsubclass);
{
Label if_newobject(this, Label::kDeferred), if_toobject(this);
Label return_to_object(this); Node* value_index = IntPtrConstant(kValueArg);
GotoIf(UintPtrGreaterThanOrEqual(value_index, argc), &if_newobject);
Node* value = args.AtIndex(value_index);
GotoIf(IsNull(value), &if_newobject);
Branch(IsUndefined(value), &if_newobject, &if_toobject);
GotoIf(Word32And(WordEqual(target, new_target), BIND(&if_newobject);
Word32And(IsNotUndefined(value), IsNotNull(value))), {
&return_to_object); Node* result = EmitCreateEmptyObjectLiteral(context);
args.PopAndReturn(EmitFastNewObject(context, target, new_target)); var_result.Bind(result);
Goto(&return_result);
}
BIND(&if_toobject);
{
Node* result = CallBuiltin(Builtins::kToObject, context, value);
var_result.Bind(result);
Goto(&return_result);
}
}
BIND(&return_to_object); BIND(&return_result);
args.PopAndReturn(ToObject(context, value)); args.PopAndReturn(var_result.value());
} }
TF_BUILTIN(NumberConstructor, ConstructorBuiltinsAssembler) { TF_BUILTIN(NumberConstructor, ConstructorBuiltinsAssembler) {
......
...@@ -748,9 +748,8 @@ namespace internal { ...@@ -748,9 +748,8 @@ namespace internal {
TFS(Negate, kValue) \ TFS(Negate, kValue) \
\ \
/* Object */ \ /* Object */ \
/* ES #sec-object-constructor */ \
TFJ(ObjectConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ TFJ(ObjectConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
TFJ(ObjectConstructor_ConstructStub, \
SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
CPP(ObjectAssign) \ CPP(ObjectAssign) \
/* ES #sec-object.create */ \ /* ES #sec-object.create */ \
TFJ(ObjectCreate, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ TFJ(ObjectCreate, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
......
...@@ -262,7 +262,6 @@ bool Builtins::IsLazy(int index) { ...@@ -262,7 +262,6 @@ bool Builtins::IsLazy(int index) {
case kInterpreterEnterBytecodeAdvance: case kInterpreterEnterBytecodeAdvance:
case kInterpreterEnterBytecodeDispatch: case kInterpreterEnterBytecodeDispatch:
case kInterpreterEntryTrampoline: case kInterpreterEntryTrampoline:
case kObjectConstructor_ConstructStub: // https://crbug.com/v8/6787.
case kPromiseConstructorLazyDeoptContinuation: // crbug/v8/6786. case kPromiseConstructorLazyDeoptContinuation: // crbug/v8/6786.
case kProxyConstructor_ConstructStub: // https://crbug.com/v8/6787. case kProxyConstructor_ConstructStub: // https://crbug.com/v8/6787.
case kNumberConstructor_ConstructStub: // https://crbug.com/v8/6787. case kNumberConstructor_ConstructStub: // https://crbug.com/v8/6787.
...@@ -659,7 +658,6 @@ bool Builtins::IsIsolateIndependent(int index) { ...@@ -659,7 +658,6 @@ bool Builtins::IsIsolateIndependent(int index) {
case kNumberPrototypeValueOf: case kNumberPrototypeValueOf:
case kNumberToString: case kNumberToString:
case kObjectConstructor: case kObjectConstructor:
case kObjectConstructor_ConstructStub:
case kObjectCreate: case kObjectCreate:
case kObjectIs: case kObjectIs:
case kObjectKeys: case kObjectKeys:
......
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