From 10f56cb6b4e39ed0032e9a23b179b557463e65ad Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Tue, 24 Mar 2015 18:49:14 +0000 Subject: ART: Fix crash in gtests SsaLivenessAnalysis was crashing after change of iteration order in 142377 because gtests do not always build reverse post order. Change-Id: If5ad5b7c52040b119c4415f0b942988049fa3c16 --- compiler/optimizing/nodes.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 97ade0dc62..db7873b14e 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -3483,7 +3483,10 @@ class HInsertionOrderIterator : public ValueObject { class HReversePostOrderIterator : public ValueObject { public: - explicit HReversePostOrderIterator(const HGraph& graph) : graph_(graph), index_(0) {} + explicit HReversePostOrderIterator(const HGraph& graph) : graph_(graph), index_(0) { + // Check that reverse post order of the graph has been built. + DCHECK(!graph.GetReversePostOrder().IsEmpty()); + } bool Done() const { return index_ == graph_.GetReversePostOrder().Size(); } HBasicBlock* Current() const { return graph_.GetReversePostOrder().Get(index_); } @@ -3499,7 +3502,10 @@ class HReversePostOrderIterator : public ValueObject { class HPostOrderIterator : public ValueObject { public: explicit HPostOrderIterator(const HGraph& graph) - : graph_(graph), index_(graph_.GetReversePostOrder().Size()) {} + : graph_(graph), index_(graph_.GetReversePostOrder().Size()) { + // Check that reverse post order of the graph has been built. + DCHECK(!graph.GetReversePostOrder().IsEmpty()); + } bool Done() const { return index_ == 0; } HBasicBlock* Current() const { return graph_.GetReversePostOrder().Get(index_ - 1); } -- cgit v1.2.3-59-g8ed1b