| Index: src/arm/virtual-frame-arm.cc
|
| ===================================================================
|
| --- src/arm/virtual-frame-arm.cc (revision 4640)
|
| +++ src/arm/virtual-frame-arm.cc (working copy)
|
| @@ -72,8 +72,15 @@
|
|
|
| void VirtualFrame::MergeTo(VirtualFrame* expected) {
|
| if (Equals(expected)) return;
|
| + MergeTOSTo(expected->top_of_stack_state_);
|
| + ASSERT(register_allocation_map_ == expected->register_allocation_map_);
|
| +}
|
| +
|
| +
|
| +void VirtualFrame::MergeTOSTo(
|
| + VirtualFrame::TopOfStack expected_top_of_stack_state) {
|
| #define CASE_NUMBER(a, b) ((a) * TOS_STATES + (b))
|
| - switch (CASE_NUMBER(top_of_stack_state_, expected->top_of_stack_state_)) {
|
| + switch (CASE_NUMBER(top_of_stack_state_, expected_top_of_stack_state)) {
|
| case CASE_NUMBER(NO_TOS_REGISTERS, NO_TOS_REGISTERS):
|
| break;
|
| case CASE_NUMBER(NO_TOS_REGISTERS, R0_TOS):
|
| @@ -154,7 +161,7 @@
|
| UNREACHABLE();
|
| #undef CASE_NUMBER
|
| }
|
| - ASSERT(register_allocation_map_ == expected->register_allocation_map_);
|
| + top_of_stack_state_ = expected_top_of_stack_state;
|
| }
|
|
|
|
|
| @@ -627,6 +634,40 @@
|
| }
|
|
|
|
|
| +void VirtualFrame::OverwriteStackPosition(Register reg, int this_far_down) {
|
| + int virtual_elements = kVirtualElements[top_of_stack_state_];
|
| + if (this_far_down == 0) {
|
| + Pop();
|
| + Register dest = GetTOSRegister();
|
| + if (dest.is(reg)) {
|
| + // We already popped one item off the top of the stack. If the only
|
| + // free register is the one we were asked to push then we have been
|
| + // asked to push a register that was already in use, which cannot
|
| + // happen. It therefore folows that there are two free TOS registers:
|
| + ASSERT(top_of_stack_state_ == NO_TOS_REGISTERS);
|
| + dest = dest.is(r0) ? r1 : r0;
|
| + }
|
| + __ mov(dest, reg);
|
| + EmitPush(dest);
|
| + } else if (this_far_down == 1) {
|
| + int virtual_elements = kVirtualElements[top_of_stack_state_];
|
| + if (virtual_elements < 2) {
|
| + __ str(reg, ElementAt(this_far_down));
|
| + } else {
|
| + ASSERT(virtual_elements == 2);
|
| + ASSERT(!reg.is(r0));
|
| + ASSERT(!reg.is(r1));
|
| + Register dest = kBottomRegister[top_of_stack_state_];
|
| + __ mov(dest, reg);
|
| + }
|
| + } else {
|
| + ASSERT(this_far_down >= 2);
|
| + ASSERT(virtual_elements <= 2);
|
| + __ str(reg, ElementAt(this_far_down));
|
| + }
|
| +}
|
| +
|
| +
|
| Register VirtualFrame::GetTOSRegister() {
|
| if (SpilledScope::is_spilled()) return r0;
|
|
|
|
|