Index: src/mips/lithium-mips.cc |
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc |
index 49a462ae15be05a01faf2323605ed9bb529743cc..d0f86cd9e184f6af113441bfdae9aae5c55766e1 100644 |
--- a/src/mips/lithium-mips.cc |
+++ b/src/mips/lithium-mips.cc |
@@ -2046,16 +2046,28 @@ 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()) |
: UseRegister(instr->value()); |
- return new(zone()) LStoreNamedField(obj, val); |
+ // We need a temporary register for write barrier of the map field. |
+ LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL; |
+ |
+ return new(zone()) LStoreNamedField(obj, val, temp); |
} |