Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 void set_block_id(int id) { block_id_ = id; } | 62 void set_block_id(int id) { block_id_ = id; } |
| 63 HGraph* graph() const { return graph_; } | 63 HGraph* graph() const { return graph_; } |
| 64 Isolate* isolate() const; | 64 Isolate* isolate() const; |
| 65 const ZoneList<HPhi*>* phis() const { return &phis_; } | 65 const ZoneList<HPhi*>* phis() const { return &phis_; } |
| 66 HInstruction* first() const { return first_; } | 66 HInstruction* first() const { return first_; } |
| 67 HInstruction* last() const { return last_; } | 67 HInstruction* last() const { return last_; } |
| 68 void set_last(HInstruction* instr) { last_ = instr; } | 68 void set_last(HInstruction* instr) { last_ = instr; } |
| 69 HInstruction* GetLastInstruction(); | 69 HInstruction* GetLastInstruction(); |
| 70 HControlInstruction* end() const { return end_; } | 70 HControlInstruction* end() const { return end_; } |
| 71 HLoopInformation* loop_information() const { return loop_information_; } | 71 HLoopInformation* loop_information() const { return loop_information_; } |
| 72 HLoopInformation* current_loop() const { | |
| 73 return IsLoopHeader() ? loop_information() | |
| 74 : (parent_loop_header() != NULL | |
| 75 ? parent_loop_header()->loop_information() : NULL); | |
| 76 } | |
| 72 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 77 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| 73 bool HasPredecessor() const { return predecessors_.length() > 0; } | 78 bool HasPredecessor() const { return predecessors_.length() > 0; } |
| 74 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 79 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| 75 return &dominated_blocks_; | 80 return &dominated_blocks_; |
| 76 } | 81 } |
| 77 const ZoneList<int>* deleted_phis() const { | 82 const ZoneList<int>* deleted_phis() const { |
| 78 return &deleted_phis_; | 83 return &deleted_phis_; |
| 79 } | 84 } |
| 80 void RecordDeletedPhi(int merge_index) { | 85 void RecordDeletedPhi(int merge_index) { |
| 81 deleted_phis_.Add(merge_index, zone()); | 86 deleted_phis_.Add(merge_index, zone()); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 int current_; | 219 int current_; |
| 215 }; | 220 }; |
| 216 | 221 |
| 217 | 222 |
| 218 class HLoopInformation: public ZoneObject { | 223 class HLoopInformation: public ZoneObject { |
| 219 public: | 224 public: |
| 220 HLoopInformation(HBasicBlock* loop_header, Zone* zone) | 225 HLoopInformation(HBasicBlock* loop_header, Zone* zone) |
| 221 : back_edges_(4, zone), | 226 : back_edges_(4, zone), |
| 222 loop_header_(loop_header), | 227 loop_header_(loop_header), |
| 223 blocks_(8, zone), | 228 blocks_(8, zone), |
| 224 stack_check_(NULL) { | 229 stack_check_(NULL), |
| 230 exits_count_(0) { | |
| 225 blocks_.Add(loop_header, zone); | 231 blocks_.Add(loop_header, zone); |
| 226 } | 232 } |
| 227 virtual ~HLoopInformation() {} | 233 virtual ~HLoopInformation() {} |
| 228 | 234 |
| 229 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } | 235 const ZoneList<HBasicBlock*>* back_edges() const { return &back_edges_; } |
| 230 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 236 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 231 HBasicBlock* loop_header() const { return loop_header_; } | 237 HBasicBlock* loop_header() const { return loop_header_; } |
| 232 HBasicBlock* GetLastBackEdge() const; | 238 HBasicBlock* GetLastBackEdge() const; |
| 233 void RegisterBackEdge(HBasicBlock* block); | 239 void RegisterBackEdge(HBasicBlock* block); |
| 234 | 240 |
| 235 HStackCheck* stack_check() const { return stack_check_; } | 241 HStackCheck* stack_check() const { return stack_check_; } |
| 236 void set_stack_check(HStackCheck* stack_check) { | 242 void set_stack_check(HStackCheck* stack_check) { |
| 237 stack_check_ = stack_check; | 243 stack_check_ = stack_check; |
| 238 } | 244 } |
| 239 | 245 |
| 246 int exits_count() { return exits_count_; } | |
| 247 HLoopInformation* parent_loop() { | |
| 248 HBasicBlock* parent_header = loop_header()->parent_loop_header(); | |
| 249 return parent_header != NULL ? parent_header->loop_information() : NULL; | |
| 250 } | |
| 251 bool IsInThisLoop(HLoopInformation* other) { | |
|
Jakob Kummerow
2013/04/17 11:34:15
I'd rename this to IsNestedInThisLoop (or just IsN
Massi
2013/05/07 11:32:03
Done.
| |
| 252 while (other != NULL) { | |
| 253 if (other == this) { | |
| 254 return true; | |
| 255 } | |
| 256 other = other->parent_loop(); | |
| 257 } | |
| 258 return false; | |
| 259 } | |
| 260 void ProcessEdge(HBasicBlock* destination); | |
| 261 void ProcessThrow(); | |
| 262 | |
| 240 private: | 263 private: |
| 241 void AddBlock(HBasicBlock* block); | 264 void AddBlock(HBasicBlock* block); |
| 242 | 265 |
| 243 ZoneList<HBasicBlock*> back_edges_; | 266 ZoneList<HBasicBlock*> back_edges_; |
| 244 HBasicBlock* loop_header_; | 267 HBasicBlock* loop_header_; |
| 245 ZoneList<HBasicBlock*> blocks_; | 268 ZoneList<HBasicBlock*> blocks_; |
| 246 HStackCheck* stack_check_; | 269 HStackCheck* stack_check_; |
| 270 int exits_count_; | |
| 247 }; | 271 }; |
| 248 | 272 |
| 249 class BoundsCheckTable; | 273 class BoundsCheckTable; |
| 250 class HGraph: public ZoneObject { | 274 class HGraph: public ZoneObject { |
| 251 public: | 275 public: |
| 252 explicit HGraph(CompilationInfo* info); | 276 explicit HGraph(CompilationInfo* info); |
| 253 | 277 |
| 254 Isolate* isolate() const { return isolate_; } | 278 Isolate* isolate() const { return isolate_; } |
| 255 Zone* zone() const { return zone_; } | 279 Zone* zone() const { return zone_; } |
| 256 CompilationInfo* info() const { return info_; } | 280 CompilationInfo* info() const { return info_; } |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1792 EmbeddedVector<char, 64> filename_; | 1816 EmbeddedVector<char, 64> filename_; |
| 1793 HeapStringAllocator string_allocator_; | 1817 HeapStringAllocator string_allocator_; |
| 1794 StringStream trace_; | 1818 StringStream trace_; |
| 1795 int indent_; | 1819 int indent_; |
| 1796 }; | 1820 }; |
| 1797 | 1821 |
| 1798 | 1822 |
| 1799 } } // namespace v8::internal | 1823 } } // namespace v8::internal |
| 1800 | 1824 |
| 1801 #endif // V8_HYDROGEN_H_ | 1825 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |