From 93a18c5d4160f632ecdb92af099574e9c7098c49 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 22 Apr 2016 13:16:14 +0100 Subject: Forbid HDeoptimize instructions in OSR methods. Otherwise dominated instructions will assume something that isn't necessarily correct if coming from the interpreter. bug:28335959 bug:28249238 bug:28348878 bug:28080135 Change-Id: I842bd1c6a919aff48cf6048d2ea51cf2d40f3c1d --- compiler/optimizing/bounds_check_elimination.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/bounds_check_elimination.cc') diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc index 659c6f8497..b65e98a120 100644 --- a/compiler/optimizing/bounds_check_elimination.cc +++ b/compiler/optimizing/bounds_check_elimination.cc @@ -552,7 +552,11 @@ class BCEVisitor : public HGraphVisitor { DCHECK(!IsAddedBlock(block)); first_index_bounds_check_map_.clear(); HGraphVisitor::VisitBasicBlock(block); - AddComparesWithDeoptimization(block); + // We should never deoptimize from an osr method, otherwise we might wrongly optimize + // code dominated by the deoptimization. + if (!GetGraph()->IsCompilingOsr()) { + AddComparesWithDeoptimization(block); + } } void Finish() { @@ -1358,6 +1362,11 @@ class BCEVisitor : public HGraphVisitor { if (loop->IsIrreducible()) { return false; } + // We should never deoptimize from an osr method, otherwise we might wrongly optimize + // code dominated by the deoptimization. + if (GetGraph()->IsCompilingOsr()) { + return false; + } // A try boundary preheader is hard to handle. // TODO: remove this restriction. if (loop->GetPreHeader()->GetLastInstruction()->IsTryBoundary()) { -- cgit v1.2.3-59-g8ed1b