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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 7376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7387 HInstruction* HOptimizedGraphBuilder::NewPlainFunctionCall( | 7387 HInstruction* HOptimizedGraphBuilder::NewPlainFunctionCall( |
7388 HValue* fun, int argument_count, bool pass_argument_count) { | 7388 HValue* fun, int argument_count, bool pass_argument_count) { |
7389 return New<HCallJSFunction>( | 7389 return New<HCallJSFunction>( |
7390 fun, argument_count, pass_argument_count); | 7390 fun, argument_count, pass_argument_count); |
7391 } | 7391 } |
7392 | 7392 |
7393 | 7393 |
7394 HInstruction* HOptimizedGraphBuilder::NewArgumentAdaptorCall( | 7394 HInstruction* HOptimizedGraphBuilder::NewArgumentAdaptorCall( |
7395 HValue* fun, HValue* context, | 7395 HValue* fun, HValue* context, |
7396 int argument_count, HValue* expected_param_count) { | 7396 int argument_count, HValue* expected_param_count) { |
7397 CallInterfaceDescriptor* descriptor = | 7397 ArgumentAdaptorDescriptor descriptor(isolate()); |
7398 isolate()->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall); | |
7399 | |
7400 HValue* arity = Add<HConstant>(argument_count - 1); | 7398 HValue* arity = Add<HConstant>(argument_count - 1); |
7401 | 7399 |
7402 HValue* op_vals[] = { context, fun, arity, expected_param_count }; | 7400 HValue* op_vals[] = { context, fun, arity, expected_param_count }; |
7403 | 7401 |
7404 Handle<Code> adaptor = | 7402 Handle<Code> adaptor = |
7405 isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 7403 isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
7406 HConstant* adaptor_value = Add<HConstant>(adaptor); | 7404 HConstant* adaptor_value = Add<HConstant>(adaptor); |
7407 | 7405 |
7408 return New<HCallWithDescriptor>( | 7406 return New<HCallWithDescriptor>( |
7409 adaptor_value, argument_count, descriptor, | 7407 adaptor_value, argument_count, descriptor, |
7410 Vector<HValue*>(op_vals, descriptor->GetEnvironmentLength())); | 7408 Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength())); |
7411 } | 7409 } |
7412 | 7410 |
7413 | 7411 |
7414 HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction( | 7412 HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction( |
7415 Handle<JSFunction> jsfun, int argument_count) { | 7413 Handle<JSFunction> jsfun, int argument_count) { |
7416 HValue* target = Add<HConstant>(jsfun); | 7414 HValue* target = Add<HConstant>(jsfun); |
7417 // For constant functions, we try to avoid calling the | 7415 // For constant functions, we try to avoid calling the |
7418 // argument adaptor and instead call the function directly | 7416 // argument adaptor and instead call the function directly |
7419 int formal_parameter_count = jsfun->shared()->formal_parameter_count(); | 7417 int formal_parameter_count = jsfun->shared()->formal_parameter_count(); |
7420 bool dont_adapt_arguments = | 7418 bool dont_adapt_arguments = |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8637 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); | 8635 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); |
8638 | 8636 |
8639 HValue* op_vals[] = { | 8637 HValue* op_vals[] = { |
8640 context(), | 8638 context(), |
8641 Add<HConstant>(function), | 8639 Add<HConstant>(function), |
8642 call_data, | 8640 call_data, |
8643 holder, | 8641 holder, |
8644 api_function_address | 8642 api_function_address |
8645 }; | 8643 }; |
8646 | 8644 |
8647 CallInterfaceDescriptor* descriptor = | 8645 ApiFunctionDescriptor descriptor(isolate()); |
8648 isolate()->call_descriptor(CallDescriptorKey::ApiFunctionCall); | |
8649 | |
8650 CallApiFunctionStub stub(isolate(), is_store, call_data_is_undefined, argc); | 8646 CallApiFunctionStub stub(isolate(), is_store, call_data_is_undefined, argc); |
8651 Handle<Code> code = stub.GetCode(); | 8647 Handle<Code> code = stub.GetCode(); |
8652 HConstant* code_value = Add<HConstant>(code); | 8648 HConstant* code_value = Add<HConstant>(code); |
8653 | 8649 |
8654 DCHECK((sizeof(op_vals) / kPointerSize) == | 8650 DCHECK((sizeof(op_vals) / kPointerSize) == descriptor.GetEnvironmentLength()); |
8655 descriptor->GetEnvironmentLength()); | |
8656 | 8651 |
8657 HInstruction* call = New<HCallWithDescriptor>( | 8652 HInstruction* call = New<HCallWithDescriptor>( |
8658 code_value, argc + 1, descriptor, | 8653 code_value, argc + 1, descriptor, |
8659 Vector<HValue*>(op_vals, descriptor->GetEnvironmentLength())); | 8654 Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength())); |
8660 | 8655 |
8661 if (drop_extra) Drop(1); // Drop function. | 8656 if (drop_extra) Drop(1); // Drop function. |
8662 ast_context()->ReturnInstruction(call, ast_id); | 8657 ast_context()->ReturnInstruction(call, ast_id); |
8663 return true; | 8658 return true; |
8664 } | 8659 } |
8665 | 8660 |
8666 | 8661 |
8667 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { | 8662 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { |
8668 DCHECK(expr->expression()->IsProperty()); | 8663 DCHECK(expr->expression()->IsProperty()); |
8669 | 8664 |
(...skipping 3819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12489 if (ShouldProduceTraceOutput()) { | 12484 if (ShouldProduceTraceOutput()) { |
12490 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12485 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12491 } | 12486 } |
12492 | 12487 |
12493 #ifdef DEBUG | 12488 #ifdef DEBUG |
12494 graph_->Verify(false); // No full verify. | 12489 graph_->Verify(false); // No full verify. |
12495 #endif | 12490 #endif |
12496 } | 12491 } |
12497 | 12492 |
12498 } } // namespace v8::internal | 12493 } } // namespace v8::internal |
OLD | NEW |