Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 6094dbb94774edecd4f37dc833dc4b46e23c1893..55d0c1b4b836715780ff0c946a9f142601f3de91 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -2036,10 +2036,19 @@ LInstruction* LChunkBuilder::DoTransitionElementsKind( |
LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
bool needs_write_barrier = instr->NeedsWriteBarrier(); |
- |
- LOperand* obj = needs_write_barrier |
- ? UseTempRegister(instr->object()) |
- : UseRegisterAtStart(instr->object()); |
+ bool needs_write_barrier_for_map = !instr->transition().is_null() && |
+ instr->NeedsWriteBarrierForMap(); |
+ |
+ LOperand* obj; |
+ if (needs_write_barrier) { |
+ obj = instr->is_in_object() |
+ ? UseRegister(instr->object()) |
+ : UseTempRegister(instr->object()); |
+ } else { |
+ obj = needs_write_barrier_for_map |
+ ? UseRegister(instr->object()) |
+ : UseRegisterAtStart(instr->object()); |
+ } |
LOperand* val = needs_write_barrier |
? UseTempRegister(instr->value()) |
@@ -2047,8 +2056,8 @@ 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 = (!instr->is_in_object() || needs_write_barrier) |
- ? TempRegister() : NULL; |
+ LOperand* temp = (!instr->is_in_object() || needs_write_barrier || |
+ needs_write_barrier_for_map) ? TempRegister() : NULL; |
return new(zone()) LStoreNamedField(obj, val, temp); |
} |