Commit 8c9ea5ed authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[Collections] Dont adapt args for constructors

Bug: v8:5717
Change-Id: I03579764656aa743bbc9bbf08e6affecd626d73d
Reviewed-on: https://chromium-review.googlesource.com/527338Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45787}
parent 2c296b7e
......@@ -2933,7 +2933,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<SharedFunctionInfo> shared(js_map_fun->shared(), isolate);
shared->SetConstructStub(*isolate->builtins()->JSBuiltinsConstructStub());
shared->set_instance_class_name(isolate->heap()->Map_string());
shared->set_internal_formal_parameter_count(1);
shared->DontAdaptArguments();
shared->set_length(0);
// Install the "constructor" property on the {prototype}.
......@@ -2970,7 +2970,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<SharedFunctionInfo> shared(js_set_fun->shared(), isolate);
shared->SetConstructStub(*isolate->builtins()->JSBuiltinsConstructStub());
shared->set_instance_class_name(isolate->heap()->Set_string());
shared->set_internal_formal_parameter_count(1);
shared->DontAdaptArguments();
shared->set_length(0);
// Install the "constructor" property on the {prototype}.
......
......@@ -38,10 +38,16 @@ Node* CollectionsBuiltinsAssembler::AllocateJSCollection(
}
TF_BUILTIN(MapConstructor, CollectionsBuiltinsAssembler) {
// TODO(gsathya): Don't use arguments adaptor
Node* const iterable = Parameter(Descriptor::kIterable);
Node* const new_target = Parameter(Descriptor::kNewTarget);
Node* const context = Parameter(Descriptor::kContext);
const int kIterableArg = 0;
Node* argc =
ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount));
CodeStubArguments args(this, argc);
Node* const iterable =
args.GetOptionalArgumentValue(kIterableArg, UndefinedConstant());
Node* const new_target = Parameter(BuiltinDescriptor::kNewTarget);
Node* const context = Parameter(BuiltinDescriptor::kContext);
Label if_target_is_undefined(this, Label::kDeferred);
GotoIf(IsUndefined(new_target), &if_target_is_undefined);
......@@ -155,14 +161,20 @@ TF_BUILTIN(MapConstructor, CollectionsBuiltinsAssembler) {
}
BIND(&exit);
Return(var_result.value());
args.PopAndReturn(var_result.value());
}
TF_BUILTIN(SetConstructor, CollectionsBuiltinsAssembler) {
// TODO(gsathya): Don't use arguments adaptor
Node* const iterable = Parameter(Descriptor::kIterable);
Node* const new_target = Parameter(Descriptor::kNewTarget);
Node* const context = Parameter(Descriptor::kContext);
const int kIterableArg = 0;
Node* argc =
ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount));
CodeStubArguments args(this, argc);
Node* const iterable =
args.GetOptionalArgumentValue(kIterableArg, UndefinedConstant());
Node* const new_target = Parameter(BuiltinDescriptor::kNewTarget);
Node* const context = Parameter(BuiltinDescriptor::kContext);
Label if_target_is_undefined(this, Label::kDeferred);
GotoIf(IsUndefined(new_target), &if_target_is_undefined);
......@@ -258,7 +270,7 @@ TF_BUILTIN(SetConstructor, CollectionsBuiltinsAssembler) {
}
BIND(&exit);
Return(var_result.value());
args.PopAndReturn(var_result.value());
}
Node* CollectionsBuiltinsAssembler::CallGetRaw(Node* const table,
......
......@@ -572,7 +572,7 @@ namespace internal {
LoadGlobal) \
\
/* Map */ \
TFJ(MapConstructor, 1, kIterable) \
TFJ(MapConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
TFJ(MapGet, 1, kKey) \
TFJ(MapHas, 1, kKey) \
\
......@@ -849,7 +849,7 @@ namespace internal {
TFJ(RegExpPrototypeSplit, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
\
/* Set */ \
TFJ(SetConstructor, 1, kIterable) \
TFJ(SetConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
TFJ(SetHas, 1, kKey) \
\
/* SharedArrayBuffer */ \
......
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