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 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3424 depends_on_empty_array_proto_elements_(false), | 3424 depends_on_empty_array_proto_elements_(false), |
3425 type_change_checksum_(0), | 3425 type_change_checksum_(0), |
3426 maximum_environment_size_(0), | 3426 maximum_environment_size_(0), |
3427 no_side_effects_scope_count_(0), | 3427 no_side_effects_scope_count_(0), |
3428 disallow_adding_new_values_(false), | 3428 disallow_adding_new_values_(false), |
3429 next_inline_id_(0), | 3429 next_inline_id_(0), |
3430 inlined_functions_(5, info->zone()) { | 3430 inlined_functions_(5, info->zone()) { |
3431 if (info->IsStub()) { | 3431 if (info->IsStub()) { |
3432 HydrogenCodeStub* stub = info->code_stub(); | 3432 HydrogenCodeStub* stub = info->code_stub(); |
3433 CodeStubInterfaceDescriptor* descriptor = stub->GetInterfaceDescriptor(); | 3433 CodeStubInterfaceDescriptor* descriptor = stub->GetInterfaceDescriptor(); |
3434 start_environment_ = | 3434 start_environment_ = new(zone_) HEnvironment( |
3435 new(zone_) HEnvironment(zone_, descriptor->environment_length()); | 3435 zone_, descriptor->GetEnvironmentParameterCount()); |
3436 } else { | 3436 } else { |
3437 TraceInlinedFunction(info->shared_info(), HSourcePosition::Unknown()); | 3437 TraceInlinedFunction(info->shared_info(), HSourcePosition::Unknown()); |
3438 start_environment_ = | 3438 start_environment_ = |
3439 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); | 3439 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); |
3440 } | 3440 } |
3441 start_environment_->set_ast_id(BailoutId::FunctionEntry()); | 3441 start_environment_->set_ast_id(BailoutId::FunctionEntry()); |
3442 entry_block_ = CreateBasicBlock(); | 3442 entry_block_ = CreateBasicBlock(); |
3443 entry_block_->SetInitialEnvironment(start_environment_); | 3443 entry_block_->SetInitialEnvironment(start_environment_); |
3444 } | 3444 } |
3445 | 3445 |
(...skipping 3890 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[] = { context, 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, argument_count, descriptor, |
7354 Vector<HValue*>(op_vals, descriptor->environment_length())); | 7354 Vector<HValue*>(op_vals, descriptor->GetEnvironmentLength())); |
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(); |
7364 bool dont_adapt_arguments = | 7364 bool dont_adapt_arguments = |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8574 Handle<Object> call_data_obj(api_call_info->data(), isolate()); | 8574 Handle<Object> call_data_obj(api_call_info->data(), isolate()); |
8575 bool call_data_is_undefined = call_data_obj->IsUndefined(); | 8575 bool call_data_is_undefined = call_data_obj->IsUndefined(); |
8576 HValue* call_data = Add<HConstant>(call_data_obj); | 8576 HValue* call_data = Add<HConstant>(call_data_obj); |
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 context(), |
8584 Add<HConstant>(function), | 8585 Add<HConstant>(function), |
8585 call_data, | 8586 call_data, |
8586 holder, | 8587 holder, |
8587 api_function_address, | 8588 api_function_address |
8588 context() | |
8589 }; | 8589 }; |
8590 | 8590 |
8591 CallInterfaceDescriptor* descriptor = | 8591 CallInterfaceDescriptor* descriptor = |
8592 isolate()->call_descriptor(Isolate::ApiFunctionCall); | 8592 isolate()->call_descriptor(Isolate::ApiFunctionCall); |
8593 | 8593 |
8594 CallApiFunctionStub stub(isolate(), is_store, call_data_is_undefined, argc); | 8594 CallApiFunctionStub stub(isolate(), is_store, call_data_is_undefined, argc); |
8595 Handle<Code> code = stub.GetCode(); | 8595 Handle<Code> code = stub.GetCode(); |
8596 HConstant* code_value = Add<HConstant>(code); | 8596 HConstant* code_value = Add<HConstant>(code); |
8597 | 8597 |
8598 ASSERT((sizeof(op_vals) / kPointerSize) == | 8598 ASSERT((sizeof(op_vals) / kPointerSize) == |
8599 descriptor->environment_length()); | 8599 descriptor->GetEnvironmentLength()); |
8600 | 8600 |
8601 HInstruction* call = New<HCallWithDescriptor>( | 8601 HInstruction* call = New<HCallWithDescriptor>( |
8602 code_value, argc + 1, descriptor, | 8602 code_value, argc + 1, descriptor, |
8603 Vector<HValue*>(op_vals, descriptor->environment_length())); | 8603 Vector<HValue*>(op_vals, descriptor->GetEnvironmentLength())); |
8604 | 8604 |
8605 if (drop_extra) Drop(1); // Drop function. | 8605 if (drop_extra) Drop(1); // Drop function. |
8606 ast_context()->ReturnInstruction(call, ast_id); | 8606 ast_context()->ReturnInstruction(call, ast_id); |
8607 return true; | 8607 return true; |
8608 } | 8608 } |
8609 | 8609 |
8610 | 8610 |
8611 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { | 8611 bool HOptimizedGraphBuilder::TryCallApply(Call* expr) { |
8612 ASSERT(expr->expression()->IsProperty()); | 8612 ASSERT(expr->expression()->IsProperty()); |
8613 | 8613 |
(...skipping 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12424 if (ShouldProduceTraceOutput()) { | 12424 if (ShouldProduceTraceOutput()) { |
12425 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12425 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12426 } | 12426 } |
12427 | 12427 |
12428 #ifdef DEBUG | 12428 #ifdef DEBUG |
12429 graph_->Verify(false); // No full verify. | 12429 graph_->Verify(false); // No full verify. |
12430 #endif | 12430 #endif |
12431 } | 12431 } |
12432 | 12432 |
12433 } } // namespace v8::internal | 12433 } } // namespace v8::internal |
OLD | NEW |