OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bool IsFinished() const { return end_ != NULL; } | 96 bool IsFinished() const { return end_ != NULL; } |
97 void AddPhi(HPhi* phi); | 97 void AddPhi(HPhi* phi); |
98 void RemovePhi(HPhi* phi); | 98 void RemovePhi(HPhi* phi); |
99 void AddInstruction(HInstruction* instr); | 99 void AddInstruction(HInstruction* instr); |
100 bool Dominates(HBasicBlock* other) const; | 100 bool Dominates(HBasicBlock* other) const; |
101 | 101 |
102 void SetInitialEnvironment(HEnvironment* env); | 102 void SetInitialEnvironment(HEnvironment* env); |
103 void ClearEnvironment() { last_environment_ = NULL; } | 103 void ClearEnvironment() { last_environment_ = NULL; } |
104 bool HasEnvironment() const { return last_environment_ != NULL; } | 104 bool HasEnvironment() const { return last_environment_ != NULL; } |
105 void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; } | 105 void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; } |
106 HBasicBlock* parent_loop_header() const { | 106 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } |
107 if (!HasParentLoopHeader()) return NULL; | 107 |
108 return parent_loop_header_.get(); | 108 void set_parent_loop_header(HBasicBlock* block) { |
| 109 ASSERT(parent_loop_header_ == NULL); |
| 110 parent_loop_header_ = block; |
109 } | 111 } |
110 | 112 |
111 void set_parent_loop_header(HBasicBlock* block) { | 113 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } |
112 parent_loop_header_.set(block); | |
113 } | |
114 | |
115 bool HasParentLoopHeader() const { return parent_loop_header_.is_set(); } | |
116 | 114 |
117 void SetJoinId(int id); | 115 void SetJoinId(int id); |
118 | 116 |
119 void Finish(HControlInstruction* last); | 117 void Finish(HControlInstruction* last); |
120 void Goto(HBasicBlock* block, bool include_stack_check = false); | 118 void Goto(HBasicBlock* block, bool include_stack_check = false); |
121 | 119 |
122 int PredecessorIndexOf(HBasicBlock* predecessor) const; | 120 int PredecessorIndexOf(HBasicBlock* predecessor) const; |
123 void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); } | 121 void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); } |
124 void AssignCommonDominator(HBasicBlock* other); | 122 void AssignCommonDominator(HBasicBlock* other); |
125 | 123 |
126 // Add the inlined function exit sequence, adding an HLeaveInlined | 124 // Add the inlined function exit sequence, adding an HLeaveInlined |
127 // instruction and updating the bailout environment. | 125 // instruction and updating the bailout environment. |
128 void AddLeaveInlined(HValue* return_value, HBasicBlock* target); | 126 void AddLeaveInlined(HValue* return_value, HBasicBlock* target); |
129 | 127 |
130 // If a target block is tagged as an inline function return, all | 128 // If a target block is tagged as an inline function return, all |
131 // predecessors should contain the inlined exit sequence: | 129 // predecessors should contain the inlined exit sequence: |
132 // | 130 // |
133 // LeaveInlined | 131 // LeaveInlined |
134 // Simulate (caller's environment) | 132 // Simulate (caller's environment) |
135 // Goto (target block) | 133 // Goto (target block) |
136 bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 134 bool IsInlineReturnTarget() const { return is_inline_return_target_; } |
137 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } | 135 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } |
138 | 136 |
139 Handle<Object> cond() { return cond_; } | |
140 void set_cond(Handle<Object> value) { cond_ = value; } | |
141 | |
142 #ifdef DEBUG | 137 #ifdef DEBUG |
143 void Verify(); | 138 void Verify(); |
144 #endif | 139 #endif |
145 | 140 |
146 private: | 141 private: |
147 void RegisterPredecessor(HBasicBlock* pred); | 142 void RegisterPredecessor(HBasicBlock* pred); |
148 void AddDominatedBlock(HBasicBlock* block); | 143 void AddDominatedBlock(HBasicBlock* block); |
149 | 144 |
150 HSimulate* CreateSimulate(int id); | 145 HSimulate* CreateSimulate(int id); |
151 | 146 |
152 int block_id_; | 147 int block_id_; |
153 HGraph* graph_; | 148 HGraph* graph_; |
154 ZoneList<HPhi*> phis_; | 149 ZoneList<HPhi*> phis_; |
155 HInstruction* first_; | 150 HInstruction* first_; |
156 HInstruction* last_; // Last non-control instruction of the block. | 151 HInstruction* last_; // Last non-control instruction of the block. |
157 HControlInstruction* end_; | 152 HControlInstruction* end_; |
158 HLoopInformation* loop_information_; | 153 HLoopInformation* loop_information_; |
159 ZoneList<HBasicBlock*> predecessors_; | 154 ZoneList<HBasicBlock*> predecessors_; |
160 HBasicBlock* dominator_; | 155 HBasicBlock* dominator_; |
161 ZoneList<HBasicBlock*> dominated_blocks_; | 156 ZoneList<HBasicBlock*> dominated_blocks_; |
162 HEnvironment* last_environment_; | 157 HEnvironment* last_environment_; |
163 // Outgoing parameter count at block exit, set during lithium translation. | 158 // Outgoing parameter count at block exit, set during lithium translation. |
164 int argument_count_; | 159 int argument_count_; |
165 // Instruction indices into the lithium code stream. | 160 // Instruction indices into the lithium code stream. |
166 int first_instruction_index_; | 161 int first_instruction_index_; |
167 int last_instruction_index_; | 162 int last_instruction_index_; |
168 ZoneList<int> deleted_phis_; | 163 ZoneList<int> deleted_phis_; |
169 SetOncePointer<HBasicBlock> parent_loop_header_; | 164 HBasicBlock* parent_loop_header_; |
170 bool is_inline_return_target_; | 165 bool is_inline_return_target_; |
171 Handle<Object> cond_; | |
172 }; | 166 }; |
173 | 167 |
174 | 168 |
175 class HLoopInformation: public ZoneObject { | 169 class HLoopInformation: public ZoneObject { |
176 public: | 170 public: |
177 explicit HLoopInformation(HBasicBlock* loop_header) | 171 explicit HLoopInformation(HBasicBlock* loop_header) |
178 : back_edges_(4), loop_header_(loop_header), blocks_(8) { | 172 : back_edges_(4), loop_header_(loop_header), blocks_(8) { |
179 blocks_.Add(loop_header); | 173 blocks_.Add(loop_header); |
180 } | 174 } |
181 virtual ~HLoopInformation() {} | 175 virtual ~HLoopInformation() {} |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 const char* filename_; | 1063 const char* filename_; |
1070 HeapStringAllocator string_allocator_; | 1064 HeapStringAllocator string_allocator_; |
1071 StringStream trace_; | 1065 StringStream trace_; |
1072 int indent_; | 1066 int indent_; |
1073 }; | 1067 }; |
1074 | 1068 |
1075 | 1069 |
1076 } } // namespace v8::internal | 1070 } } // namespace v8::internal |
1077 | 1071 |
1078 #endif // V8_HYDROGEN_H_ | 1072 #endif // V8_HYDROGEN_H_ |
OLD | NEW |