summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 348026551e..4345d55e90 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1129,6 +1129,14 @@ std::ostream& operator<<(std::ostream& os, const HInstruction::InstructionKind&
}
void HInstruction::MoveBefore(HInstruction* cursor) {
+ if (kIsDebugBuild && CanThrowIntoCatchBlock()) {
+ // Make sure we are not moving a throwing instruction out of its try block.
+ DCHECK(cursor->GetBlock()->IsTryBlock());
+ const HTryBoundary& current_try = block_->GetTryCatchInformation()->GetTryEntry();
+ const HTryBoundary& cursor_try = cursor->GetBlock()->GetTryCatchInformation()->GetTryEntry();
+ DCHECK(cursor_try.HasSameExceptionHandlersAs(current_try));
+ }
+
next_->previous_ = previous_;
if (previous_ != nullptr) {
previous_->next_ = next_;