Index: src/codegen-arm.cc |
=================================================================== |
--- src/codegen-arm.cc (revision 547) |
+++ src/codegen-arm.cc (working copy) |
@@ -1634,9 +1634,13 @@ |
__ PushTryHandler(IN_JAVASCRIPT, TRY_CATCH_HANDLER); |
- // Introduce shadow labels for all escapes from the try block, |
- // including returns. We should probably try to unify the escaping |
- // labels and the return label. |
+ // Shadow the labels for all escapes from the try block, including |
+ // returns. During shadowing, the origianl label is hidden as the |
iposva
2008/10/22 18:34:33
origianl -> original
|
+ // LabelShadow and operations on the original actually affect the |
+ // shadowing label. |
+ // |
+ // We should probably try to unify the escaping labels and the return |
+ // label. |
int nof_escapes = node->escaping_labels()->length(); |
List<LabelShadow*> shadows(1 + nof_escapes); |
shadows.Add(new LabelShadow(&function_return_)); |
@@ -1649,6 +1653,8 @@ |
__ pop(r0); // Discard the result. |
// Stop the introduced shadowing and count the number of required unlinks. |
+ // After shadowing stops, the original labels are unshadowed and the |
+ // LabelShadows represent the formerly shadowing labels. |
int nof_unlinks = 0; |
for (int i = 0; i <= nof_escapes; i++) { |
shadows[i]->StopShadowing(); |
@@ -1667,7 +1673,8 @@ |
// Code slot popped. |
if (nof_unlinks > 0) __ b(&exit); |
- // Generate unlink code for all used shadow labels. |
+ // Generate unlink code for the (formerly) shadowing labels that have been |
+ // jumped to. |
for (int i = 0; i <= nof_escapes; i++) { |
if (shadows[i]->is_linked()) { |
// Unlink from try chain; |
@@ -1684,7 +1691,7 @@ |
__ add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); |
// Code slot popped. |
- __ b(shadows[i]->shadowed()); |
+ __ b(shadows[i]->original_label()); |
} |
} |
@@ -1715,9 +1722,12 @@ |
__ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER); |
- // Introduce shadow labels for all escapes from the try block, |
- // including returns. We should probably try to unify the escaping |
- // labels and the return label. |
+ // Shadow the labels for all escapes from the try block, including |
+ // returns. Shadowing hides the original label as the LabelShadow and |
+ // operations on the original actually affect the shadowing label. |
+ // |
+ // We should probably try to unify the escaping labels and the return |
+ // label. |
int nof_escapes = node->escaping_labels()->length(); |
List<LabelShadow*> shadows(1 + nof_escapes); |
shadows.Add(new LabelShadow(&function_return_)); |
@@ -1728,8 +1738,9 @@ |
// Generate code for the statements in the try block. |
VisitStatements(node->try_block()->statements()); |
- // Stop the introduced shadowing and count the number of required |
- // unlinks. |
+ // Stop the introduced shadowing and count the number of required unlinks. |
+ // After shadowing stops, the original labels are unshadowed and the |
+ // LabelShadows represent the formerly shadowing labels. |
int nof_unlinks = 0; |
for (int i = 0; i <= nof_escapes; i++) { |
shadows[i]->StopShadowing(); |
@@ -1742,14 +1753,17 @@ |
__ mov(r2, Operand(Smi::FromInt(FALLING))); |
if (nof_unlinks > 0) __ b(&unlink); |
- // Generate code that sets the state for all used shadow labels. |
+ // Generate code to set the state for the (formerly) shadowing labels that |
+ // have been jumped to. |
for (int i = 0; i <= nof_escapes; i++) { |
if (shadows[i]->is_linked()) { |
__ bind(shadows[i]); |
- if (shadows[i]->shadowed() == &function_return_) { |
- __ push(r0); // Materialize the return value on the stack |
+ if (shadows[i]->original_label() == &function_return_) { |
+ // If this label shadowed the function return, materialize the |
+ // return value on the stack. |
+ __ push(r0); |
} else { |
- // Fake TOS for break and continue (not return). |
+ // Fake TOS for labels that shadowed breaks and continues. |
__ mov(r0, Operand(Factory::undefined_value())); |
__ push(r0); |
} |
@@ -1796,18 +1810,18 @@ |
__ pop(r0); |
break_stack_height_ -= kFinallyStackSize; |
- // Generate code that jumps to the right destination for all used |
- // shadow labels. |
+ // Generate code to jump to the right destination for all used (formerly) |
+ // shadowing labels. |
for (int i = 0; i <= nof_escapes; i++) { |
if (shadows[i]->is_bound()) { |
__ cmp(r2, Operand(Smi::FromInt(JUMPING + i))); |
- if (shadows[i]->shadowed() != &function_return_) { |
+ if (shadows[i]->original_label() != &function_return_) { |
Label next; |
__ b(ne, &next); |
- __ b(shadows[i]->shadowed()); |
+ __ b(shadows[i]->original_label()); |
__ bind(&next); |
} else { |
- __ b(eq, shadows[i]->shadowed()); |
+ __ b(eq, shadows[i]->original_label()); |
} |
} |
} |