Index: src/virtual-frame-ia32.cc |
=================================================================== |
--- src/virtual-frame-ia32.cc (revision 1589) |
+++ src/virtual-frame-ia32.cc (working copy) |
@@ -51,6 +51,9 @@ |
for (int i = 0; i < parameter_count_ + 2; i++) { |
elements_.Add(FrameElement::MemoryElement()); |
} |
+ for (int i = 0; i < kNumRegisters; i++) { |
+ register_locations_[i] = kIllegalIndex; |
+ } |
} |
@@ -325,7 +328,7 @@ |
if (target.is_synced() && !source.is_synced()) { |
SyncElementAt(i); |
} |
- Use(target.reg()); |
+ Use(target.reg(), i); |
Unuse(source.reg()); |
elements_[i] = target; |
__ mov(target.reg(), source.reg()); |
@@ -388,7 +391,7 @@ |
if (target.is_synced() && !source.is_memory()) { |
SyncElementAt(i); |
} |
- Use(target.reg()); |
+ Use(target.reg(), i); |
elements_[i] = target; |
} |
} |
@@ -527,12 +530,13 @@ |
if (original.is_memory()) { |
Result fresh = cgen_->allocator()->Allocate(); |
ASSERT(fresh.is_valid()); |
- Use(fresh.reg()); |
+ Use(fresh.reg(), new_backing_index); |
backing_reg = fresh.reg(); |
__ mov(backing_reg, Operand(ebp, fp_relative(index))); |
} else { |
// The original was in a register. |
backing_reg = original.reg(); |
+ register_locations_[backing_reg.code()] = new_backing_index; |
} |
if (elements_[new_backing_index].is_synced()) { |
elements_[new_backing_index] = |
@@ -571,13 +575,13 @@ |
FrameElement new_element = |
FrameElement::RegisterElement(fresh.reg(), |
FrameElement::NOT_SYNCED); |
- Use(fresh.reg()); |
+ Use(fresh.reg(), elements_.length()); |
elements_.Add(new_element); |
__ mov(fresh.reg(), Operand(ebp, fp_relative(index))); |
break; |
} |
case FrameElement::REGISTER: |
- Use(original.reg()); |
+ Use(original.reg(), elements_.length()); |
// Fall through. |
case FrameElement::CONSTANT: |
case FrameElement::COPY: |
@@ -638,11 +642,14 @@ |
ASSERT(temp.is_valid()); |
__ mov(temp.reg(), Operand(ebp, fp_relative(backing_index))); |
__ mov(Operand(ebp, fp_relative(index)), temp.reg()); |
- } else if (backing_element.is_synced()) { |
- // If the element is a register, we will not actually move |
- // anything on the stack but only update the virtual frame |
- // element. |
- backing_element.clear_sync(); |
+ } else { |
+ register_locations_[backing_element.reg().code()] = index; |
+ if (backing_element.is_synced()) { |
+ // If the element is a register, we will not actually move |
+ // anything on the stack but only update the virtual frame |
+ // element. |
+ backing_element.clear_sync(); |
+ } |
} |
elements_[index] = backing_element; |
@@ -683,6 +690,7 @@ |
__ mov(temp.reg(), Operand(esp, 0)); |
__ mov(Operand(ebp, fp_relative(index)), temp.reg()); |
} else if (top.is_register()) { |
+ register_locations_[top.reg().code()] = index; |
// The stored-to slot has the (unsynced) register reference and |
// the top element becomes a copy. The sync state of the top is |
// preserved. |
@@ -889,7 +897,7 @@ |
ASSERT(index <= stack_pointer_); |
Result temp = cgen_->allocator()->Allocate(); |
ASSERT(temp.is_valid()); |
- Use(temp.reg()); |
+ Use(temp.reg(), index); |
FrameElement new_element = |
FrameElement::RegisterElement(temp.reg(), FrameElement::SYNCED); |
elements_[index] = new_element; |