Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: src/builtins/builtins-object-gen.cc

Issue 2953913002: [builtins] Don't adapt arguments for Object.create. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins-definitions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-object-gen.cc
diff --git a/src/builtins/builtins-object-gen.cc b/src/builtins/builtins-object-gen.cc
index f9ba906f2ea1b00bd84bf2af2705d3314a5af501..5aa66630eb7c03b09494578890d133f6afc3ab92 100644
--- a/src/builtins/builtins-object-gen.cc
+++ b/src/builtins/builtins-object-gen.cc
@@ -410,9 +410,16 @@ TF_BUILTIN(ObjectPrototypeValueOf, CodeStubAssembler) {
// ES #sec-object.create
TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
- Node* prototype = Parameter(Descriptor::kPrototype);
- Node* properties = Parameter(Descriptor::kProperties);
- Node* context = Parameter(Descriptor::kContext);
+ int const kPrototypeArg = 0;
+ int const kPropertiesArg = 1;
+
+ Node* argc =
+ ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount));
+ CodeStubArguments args(this, argc);
+
+ Node* prototype = args.GetOptionalArgumentValue(kPrototypeArg);
+ Node* properties = args.GetOptionalArgumentValue(kPropertiesArg);
+ Node* context = Parameter(BuiltinDescriptor::kContext);
Label call_runtime(this, Label::kDeferred), prototype_valid(this),
no_properties(this);
@@ -483,13 +490,15 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
BIND(&instantiate_map);
{
Node* instance = AllocateJSObjectFromMap(map.value(), properties.value());
- Return(instance);
+ args.PopAndReturn(instance);
}
}
BIND(&call_runtime);
{
- Return(CallRuntime(Runtime::kObjectCreate, context, prototype, properties));
+ Node* result =
+ CallRuntime(Runtime::kObjectCreate, context, prototype, properties);
+ args.PopAndReturn(result);
}
}
« no previous file with comments | « src/builtins/builtins-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698