Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: src/codegen-ia32.cc

Issue 5625: Fix issue 86 by keeping track of the fact that finally blocks... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codegen-arm.cc ('k') | test/mjsunit/bugs/bug-86.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 399)
+++ src/codegen-ia32.cc (working copy)
@@ -3492,7 +3492,7 @@
__ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER);
// TODO(1222589): remove the reliance of PushTryHandler on a cached TOS
- __ push(eax); //
+ __ push(eax);
// Introduce shadow labels for all escapes from the try block,
// including returns. We should probably try to unify the escaping
@@ -3558,6 +3558,12 @@
// --- Finally block ---
__ bind(&finally_block);
+ // We keep a single element on the stack - the (possibly faked)
+ // result - while evaluating the finally block. Record it, so that a
+ // break/continue crossing this statement can restore the stack.
+ const int kFinallyStackSize = 1 * kPointerSize;
+ break_stack_height_ += kFinallyStackSize;
+
// Push the state on the stack. If necessary move the state to a
// local variable to avoid having extra values on the stack while
// evaluating the finally block.
@@ -3583,6 +3589,9 @@
// Restore return value or faked TOS.
__ pop(eax);
+ // Record the fact that the result has been removed from the stack.
+ break_stack_height_ -= kFinallyStackSize;
+
// Generate code that jumps to the right destination for all used
// shadow labels.
for (int i = 0; i <= nof_escapes; i++) {
« no previous file with comments | « src/codegen-arm.cc ('k') | test/mjsunit/bugs/bug-86.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698