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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1748123003: Rework CallApi*Stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor fixes and make Win compiler happy. Created 4 years, 9 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
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 162424f23d82a151b261bfcd3fbd324009f0bdf2..3ecefe0a84cedff14aeb16f79bd3a47e47f9d9e0 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -9241,6 +9241,10 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(
if (syntactic_tail_call_mode == TailCallMode::kAllow) {
return false;
}
+ if (argc > CallApiCallbackStub::kArgMax) {
+ return false;
+ }
+
CallOptimization optimization(function);
if (!optimization.is_simple_api_call()) return false;
Handle<Map> holder_map;
@@ -9336,34 +9340,23 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(
api_function_address, nullptr};
HInstruction* call = nullptr;
+ CHECK(argc <= CallApiCallbackStub::kArgMax);
if (!is_function) {
- CallApiAccessorStub stub(isolate(), is_store, call_data_undefined,
+ CallApiCallbackStub stub(isolate(), is_store, call_data_undefined,
!optimization.is_constant_call());
Handle<Code> code = stub.GetCode();
HConstant* code_value = Add<HConstant>(code);
- ApiAccessorDescriptor descriptor(isolate());
call = New<HCallWithDescriptor>(
- code_value, argc + 1, descriptor,
+ code_value, argc + 1, stub.GetCallInterfaceDescriptor(),
Vector<HValue*>(op_vals, arraysize(op_vals) - 1));
- } else if (argc <= CallApiFunctionWithFixedArgsStub::kMaxFixedArgs) {
- CallApiFunctionWithFixedArgsStub stub(isolate(), argc, call_data_undefined);
+ } else {
+ CallApiCallbackStub stub(isolate(), argc, call_data_undefined);
Handle<Code> code = stub.GetCode();
HConstant* code_value = Add<HConstant>(code);
- ApiFunctionWithFixedArgsDescriptor descriptor(isolate());
call = New<HCallWithDescriptor>(
- code_value, argc + 1, descriptor,
+ code_value, argc + 1, stub.GetCallInterfaceDescriptor(),
Vector<HValue*>(op_vals, arraysize(op_vals) - 1));
Drop(1); // Drop function.
- } else {
- op_vals[arraysize(op_vals) - 1] = Add<HConstant>(argc);
- CallApiFunctionStub stub(isolate(), call_data_undefined);
- Handle<Code> code = stub.GetCode();
- HConstant* code_value = Add<HConstant>(code);
- ApiFunctionDescriptor descriptor(isolate());
- call =
- New<HCallWithDescriptor>(code_value, argc + 1, descriptor,
- Vector<HValue*>(op_vals, arraysize(op_vals)));
- Drop(1); // Drop function.
}
ast_context()->ReturnInstruction(call, ast_id);

Powered by Google App Engine
This is Rietveld 408576698