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

Unified Diff: src/hydrogen.cc

Issue 836093007: split api call stubs into accessor and function call stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/code-stubs.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index acbc1919e6d52866ef883d390d3a1d29626ff09a..a288dbde52fa6ea259846b52c6f8d2311de44513 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8702,7 +8702,7 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<JSFunction> function,
PrintF("\n");
}
- bool drop_extra = false;
+ bool is_function = false;
bool is_store = false;
switch (call_type) {
case kCallApiFunction:
@@ -8717,8 +8717,7 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<JSFunction> function,
}
// Includes receiver.
PushArgumentsFromEnvironment(argc + 1);
- // Drop function after call.
- drop_extra = true;
+ is_function = true;
break;
case kCallApiGetter:
// Receiver and prototype chain cannot have changed.
@@ -8756,7 +8755,7 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<JSFunction> function,
}
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate());
- bool call_data_is_undefined = call_data_obj->IsUndefined();
+ bool call_data_undefined = call_data_obj->IsUndefined();
HValue* call_data = Add<HConstant>(call_data_obj);
ApiFunction fun(v8::ToCData<Address>(api_call_info->callback()));
ExternalReference ref = ExternalReference(&fun,
@@ -8764,26 +8763,32 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(Handle<JSFunction> function,
isolate());
HValue* api_function_address = Add<HConstant>(ExternalReference(ref));
- HValue* op_vals[] = {
- context(),
- Add<HConstant>(function),
- call_data,
- holder,
- api_function_address
- };
-
- ApiFunctionDescriptor descriptor(isolate());
- CallApiFunctionStub stub(isolate(), is_store, call_data_is_undefined, argc);
- Handle<Code> code = stub.GetCode();
- HConstant* code_value = Add<HConstant>(code);
-
- DCHECK((sizeof(op_vals) / kPointerSize) == descriptor.GetEnvironmentLength());
-
- HInstruction* call = New<HCallWithDescriptor>(
- code_value, argc + 1, descriptor,
- Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength()));
+ HValue* op_vals[] = {context(), Add<HConstant>(function), call_data, holder,
+ api_function_address, nullptr};
+
+ HInstruction* call = nullptr;
+ if (!is_function) {
+ CallApiAccessorStub stub(isolate(), is_store, call_data_undefined);
+ Handle<Code> code = stub.GetCode();
+ HConstant* code_value = Add<HConstant>(code);
+ ApiAccessorDescriptor descriptor(isolate());
+ DCHECK(arraysize(op_vals) - 1 == descriptor.GetEnvironmentLength());
+ call = New<HCallWithDescriptor>(
+ code_value, argc + 1, descriptor,
+ Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength()));
+ } 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());
+ DCHECK(arraysize(op_vals) == descriptor.GetEnvironmentLength());
+ call = New<HCallWithDescriptor>(
+ code_value, argc + 1, descriptor,
+ Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength()));
+ Drop(1); // Drop function.
+ }
- if (drop_extra) Drop(1); // Drop function.
ast_context()->ReturnInstruction(call, ast_id);
return true;
}
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698