summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2018-04-19 05:32:07 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-04-19 05:32:07 +0000
commitcee49280366af9aa35e889e90d0ae0e90b453a22 (patch)
tree6b0b08d809291da44d9fdd368e4d6c5d9e4ce25e /compiler/optimizing
parentb8b38900bef869495afe63458f04c85ef9d5aae7 (diff)
parent080820c8e7a25bc3fb28d7c5a1524b0e5537c7a9 (diff)
Merge "Revert "Deopt does not throw""
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/nodes.cc9
-rw-r--r--compiler/optimizing/nodes.h7
2 files changed, 12 insertions, 4 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 79bb70b9aa..f784f8f7f3 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1916,6 +1916,15 @@ const HTryBoundary* HBasicBlock::ComputeTryEntryOfSuccessors() const {
}
}
+bool HBasicBlock::HasThrowingInstructions() const {
+ for (HInstructionIterator it(GetInstructions()); !it.Done(); it.Advance()) {
+ if (it.Current()->CanThrow()) {
+ return true;
+ }
+ }
+ return false;
+}
+
static bool HasOnlyOneInstruction(const HBasicBlock& block) {
return block.GetPhis().IsEmpty()
&& !block.GetInstructions().IsEmpty()
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index b315c81693..79d733060b 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -1272,6 +1272,8 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> {
// the appropriate try entry will be returned.
const HTryBoundary* ComputeTryEntryOfSuccessors() const;
+ bool HasThrowingInstructions() const;
+
// Returns whether this block dominates the blocked passed as parameter.
bool Dominates(HBasicBlock* block) const;
@@ -2130,7 +2132,6 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> {
!CanThrow() &&
!IsSuspendCheck() &&
!IsControlFlow() &&
- !IsDeoptimize() &&
!IsNativeDebugInfo() &&
!IsParameterValue() &&
// If we added an explicit barrier then we should keep it.
@@ -3237,9 +3238,7 @@ class HDeoptimize FINAL : public HVariableInputSizeInstruction {
bool NeedsEnvironment() const OVERRIDE { return true; }
- // Even though deoptimize is often used for "exceptional cases" to go back to
- // the interpreter, it never throws an exception.
- bool CanThrow() const OVERRIDE { return false; }
+ bool CanThrow() const OVERRIDE { return true; }
DeoptimizationKind GetDeoptimizationKind() const { return GetPackedField<DeoptimizeKindField>(); }