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

Unified Diff: src/fast-accessor-assembler.cc

Issue 2352163004: [stubs] ApiCallbackDescriptor cleanup - make it independent on the number of JS parameters. (Closed)
Patch Set: Created 4 years, 3 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/compiler/code-assembler.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/fast-accessor-assembler.cc
diff --git a/src/fast-accessor-assembler.cc b/src/fast-accessor-assembler.cc
index ebaab9a529de17f8d1a479e92cb97a2dae9913c0..a9cde70a5345c1d34c7be9269819000576d30819 100644
--- a/src/fast-accessor-assembler.cc
+++ b/src/fast-accessor-assembler.cc
@@ -179,27 +179,35 @@ FastAccessorAssembler::ValueId FastAccessorAssembler::Call(
ExternalReference::DIRECT_API_CALL, isolate());
// Create & call API callback via stub.
- CallApiCallbackStub stub(isolate(), 1, true, true);
- DCHECK_EQ(5, stub.GetCallInterfaceDescriptor().GetParameterCount());
- DCHECK_EQ(1, stub.GetCallInterfaceDescriptor().GetStackParameterCount());
+ const int kJSParameterCount = 1;
+ CallApiCallbackStub stub(isolate(), kJSParameterCount, true, true);
+ CallInterfaceDescriptor descriptor = stub.GetCallInterfaceDescriptor();
+ DCHECK_EQ(4, descriptor.GetParameterCount());
+ DCHECK_EQ(0, descriptor.GetStackParameterCount());
// TODO(vogelheim): There is currently no clean way to retrieve the context
// parameter for a stub and the implementation details are hidden in
// compiler/*. The context_paramter is computed as:
// Linkage::GetJSCallContextParamIndex(descriptor->JSParameterCount())
- const int context_parameter = 3;
- Node* call = assembler_->CallStub(
- stub.GetCallInterfaceDescriptor(),
- assembler_->HeapConstant(stub.GetCode()),
- assembler_->Parameter(context_parameter),
-
- // Stub/register parameters:
- assembler_->UndefinedConstant(), /* callee (there's no JSFunction) */
- assembler_->UndefinedConstant(), /* call_data (undefined) */
- assembler_->Parameter(0), /* receiver (same as holder in this case) */
- assembler_->ExternalConstant(callback), /* API callback function */
-
- // JS arguments, on stack:
- FromId(arg));
+ const int kContextParameter = 3;
+ Node* context = assembler_->Parameter(kContextParameter);
+ Node* target = assembler_->HeapConstant(stub.GetCode());
+
+ int param_count = descriptor.GetParameterCount();
+ Node** args = zone()->NewArray<Node*>(param_count + 1 + kJSParameterCount);
+ // Stub/register parameters:
+ args[0] = assembler_->UndefinedConstant(); // callee (there's no JSFunction)
+ args[1] = assembler_->UndefinedConstant(); // call_data (undefined)
+ args[2] = assembler_->Parameter(0); // receiver (same as holder in this case)
+ args[3] = assembler_->ExternalConstant(callback); // API callback function
+
+ // JS arguments, on stack:
+ args[4] = FromId(arg);
+
+ // Context.
+ args[5] = context;
+
+ Node* call =
+ assembler_->CallStubN(descriptor, kJSParameterCount, target, args);
return FromRaw(call);
}
« no previous file with comments | « src/compiler/code-assembler.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698