Index: src/full-codegen.cc |
diff --git a/src/full-codegen.cc b/src/full-codegen.cc |
index 4eb10c7431dfd3e29045296a5f4517e6bcf2d119..7509628eb5d0be7b273d25cb8442027df42ea2c2 100644 |
--- a/src/full-codegen.cc |
+++ b/src/full-codegen.cc |
@@ -946,6 +946,11 @@ void FullCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { |
SetStatementPosition(stmt); |
NestedStatement* current = nesting_stack_; |
int stack_depth = 0; |
+ // When continuing, we clobber the unpredictable value in the accumulator |
+ // with one that's safe for GC. If we hit an exit from the try block of |
+ // try...finally on our way out, we will unconditionally preserve the |
+ // accumulator on the stack. |
+ ClearAccumulator(); |
while (!current->IsContinueTarget(stmt->target())) { |
stack_depth = current->Exit(stack_depth); |
current = current->outer(); |
@@ -962,6 +967,11 @@ void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { |
SetStatementPosition(stmt); |
NestedStatement* current = nesting_stack_; |
int stack_depth = 0; |
+ // When breaking, we clobber the unpredictable value in the accumulator |
+ // with one that's safe for GC. If we hit an exit from the try block of |
+ // try...finally on our way out, we will unconditionally preserve the |
+ // accumulator on the stack. |
+ ClearAccumulator(); |
while (!current->IsBreakTarget(stmt->target())) { |
stack_depth = current->Exit(stack_depth); |
current = current->outer(); |
@@ -1235,7 +1245,10 @@ void FullCodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* stmt) { |
Visit(stmt->try_block()); |
__ PopTryHandler(); |
} |
- // Execute the finally block on the way out. |
+ // Execute the finally block on the way out. Clobber the unpredictable |
+ // value in the accumulator with one that's safe for GC. The finally |
+ // block will unconditionally preserve the accumulator on the stack. |
+ ClearAccumulator(); |
__ Call(&finally_entry); |
} |