Index: src/crankshaft/hydrogen.cc |
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc |
index 8ff3f3ba3f05afbcade28d2f073afa6c5503fc77..3617c5d3bad39c16a92c5ff395c9cdd05bb2e2f7 100644 |
--- a/src/crankshaft/hydrogen.cc |
+++ b/src/crankshaft/hydrogen.cc |
@@ -9188,6 +9188,10 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<Object> function, |
top_info()->closure()->context()->native_context()) { |
return false; |
} |
+ if (argc >= CallApiCallbackStub::kArgMax) { |
+ return false; |
+ } |
+ |
CallOptimization optimization(function); |
if (!optimization.is_simple_api_call()) return false; |
Handle<Map> holder_map; |
@@ -9283,34 +9287,23 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<Object> function, |
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); |