| 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 7325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7336 | 7336 |
| 7337 | 7337 |
| 7338 HInstruction* HOptimizedGraphBuilder::NewArgumentAdaptorCall( | 7338 HInstruction* HOptimizedGraphBuilder::NewArgumentAdaptorCall( |
| 7339 HValue* fun, HValue* context, | 7339 HValue* fun, HValue* context, |
| 7340 int argument_count, HValue* expected_param_count) { | 7340 int argument_count, HValue* expected_param_count) { |
| 7341 CallInterfaceDescriptor* descriptor = | 7341 CallInterfaceDescriptor* descriptor = |
| 7342 isolate()->call_descriptor(Isolate::ArgumentAdaptorCall); | 7342 isolate()->call_descriptor(Isolate::ArgumentAdaptorCall); |
| 7343 | 7343 |
| 7344 HValue* arity = Add<HConstant>(argument_count - 1); | 7344 HValue* arity = Add<HConstant>(argument_count - 1); |
| 7345 | 7345 |
| 7346 HValue* op_vals[] = { fun, context, arity, expected_param_count }; | 7346 HValue* op_vals[] = { fun, arity, expected_param_count }; |
| 7347 | 7347 |
| 7348 Handle<Code> adaptor = | 7348 Handle<Code> adaptor = |
| 7349 isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 7349 isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 7350 HConstant* adaptor_value = Add<HConstant>(adaptor); | 7350 HConstant* adaptor_value = Add<HConstant>(adaptor); |
| 7351 | 7351 |
| 7352 return New<HCallWithDescriptor>( | 7352 return New<HCallWithDescriptor>( |
| 7353 adaptor_value, argument_count, descriptor, | 7353 adaptor_value, context, argument_count, descriptor, |
| 7354 Vector<HValue*>(op_vals, descriptor->environment_length())); | 7354 Vector<HValue*>(op_vals, descriptor->environment_length())); |
| 7355 } | 7355 } |
| 7356 | 7356 |
| 7357 | 7357 |
| 7358 HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction( | 7358 HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction( |
| 7359 Handle<JSFunction> jsfun, int argument_count) { | 7359 Handle<JSFunction> jsfun, int argument_count) { |
| 7360 HValue* target = Add<HConstant>(jsfun); | 7360 HValue* target = Add<HConstant>(jsfun); |
| 7361 // For constant functions, we try to avoid calling the | 7361 // For constant functions, we try to avoid calling the |
| 7362 // argument adaptor and instead call the function directly | 7362 // argument adaptor and instead call the function directly |
| 7363 int formal_parameter_count = jsfun->shared()->formal_parameter_count(); | 7363 int formal_parameter_count = jsfun->shared()->formal_parameter_count(); |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8577 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback())); | 8577 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback())); |
| 8578 ExternalReference ref = ExternalReference(&fun, | 8578 ExternalReference ref = ExternalReference(&fun, |
| 8579 ExternalReference::DIRECT_API_CALL, | 8579 ExternalReference::DIRECT_API_CALL, |
| 8580 isolate()); | 8580 isolate()); |
| 8581 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); | 8581 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); |
| 8582 | 8582 |
| 8583 HValue* op_vals[] = { | 8583 HValue* op_vals[] = { |
| 8584 Add<HConstant>(function), | 8584 Add<HConstant>(function), |
| 8585 call_data, | 8585 call_data, |
| 8586 holder, | 8586 holder, |
| 8587 api_function_address, | 8587 api_function_address |
| 8588 context() | |
| 8589 }; | 8588 }; |
| 8590 | 8589 |
| 8591 CallInterfaceDescriptor* descriptor = | 8590 CallInterfaceDescriptor* descriptor = |
| 8592 isolate()->call_descriptor(Isolate::ApiFunctionCall); | 8591 isolate()->call_descriptor(Isolate::ApiFunctionCall); |
| 8593 | 8592 |
| 8594 CallApiFunctionStub stub(isolate(), is_store, call_data_is_undefined, argc); | 8593 CallApiFunctionStub stub(isolate(), is_store, call_data_is_undefined, argc); |
| 8595 Handle<Code> code = stub.GetCode(); | 8594 Handle<Code> code = stub.GetCode(); |
| 8596 HConstant* code_value = Add<HConstant>(code); | 8595 HConstant* code_value = Add<HConstant>(code); |
| 8597 | 8596 |
| 8598 ASSERT((sizeof(op_vals) / kPointerSize) == | 8597 ASSERT((sizeof(op_vals) / kPointerSize) == |
| 8599 descriptor->environment_length()); | 8598 descriptor->environment_length()); |
| 8600 | 8599 |
| 8601 HInstruction* call = New<HCallWithDescriptor>( | 8600 HInstruction* call = New<HCallWithDescriptor>( |
| 8602 code_value, argc + 1, descriptor, | 8601 code_value, context(), argc + 1, descriptor, |
| 8603 Vector<HValue*>(op_vals, descriptor->environment_length())); | 8602 Vector<HValue*>(op_vals, descriptor->environment_length())); |
| 8604 | 8603 |
| 8605 if (drop_extra) Drop(1); // Drop function. | 8604 if (drop_extra) Drop(1); // Drop function. |
| 8606 ast_context()->ReturnInstruction(call, ast_id); | 8605 ast_context()->ReturnInstruction(call, ast_id); |
| 8607 return true; | 8606 return true; |
| 8608 } | 8607 } |
| 8609 | 8608 |
| 8610 | 8609 |
| 8611 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { | 8610 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { |
| 8612 ASSERT(expr->expression()->IsProperty()); | 8611 ASSERT(expr->expression()->IsProperty()); |
| (...skipping 3811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12424 if (ShouldProduceTraceOutput()) { | 12423 if (ShouldProduceTraceOutput()) { |
| 12425 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12424 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12426 } | 12425 } |
| 12427 | 12426 |
| 12428 #ifdef DEBUG | 12427 #ifdef DEBUG |
| 12429 graph_->Verify(false); // No full verify. | 12428 graph_->Verify(false); // No full verify. |
| 12430 #endif | 12429 #endif |
| 12431 } | 12430 } |
| 12432 | 12431 |
| 12433 } } // namespace v8::internal | 12432 } } // namespace v8::internal |
| OLD | NEW |