Index: src/ia32/lithium-ia32.cc |
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc |
index 2980bd4a90ee31d5972d286757a20a9dc581c717..067863d0b0f4d4a1df4a348f11943f5d04c4e3b6 100644 |
--- a/src/ia32/lithium-ia32.cc |
+++ b/src/ia32/lithium-ia32.cc |
@@ -2340,6 +2340,8 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
bool is_external_location = instr->access().IsExternalMemory() && |
instr->access().offset() == 0; |
bool needs_write_barrier = instr->NeedsWriteBarrier(); |
+ bool needs_write_barrier_for_map = instr->has_transition() && |
+ instr->NeedsWriteBarrierForMap(); |
LOperand* obj; |
if (needs_write_barrier) { |
@@ -2349,9 +2351,12 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
} else if (is_external_location) { |
ASSERT(!is_in_object); |
ASSERT(!needs_write_barrier); |
+ ASSERT(!needs_write_barrier_for_map); |
obj = UseRegisterOrConstant(instr->object()); |
} else { |
- obj = UseRegisterAtStart(instr->object()); |
+ obj = needs_write_barrier_for_map |
+ ? UseRegister(instr->object()) |
+ : UseRegisterAtStart(instr->object()); |
} |
bool can_be_constant = instr->value()->IsConstant() && |
@@ -2378,11 +2383,14 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
// We only need a scratch register if we have a write barrier or we |
// have a store into the properties array (not in-object-property). |
- LOperand* temp = (!is_in_object || needs_write_barrier) |
- ? TempRegister() : NULL; |
+ LOperand* temp = (!is_in_object || needs_write_barrier || |
+ needs_write_barrier_for_map) ? TempRegister() : NULL; |
+ |
+ // We need a temporary register for write barrier of the map field. |
+ LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL; |
LInstruction* result = |
- new(zone()) LStoreNamedField(obj, val, temp); |
+ new(zone()) LStoreNamedField(obj, val, temp, temp_map); |
if (!instr->access().IsExternalMemory() && |
instr->field_representation().IsHeapObject() && |
(val->IsConstantOperand() |