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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 1775933005: Revert of Rework CallApi*Stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/compiler/fast-accessor-assembler.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast/ast-numbering.h" 10 #include "src/ast/ast-numbering.h"
(...skipping 9223 matching lines...) Expand 10 before | Expand all | Expand 10 after
9234 int argc, BailoutId ast_id, ApiCallType call_type, 9234 int argc, BailoutId ast_id, ApiCallType call_type,
9235 TailCallMode syntactic_tail_call_mode) { 9235 TailCallMode syntactic_tail_call_mode) {
9236 if (function->IsJSFunction() && 9236 if (function->IsJSFunction() &&
9237 Handle<JSFunction>::cast(function)->context()->native_context() != 9237 Handle<JSFunction>::cast(function)->context()->native_context() !=
9238 top_info()->closure()->context()->native_context()) { 9238 top_info()->closure()->context()->native_context()) {
9239 return false; 9239 return false;
9240 } 9240 }
9241 if (syntactic_tail_call_mode == TailCallMode::kAllow) { 9241 if (syntactic_tail_call_mode == TailCallMode::kAllow) {
9242 return false; 9242 return false;
9243 } 9243 }
9244 if (argc > CallApiCallbackStub::kArgMax) {
9245 return false;
9246 }
9247
9248 CallOptimization optimization(function); 9244 CallOptimization optimization(function);
9249 if (!optimization.is_simple_api_call()) return false; 9245 if (!optimization.is_simple_api_call()) return false;
9250 Handle<Map> holder_map; 9246 Handle<Map> holder_map;
9251 for (int i = 0; i < receiver_maps->length(); ++i) { 9247 for (int i = 0; i < receiver_maps->length(); ++i) {
9252 auto map = receiver_maps->at(i); 9248 auto map = receiver_maps->at(i);
9253 // Don't inline calls to receivers requiring accesschecks. 9249 // Don't inline calls to receivers requiring accesschecks.
9254 if (map->is_access_check_needed()) return false; 9250 if (map->is_access_check_needed()) return false;
9255 } 9251 }
9256 if (call_type == kCallApiFunction) { 9252 if (call_type == kCallApiFunction) {
9257 // Cannot embed a direct reference to the global proxy map 9253 // Cannot embed a direct reference to the global proxy map
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
9333 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback())); 9329 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback()));
9334 ExternalReference ref = ExternalReference(&fun, 9330 ExternalReference ref = ExternalReference(&fun,
9335 ExternalReference::DIRECT_API_CALL, 9331 ExternalReference::DIRECT_API_CALL,
9336 isolate()); 9332 isolate());
9337 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); 9333 HValue* api_function_address = Add<HConstant>(ExternalReference(ref));
9338 9334
9339 HValue* op_vals[] = {context(), Add<HConstant>(function), call_data, holder, 9335 HValue* op_vals[] = {context(), Add<HConstant>(function), call_data, holder,
9340 api_function_address, nullptr}; 9336 api_function_address, nullptr};
9341 9337
9342 HInstruction* call = nullptr; 9338 HInstruction* call = nullptr;
9343 CHECK(argc <= CallApiCallbackStub::kArgMax);
9344 if (!is_function) { 9339 if (!is_function) {
9345 CallApiCallbackStub stub(isolate(), is_store, call_data_undefined, 9340 CallApiAccessorStub stub(isolate(), is_store, call_data_undefined,
9346 !optimization.is_constant_call()); 9341 !optimization.is_constant_call());
9347 Handle<Code> code = stub.GetCode(); 9342 Handle<Code> code = stub.GetCode();
9348 HConstant* code_value = Add<HConstant>(code); 9343 HConstant* code_value = Add<HConstant>(code);
9344 ApiAccessorDescriptor descriptor(isolate());
9349 call = New<HCallWithDescriptor>( 9345 call = New<HCallWithDescriptor>(
9350 code_value, argc + 1, stub.GetCallInterfaceDescriptor(), 9346 code_value, argc + 1, descriptor,
9351 Vector<HValue*>(op_vals, arraysize(op_vals) - 1)); 9347 Vector<HValue*>(op_vals, arraysize(op_vals) - 1));
9352 } else { 9348 } else if (argc <= CallApiFunctionWithFixedArgsStub::kMaxFixedArgs) {
9353 CallApiCallbackStub stub(isolate(), argc, call_data_undefined); 9349 CallApiFunctionWithFixedArgsStub stub(isolate(), argc, call_data_undefined);
9354 Handle<Code> code = stub.GetCode(); 9350 Handle<Code> code = stub.GetCode();
9355 HConstant* code_value = Add<HConstant>(code); 9351 HConstant* code_value = Add<HConstant>(code);
9352 ApiFunctionWithFixedArgsDescriptor descriptor(isolate());
9356 call = New<HCallWithDescriptor>( 9353 call = New<HCallWithDescriptor>(
9357 code_value, argc + 1, stub.GetCallInterfaceDescriptor(), 9354 code_value, argc + 1, descriptor,
9358 Vector<HValue*>(op_vals, arraysize(op_vals) - 1)); 9355 Vector<HValue*>(op_vals, arraysize(op_vals) - 1));
9359 Drop(1); // Drop function. 9356 Drop(1); // Drop function.
9357 } else {
9358 op_vals[arraysize(op_vals) - 1] = Add<HConstant>(argc);
9359 CallApiFunctionStub stub(isolate(), call_data_undefined);
9360 Handle<Code> code = stub.GetCode();
9361 HConstant* code_value = Add<HConstant>(code);
9362 ApiFunctionDescriptor descriptor(isolate());
9363 call =
9364 New<HCallWithDescriptor>(code_value, argc + 1, descriptor,
9365 Vector<HValue*>(op_vals, arraysize(op_vals)));
9366 Drop(1); // Drop function.
9360 } 9367 }
9361 9368
9362 ast_context()->ReturnInstruction(call, ast_id); 9369 ast_context()->ReturnInstruction(call, ast_id);
9363 return true; 9370 return true;
9364 } 9371 }
9365 9372
9366 9373
9367 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, 9374 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function,
9368 int arguments_count) { 9375 int arguments_count) {
9369 Handle<JSFunction> known_function; 9376 Handle<JSFunction> known_function;
(...skipping 4140 matching lines...) Expand 10 before | Expand all | Expand 10 after
13510 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13517 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13511 } 13518 }
13512 13519
13513 #ifdef DEBUG 13520 #ifdef DEBUG
13514 graph_->Verify(false); // No full verify. 13521 graph_->Verify(false); // No full verify.
13515 #endif 13522 #endif
13516 } 13523 }
13517 13524
13518 } // namespace internal 13525 } // namespace internal
13519 } // namespace v8 13526 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/fast-accessor-assembler.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698