OLD | NEW |
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 <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 9084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9095 break; | 9095 break; |
9096 case CallOptimization::kHolderIsReceiver: | 9096 case CallOptimization::kHolderIsReceiver: |
9097 holder = receiver; | 9097 holder = receiver; |
9098 break; | 9098 break; |
9099 case CallOptimization::kHolderNotFound: | 9099 case CallOptimization::kHolderNotFound: |
9100 UNREACHABLE(); | 9100 UNREACHABLE(); |
9101 break; | 9101 break; |
9102 } | 9102 } |
9103 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 9103 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
9104 Handle<Object> call_data_obj(api_call_info->data(), isolate()); | 9104 Handle<Object> call_data_obj(api_call_info->data(), isolate()); |
9105 bool call_data_undefined = call_data_obj->IsUndefined(isolate()); | |
9106 HValue* call_data = Add<HConstant>(call_data_obj); | 9105 HValue* call_data = Add<HConstant>(call_data_obj); |
9107 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback())); | 9106 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback())); |
9108 ExternalReference ref = ExternalReference(&fun, | 9107 ExternalReference ref = ExternalReference(&fun, |
9109 ExternalReference::DIRECT_API_CALL, | 9108 ExternalReference::DIRECT_API_CALL, |
9110 isolate()); | 9109 isolate()); |
9111 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); | 9110 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); |
9112 | 9111 |
9113 HValue* op_vals[] = {Add<HConstant>(function), call_data, holder, | 9112 HValue* op_vals[] = {Add<HConstant>(function), call_data, holder, |
9114 api_function_address}; | 9113 api_function_address}; |
9115 | 9114 |
9116 HInstruction* call = nullptr; | 9115 HInstruction* call = nullptr; |
9117 CHECK(argc <= CallApiCallbackStub::kArgMax); | 9116 CHECK(argc <= CallApiCallbackStub::kArgMax); |
9118 if (!is_function) { | 9117 if (!is_function) { |
9119 CallApiCallbackStub stub(isolate(), is_store, call_data_undefined, | 9118 CallApiCallbackStub stub(isolate(), is_store, |
9120 !optimization.is_constant_call()); | 9119 !optimization.is_constant_call()); |
9121 Handle<Code> code = stub.GetCode(); | 9120 Handle<Code> code = stub.GetCode(); |
9122 HConstant* code_value = Add<HConstant>(code); | 9121 HConstant* code_value = Add<HConstant>(code); |
9123 call = New<HCallWithDescriptor>( | 9122 call = New<HCallWithDescriptor>( |
9124 code_value, argc + 1, stub.GetCallInterfaceDescriptor(), | 9123 code_value, argc + 1, stub.GetCallInterfaceDescriptor(), |
9125 Vector<HValue*>(op_vals, arraysize(op_vals)), syntactic_tail_call_mode); | 9124 Vector<HValue*>(op_vals, arraysize(op_vals)), syntactic_tail_call_mode); |
9126 } else { | 9125 } else { |
9127 CallApiCallbackStub stub(isolate(), argc, call_data_undefined, false); | 9126 CallApiCallbackStub stub(isolate(), argc, false); |
9128 Handle<Code> code = stub.GetCode(); | 9127 Handle<Code> code = stub.GetCode(); |
9129 HConstant* code_value = Add<HConstant>(code); | 9128 HConstant* code_value = Add<HConstant>(code); |
9130 call = New<HCallWithDescriptor>( | 9129 call = New<HCallWithDescriptor>( |
9131 code_value, argc + 1, stub.GetCallInterfaceDescriptor(), | 9130 code_value, argc + 1, stub.GetCallInterfaceDescriptor(), |
9132 Vector<HValue*>(op_vals, arraysize(op_vals)), syntactic_tail_call_mode); | 9131 Vector<HValue*>(op_vals, arraysize(op_vals)), syntactic_tail_call_mode); |
9133 Drop(1); // Drop function. | 9132 Drop(1); // Drop function. |
9134 } | 9133 } |
9135 | 9134 |
9136 ast_context()->ReturnInstruction(call, ast_id); | 9135 ast_context()->ReturnInstruction(call, ast_id); |
9137 return true; | 9136 return true; |
(...skipping 3607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12745 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12744 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12746 } | 12745 } |
12747 | 12746 |
12748 #ifdef DEBUG | 12747 #ifdef DEBUG |
12749 graph_->Verify(false); // No full verify. | 12748 graph_->Verify(false); // No full verify. |
12750 #endif | 12749 #endif |
12751 } | 12750 } |
12752 | 12751 |
12753 } // namespace internal | 12752 } // namespace internal |
12754 } // namespace v8 | 12753 } // namespace v8 |
OLD | NEW |