OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 | 642 |
643 HConstant* HGraph::GetConstantMinus1() { | 643 HConstant* HGraph::GetConstantMinus1() { |
644 return GetConstant(&constant_minus1_, -1); | 644 return GetConstant(&constant_minus1_, -1); |
645 } | 645 } |
646 | 646 |
647 | 647 |
648 #define DEFINE_GET_CONSTANT(Name, name, htype, boolean_value) \ | 648 #define DEFINE_GET_CONSTANT(Name, name, htype, boolean_value) \ |
649 HConstant* HGraph::GetConstant##Name() { \ | 649 HConstant* HGraph::GetConstant##Name() { \ |
650 if (!constant_##name##_.is_set()) { \ | 650 if (!constant_##name##_.is_set()) { \ |
651 HConstant* constant = new(zone()) HConstant( \ | 651 HConstant* constant = new(zone()) HConstant( \ |
652 isolate()->factory()->name##_value(), \ | 652 Unique<Object>::CreateImmovable(isolate()->factory()->name##_value()), \ |
653 UniqueValueId::name##_value(isolate()->heap()), \ | |
654 Representation::Tagged(), \ | 653 Representation::Tagged(), \ |
655 htype, \ | 654 htype, \ |
656 false, \ | 655 false, \ |
657 true, \ | 656 true, \ |
658 false, \ | 657 false, \ |
659 boolean_value); \ | 658 boolean_value); \ |
660 constant->InsertAfter(GetConstantUndefined()); \ | 659 constant->InsertAfter(GetConstantUndefined()); \ |
661 constant_##name##_.set(constant); \ | 660 constant_##name##_.set(constant); \ |
662 } \ | 661 } \ |
663 return constant_##name##_.get(); \ | 662 return constant_##name##_.get(); \ |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 finished_ = true; | 1031 finished_ = true; |
1033 } | 1032 } |
1034 | 1033 |
1035 | 1034 |
1036 HGraph* HGraphBuilder::CreateGraph() { | 1035 HGraph* HGraphBuilder::CreateGraph() { |
1037 graph_ = new(zone()) HGraph(info_); | 1036 graph_ = new(zone()) HGraph(info_); |
1038 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_); | 1037 if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_); |
1039 CompilationPhase phase("H_Block building", info_); | 1038 CompilationPhase phase("H_Block building", info_); |
1040 set_current_block(graph()->entry_block()); | 1039 set_current_block(graph()->entry_block()); |
1041 if (!BuildGraph()) return NULL; | 1040 if (!BuildGraph()) return NULL; |
1042 graph()->FinalizeUniqueValueIds(); | 1041 graph()->FinalizeUniqueness(); |
1043 return graph_; | 1042 return graph_; |
1044 } | 1043 } |
1045 | 1044 |
1046 | 1045 |
1047 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { | 1046 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { |
1048 ASSERT(current_block() != NULL); | 1047 ASSERT(current_block() != NULL); |
1049 current_block()->AddInstruction(instr); | 1048 current_block()->AddInstruction(instr); |
1050 if (graph()->IsInsideNoSideEffectsScope()) { | 1049 if (graph()->IsInsideNoSideEffectsScope()) { |
1051 instr->SetFlag(HValue::kHasNoObservableSideEffects); | 1050 instr->SetFlag(HValue::kHasNoObservableSideEffects); |
1052 } | 1051 } |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 } | 2149 } |
2151 | 2150 |
2152 | 2151 |
2153 HBasicBlock* HGraph::CreateBasicBlock() { | 2152 HBasicBlock* HGraph::CreateBasicBlock() { |
2154 HBasicBlock* result = new(zone()) HBasicBlock(this); | 2153 HBasicBlock* result = new(zone()) HBasicBlock(this); |
2155 blocks_.Add(result, zone()); | 2154 blocks_.Add(result, zone()); |
2156 return result; | 2155 return result; |
2157 } | 2156 } |
2158 | 2157 |
2159 | 2158 |
2160 void HGraph::FinalizeUniqueValueIds() { | 2159 void HGraph::FinalizeUniqueness() { |
2161 DisallowHeapAllocation no_gc; | 2160 DisallowHeapAllocation no_gc; |
2162 ASSERT(!isolate()->optimizing_compiler_thread()->IsOptimizerThread()); | 2161 ASSERT(!isolate()->optimizing_compiler_thread()->IsOptimizerThread()); |
2163 for (int i = 0; i < blocks()->length(); ++i) { | 2162 for (int i = 0; i < blocks()->length(); ++i) { |
2164 for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) { | 2163 for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) { |
2165 it.Current()->FinalizeUniqueValueId(); | 2164 it.Current()->FinalizeUniqueness(); |
2166 } | 2165 } |
2167 } | 2166 } |
2168 } | 2167 } |
2169 | 2168 |
2170 | 2169 |
2171 // Block ordering was implemented with two mutually recursive methods, | 2170 // Block ordering was implemented with two mutually recursive methods, |
2172 // HGraph::Postorder and HGraph::PostorderLoopBlocks. | 2171 // HGraph::Postorder and HGraph::PostorderLoopBlocks. |
2173 // The recursion could lead to stack overflow so the algorithm has been | 2172 // The recursion could lead to stack overflow so the algorithm has been |
2174 // implemented iteratively. | 2173 // implemented iteratively. |
2175 // At a high level the algorithm looks like this: | 2174 // At a high level the algorithm looks like this: |
(...skipping 7598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9774 if (ShouldProduceTraceOutput()) { | 9773 if (ShouldProduceTraceOutput()) { |
9775 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9774 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9776 } | 9775 } |
9777 | 9776 |
9778 #ifdef DEBUG | 9777 #ifdef DEBUG |
9779 graph_->Verify(false); // No full verify. | 9778 graph_->Verify(false); // No full verify. |
9780 #endif | 9779 #endif |
9781 } | 9780 } |
9782 | 9781 |
9783 } } // namespace v8::internal | 9782 } } // namespace v8::internal |
OLD | NEW |