[turbofan] Robustify the GraphTrimmer.
The GraphTrimmer should not ever see a dead node, except for the roots that are explicitly fed into it. To defend against this, turn the condition into a DCHECK. R=jarin@chromium.org Review URL: https://codereview.chromium.org/1698883003 Cr-Commit-Position: refs/heads/master@{#34001}
This commit is contained in:
parent
73eae4c26a
commit
86d1b7e83d
@ -24,7 +24,8 @@ void GraphTrimmer::TrimGraph() {
|
||||
MarkAsLive(graph()->end());
|
||||
// Compute transitive closure of live nodes.
|
||||
for (size_t i = 0; i < live_.size(); ++i) {
|
||||
for (Node* const input : live_[i]->inputs()) MarkAsLive(input);
|
||||
Node* const live = live_[i];
|
||||
for (Node* const input : live->inputs()) MarkAsLive(input);
|
||||
}
|
||||
// Remove dead->live edges.
|
||||
for (Node* const live : live_) {
|
||||
|
@ -28,14 +28,18 @@ class GraphTrimmer final {
|
||||
// or any of the roots in the sequence [{begin},{end}[.
|
||||
template <typename ForwardIterator>
|
||||
void TrimGraph(ForwardIterator begin, ForwardIterator end) {
|
||||
while (begin != end) MarkAsLive(*begin++);
|
||||
while (begin != end) {
|
||||
Node* const node = *begin++;
|
||||
if (!node->IsDead()) MarkAsLive(node);
|
||||
}
|
||||
TrimGraph();
|
||||
}
|
||||
|
||||
private:
|
||||
V8_INLINE bool IsLive(Node* const node) { return is_live_.Get(node); }
|
||||
V8_INLINE void MarkAsLive(Node* const node) {
|
||||
if (!node->IsDead() && !IsLive(node)) {
|
||||
DCHECK(!node->IsDead());
|
||||
if (!IsLive(node)) {
|
||||
is_live_.Set(node, true);
|
||||
live_.push_back(node);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user