| Index: src/codegen-arm.cc
|
| ===================================================================
|
| --- src/codegen-arm.cc (revision 1481)
|
| +++ src/codegen-arm.cc (working copy)
|
| @@ -83,7 +83,6 @@
|
| allocator_(NULL),
|
| cc_reg_(al),
|
| state_(NULL),
|
| - break_stack_height_(0),
|
| function_return_is_shadowed_(false),
|
| in_spilled_code_(false) {
|
| }
|
| @@ -107,8 +106,6 @@
|
| ASSERT(frame_ == NULL);
|
| frame_ = new VirtualFrame(this);
|
| cc_reg_ = al;
|
| - function_return_.Initialize(this, JumpTarget::BIDIRECTIONAL);
|
| - function_return_is_shadowed_ = false;
|
| set_in_spilled_code(false);
|
| {
|
| CodeGenState state(this);
|
| @@ -133,6 +130,10 @@
|
|
|
| // Allocate space for locals and initialize them.
|
| frame_->AllocateStackSlots(scope_->num_stack_slots());
|
| + // Initialize the function return target after the locals are set
|
| + // up, because it needs the expected frame height from the frame.
|
| + function_return_.Initialize(this, JumpTarget::BIDIRECTIONAL);
|
| + function_return_is_shadowed_ = false;
|
|
|
| VirtualFrame::SpilledScope spilled_scope(this);
|
| if (scope_->num_heap_slots() > 0) {
|
| @@ -1127,7 +1128,6 @@
|
| VirtualFrame::SpilledScope spilled_scope(this);
|
| Comment cmnt(masm_, "[ Block");
|
| CodeForStatementPosition(node);
|
| - node->set_break_stack_height(break_stack_height_);
|
| node->break_target()->Initialize(this);
|
| VisitStatementsAndSpill(node->statements());
|
| if (node->break_target()->is_linked()) {
|
| @@ -1341,18 +1341,10 @@
|
| }
|
|
|
|
|
| -void CodeGenerator::CleanStack(int num_bytes) {
|
| - VirtualFrame::SpilledScope spilled_scope(this);
|
| - ASSERT(num_bytes % kPointerSize == 0);
|
| - frame_->Drop(num_bytes / kPointerSize);
|
| -}
|
| -
|
| -
|
| void CodeGenerator::VisitContinueStatement(ContinueStatement* node) {
|
| VirtualFrame::SpilledScope spilled_scope(this);
|
| Comment cmnt(masm_, "[ ContinueStatement");
|
| CodeForStatementPosition(node);
|
| - CleanStack(break_stack_height_ - node->target()->break_stack_height());
|
| node->target()->continue_target()->Jump();
|
| }
|
|
|
| @@ -1361,7 +1353,6 @@
|
| VirtualFrame::SpilledScope spilled_scope(this);
|
| Comment cmnt(masm_, "[ BreakStatement");
|
| CodeForStatementPosition(node);
|
| - CleanStack(break_stack_height_ - node->target()->break_stack_height());
|
| node->target()->break_target()->Jump();
|
| }
|
|
|
| @@ -1521,7 +1512,6 @@
|
| VirtualFrame::SpilledScope spilled_scope(this);
|
| Comment cmnt(masm_, "[ SwitchStatement");
|
| CodeForStatementPosition(node);
|
| - node->set_break_stack_height(break_stack_height_);
|
| node->break_target()->Initialize(this);
|
|
|
| LoadAndSpill(node->tag());
|
| @@ -1615,7 +1605,6 @@
|
| VirtualFrame::SpilledScope spilled_scope(this);
|
| Comment cmnt(masm_, "[ LoopStatement");
|
| CodeForStatementPosition(node);
|
| - node->set_break_stack_height(break_stack_height_);
|
| node->break_target()->Initialize(this);
|
|
|
| // Simple condition analysis. ALWAYS_TRUE and ALWAYS_FALSE represent a
|
| @@ -1805,15 +1794,6 @@
|
| Comment cmnt(masm_, "[ ForInStatement");
|
| CodeForStatementPosition(node);
|
|
|
| - // We keep stuff on the stack while the body is executing.
|
| - // Record it, so that a break/continue crossing this statement
|
| - // can restore the stack.
|
| - const int kForInStackSize = 5 * kPointerSize;
|
| - break_stack_height_ += kForInStackSize;
|
| - node->set_break_stack_height(break_stack_height_);
|
| - node->break_target()->Initialize(this);
|
| - node->continue_target()->Initialize(this);
|
| -
|
| JumpTarget primitive(this);
|
| JumpTarget jsobject(this);
|
| JumpTarget fixed_array(this);
|
| @@ -1902,6 +1882,11 @@
|
| // sp[2] : array or enum cache
|
| // sp[3] : 0 or map
|
| // sp[4] : enumerable
|
| + // Grab the current frame's height for the break and continue
|
| + // targets only after all the state is pushed on the frame.
|
| + node->break_target()->Initialize(this);
|
| + node->continue_target()->Initialize(this);
|
| +
|
| __ ldr(r0, frame_->ElementAt(0)); // load the current count
|
| __ ldr(r1, frame_->ElementAt(1)); // load the length
|
| __ cmp(r0, Operand(r1)); // compare to the array length
|
| @@ -1986,7 +1971,6 @@
|
|
|
| // Exit.
|
| exit.Bind();
|
| - break_stack_height_ -= kForInStackSize;
|
| ASSERT(frame_->height() == original_height);
|
| }
|
|
|
| @@ -2259,16 +2243,11 @@
|
| frame_->EmitPush(r2);
|
|
|
| // We keep two elements on the stack - the (possibly faked) result
|
| - // and the state - while evaluating the finally block. Record it, so
|
| - // that a break/continue crossing this statement can restore the
|
| - // stack.
|
| - const int kFinallyStackSize = 2 * kPointerSize;
|
| - break_stack_height_ += kFinallyStackSize;
|
| -
|
| + // and the state - while evaluating the finally block.
|
| + //
|
| // Generate code for the statements in the finally block.
|
| VisitStatementsAndSpill(node->finally_block()->statements());
|
|
|
| - break_stack_height_ -= kFinallyStackSize;
|
| if (has_valid_frame()) {
|
| JumpTarget exit(this);
|
| // Restore state and return value or faked TOS.
|
|
|