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 <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 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 if (exit_trampoline_block_ != NULL) { | 1178 if (exit_trampoline_block_ != NULL) { |
1179 builder_->set_current_block(exit_trampoline_block_); | 1179 builder_->set_current_block(exit_trampoline_block_); |
1180 } else { | 1180 } else { |
1181 builder_->set_current_block(exit_block_); | 1181 builder_->set_current_block(exit_block_); |
1182 } | 1182 } |
1183 finished_ = true; | 1183 finished_ = true; |
1184 } | 1184 } |
1185 | 1185 |
1186 | 1186 |
1187 HGraph* HGraphBuilder::CreateGraph() { | 1187 HGraph* HGraphBuilder::CreateGraph() { |
1188 graph_ = new(zone()) HGraph(info_); | 1188 graph_ = new (zone()) HGraph(info_, descriptor_); |
1189 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_); | 1189 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_); |
1190 CompilationPhase phase("H_Block building", info_); | 1190 CompilationPhase phase("H_Block building", info_); |
1191 set_current_block(graph()->entry_block()); | 1191 set_current_block(graph()->entry_block()); |
1192 if (!BuildGraph()) return NULL; | 1192 if (!BuildGraph()) return NULL; |
1193 graph()->FinalizeUniqueness(); | 1193 graph()->FinalizeUniqueness(); |
1194 return graph_; | 1194 return graph_; |
1195 } | 1195 } |
1196 | 1196 |
1197 | 1197 |
1198 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { | 1198 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { |
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3540 | 3540 |
3541 | 3541 |
3542 HValue* HGraphBuilder::AddLoadJSBuiltin(int context_index) { | 3542 HValue* HGraphBuilder::AddLoadJSBuiltin(int context_index) { |
3543 HValue* native_context = BuildGetNativeContext(); | 3543 HValue* native_context = BuildGetNativeContext(); |
3544 HObjectAccess function_access = HObjectAccess::ForContextSlot(context_index); | 3544 HObjectAccess function_access = HObjectAccess::ForContextSlot(context_index); |
3545 return Add<HLoadNamedField>(native_context, nullptr, function_access); | 3545 return Add<HLoadNamedField>(native_context, nullptr, function_access); |
3546 } | 3546 } |
3547 | 3547 |
3548 | 3548 |
3549 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) | 3549 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) |
3550 : HGraphBuilder(info), | 3550 : HGraphBuilder(info, CallInterfaceDescriptor()), |
3551 function_state_(NULL), | 3551 function_state_(NULL), |
3552 initial_function_state_(this, info, NORMAL_RETURN, 0), | 3552 initial_function_state_(this, info, NORMAL_RETURN, 0), |
3553 ast_context_(NULL), | 3553 ast_context_(NULL), |
3554 break_scope_(NULL), | 3554 break_scope_(NULL), |
3555 inlined_count_(0), | 3555 inlined_count_(0), |
3556 globals_(10, info->zone()), | 3556 globals_(10, info->zone()), |
3557 osr_(new(info->zone()) HOsrBuilder(this)) { | 3557 osr_(new (info->zone()) HOsrBuilder(this)) { |
3558 // This is not initialized in the initializer list because the | 3558 // This is not initialized in the initializer list because the |
3559 // constructor for the initial state relies on function_state_ == NULL | 3559 // constructor for the initial state relies on function_state_ == NULL |
3560 // to know it's the initial state. | 3560 // to know it's the initial state. |
3561 function_state_ = &initial_function_state_; | 3561 function_state_ = &initial_function_state_; |
3562 InitializeAstVisitor(info->isolate()); | 3562 InitializeAstVisitor(info->isolate()); |
3563 if (top_info()->is_tracking_positions()) { | 3563 if (top_info()->is_tracking_positions()) { |
3564 SetSourcePosition(info->shared_info()->start_position()); | 3564 SetSourcePosition(info->shared_info()->start_position()); |
3565 } | 3565 } |
3566 } | 3566 } |
3567 | 3567 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3634 Finish(instruction, position); | 3634 Finish(instruction, position); |
3635 ClearEnvironment(); | 3635 ClearEnvironment(); |
3636 } | 3636 } |
3637 | 3637 |
3638 | 3638 |
3639 std::ostream& operator<<(std::ostream& os, const HBasicBlock& b) { | 3639 std::ostream& operator<<(std::ostream& os, const HBasicBlock& b) { |
3640 return os << "B" << b.block_id(); | 3640 return os << "B" << b.block_id(); |
3641 } | 3641 } |
3642 | 3642 |
3643 | 3643 |
3644 HGraph::HGraph(CompilationInfo* info) | 3644 HGraph::HGraph(CompilationInfo* info, CallInterfaceDescriptor descriptor) |
3645 : isolate_(info->isolate()), | 3645 : isolate_(info->isolate()), |
3646 next_block_id_(0), | 3646 next_block_id_(0), |
3647 entry_block_(NULL), | 3647 entry_block_(NULL), |
3648 blocks_(8, info->zone()), | 3648 blocks_(8, info->zone()), |
3649 values_(16, info->zone()), | 3649 values_(16, info->zone()), |
3650 phi_list_(NULL), | 3650 phi_list_(NULL), |
3651 uint32_instructions_(NULL), | 3651 uint32_instructions_(NULL), |
3652 osr_(NULL), | 3652 osr_(NULL), |
3653 info_(info), | 3653 info_(info), |
| 3654 descriptor_(descriptor), |
3654 zone_(info->zone()), | 3655 zone_(info->zone()), |
3655 is_recursive_(false), | 3656 is_recursive_(false), |
3656 use_optimistic_licm_(false), | 3657 use_optimistic_licm_(false), |
3657 depends_on_empty_array_proto_elements_(false), | 3658 depends_on_empty_array_proto_elements_(false), |
3658 type_change_checksum_(0), | 3659 type_change_checksum_(0), |
3659 maximum_environment_size_(0), | 3660 maximum_environment_size_(0), |
3660 no_side_effects_scope_count_(0), | 3661 no_side_effects_scope_count_(0), |
3661 disallow_adding_new_values_(false) { | 3662 disallow_adding_new_values_(false) { |
3662 if (info->IsStub()) { | 3663 if (info->IsStub()) { |
3663 CallInterfaceDescriptor descriptor = | |
3664 info->code_stub()->GetCallInterfaceDescriptor(); | |
3665 start_environment_ = | 3664 start_environment_ = |
3666 new (zone_) HEnvironment(zone_, descriptor.GetRegisterParameterCount()); | 3665 new (zone_) HEnvironment(zone_, descriptor.GetRegisterParameterCount()); |
3667 } else { | 3666 } else { |
3668 if (info->is_tracking_positions()) { | 3667 if (info->is_tracking_positions()) { |
3669 info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(), | 3668 info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(), |
3670 InlinedFunctionInfo::kNoParentId); | 3669 InlinedFunctionInfo::kNoParentId); |
3671 } | 3670 } |
3672 start_environment_ = | 3671 start_environment_ = |
3673 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); | 3672 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); |
3674 } | 3673 } |
(...skipping 9927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13602 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13601 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13603 } | 13602 } |
13604 | 13603 |
13605 #ifdef DEBUG | 13604 #ifdef DEBUG |
13606 graph_->Verify(false); // No full verify. | 13605 graph_->Verify(false); // No full verify. |
13607 #endif | 13606 #endif |
13608 } | 13607 } |
13609 | 13608 |
13610 } // namespace internal | 13609 } // namespace internal |
13611 } // namespace v8 | 13610 } // namespace v8 |
OLD | NEW |