OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_COMPILER_LIVENESS_ANAYZER_H_ | 5 #ifndef V8_COMPILER_LIVENESS_ANAYZER_H_ |
6 #define V8_COMPILER_LIVENESS_ANAYZER_H_ | 6 #define V8_COMPILER_LIVENESS_ANAYZER_H_ |
7 | 7 |
8 #include "src/bit-vector.h" | 8 #include "src/bit-vector.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 | 79 |
80 class LivenessAnalyzerBlock { | 80 class LivenessAnalyzerBlock { |
81 public: | 81 public: |
82 friend class LivenessAnalyzer; | 82 friend class LivenessAnalyzer; |
83 | 83 |
84 void Lookup(int var) { entries_.push_back(Entry(Entry::kLookup, var)); } | 84 void Lookup(int var) { entries_.push_back(Entry(Entry::kLookup, var)); } |
85 void Bind(int var) { entries_.push_back(Entry(Entry::kBind, var)); } | 85 void Bind(int var) { entries_.push_back(Entry(Entry::kBind, var)); } |
86 void Checkpoint(Node* node) { entries_.push_back(Entry(node)); } | 86 void Checkpoint(Node* node) { entries_.push_back(Entry(node)); } |
87 void AddPredecessor(LivenessAnalyzerBlock* b) { predecessors_.push_back(b); } | 87 void AddPredecessor(LivenessAnalyzerBlock* b) { predecessors_.push_back(b); } |
| 88 LivenessAnalyzerBlock* GetPredecessor() { |
| 89 DCHECK(predecessors_.size() == 1); |
| 90 return predecessors_[0]; |
| 91 } |
88 | 92 |
89 private: | 93 private: |
90 class Entry { | 94 class Entry { |
91 public: | 95 public: |
92 enum Kind { kBind, kLookup, kCheckpoint }; | 96 enum Kind { kBind, kLookup, kCheckpoint }; |
93 | 97 |
94 Kind kind() const { return kind_; } | 98 Kind kind() const { return kind_; } |
95 Node* node() const { | 99 Node* node() const { |
96 DCHECK(kind() == kCheckpoint); | 100 DCHECK(kind() == kCheckpoint); |
97 return node_; | 101 return node_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 141 |
138 size_t id_; | 142 size_t id_; |
139 }; | 143 }; |
140 | 144 |
141 | 145 |
142 } // namespace compiler | 146 } // namespace compiler |
143 } // namespace internal | 147 } // namespace internal |
144 } // namespace v8 | 148 } // namespace v8 |
145 | 149 |
146 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 150 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |