Chromium Code Reviews| Index: src/hydrogen.h |
| diff --git a/src/hydrogen.h b/src/hydrogen.h |
| index 0d5f5c9cfd9ae9b7befa09888acb2661e1dedd8b..1926784e2a31e76af3f350549fd0b83219f95cb4 100644 |
| --- a/src/hydrogen.h |
| +++ b/src/hydrogen.h |
| @@ -69,6 +69,11 @@ class HBasicBlock: public ZoneObject { |
| HInstruction* GetLastInstruction(); |
| HControlInstruction* end() const { return end_; } |
| HLoopInformation* loop_information() const { return loop_information_; } |
| + HLoopInformation* current_loop() const { |
| + return IsLoopHeader() ? loop_information() |
| + : (parent_loop_header() != NULL |
| + ? parent_loop_header()->loop_information() : NULL); |
| + } |
| const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| bool HasPredecessor() const { return predecessors_.length() > 0; } |
| const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| @@ -221,7 +226,8 @@ class HLoopInformation: public ZoneObject { |
| : back_edges_(4, zone), |
| loop_header_(loop_header), |
| blocks_(8, zone), |
| - stack_check_(NULL) { |
| + stack_check_(NULL), |
| + exits_count_(0) { |
| blocks_.Add(loop_header, zone); |
| } |
| virtual ~HLoopInformation() {} |
| @@ -237,6 +243,23 @@ class HLoopInformation: public ZoneObject { |
| stack_check_ = stack_check; |
| } |
| + int exits_count() { return exits_count_; } |
| + HLoopInformation* parent_loop() { |
| + HBasicBlock* parent_header = loop_header()->parent_loop_header(); |
| + return parent_header != NULL ? parent_header->loop_information() : NULL; |
| + } |
| + 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.
|
| + while (other != NULL) { |
| + if (other == this) { |
| + return true; |
| + } |
| + other = other->parent_loop(); |
| + } |
| + return false; |
| + } |
| + void ProcessEdge(HBasicBlock* destination); |
| + void ProcessThrow(); |
| + |
| private: |
| void AddBlock(HBasicBlock* block); |
| @@ -244,6 +267,7 @@ class HLoopInformation: public ZoneObject { |
| HBasicBlock* loop_header_; |
| ZoneList<HBasicBlock*> blocks_; |
| HStackCheck* stack_check_; |
| + int exits_count_; |
| }; |
| class BoundsCheckTable; |