Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index ca093ec6512e6d0b4337d91efc8725270cb06286..12c9fa3afb4140208eb7d9a6cc6740161e158159 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -3572,18 +3572,25 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
ElementsKind to_kind = to_map->elements_kind(); |
Label not_applicable; |
+ bool is_simple_map_transition = |
+ IsSimpleMapChangeTransition(from_kind, to_kind); |
+ Label::Distance branch_distance = |
+ is_simple_map_transition ? Label::kNear : Label::kFar; |
__ cmp(FieldOperand(object_reg, HeapObject::kMapOffset), from_map); |
- __ j(not_equal, ¬_applicable); |
- __ mov(new_map_reg, to_map); |
- if (IsSimpleMapChangeTransition(from_kind, to_kind)) { |
+ __ j(not_equal, ¬_applicable, branch_distance); |
+ if (is_simple_map_transition) { |
Register object_reg = ToRegister(instr->object()); |
- __ mov(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg); |
+ Handle<Map> map = instr->hydrogen()->transitioned_map(); |
+ __ mov(FieldOperand(object_reg, HeapObject::kMapOffset), |
+ Immediate(map)); |
// Write barrier. |
ASSERT_NE(instr->temp_reg(), NULL); |
- __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, |
- ToRegister(instr->temp_reg()), kDontSaveFPRegs); |
+ __ RecordWriteForMap(object_reg, to_map, new_map_reg, |
+ ToRegister(instr->temp_reg()), |
+ kDontSaveFPRegs); |
} else if (IsFastSmiElementsKind(from_kind) && |
IsFastDoubleElementsKind(to_kind)) { |
+ __ mov(new_map_reg, to_map); |
Register fixed_object_reg = ToRegister(instr->temp_reg()); |
ASSERT(fixed_object_reg.is(edx)); |
ASSERT(new_map_reg.is(ebx)); |
@@ -3592,6 +3599,7 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
RelocInfo::CODE_TARGET, instr); |
} else if (IsFastDoubleElementsKind(from_kind) && |
IsFastObjectElementsKind(to_kind)) { |
+ __ mov(new_map_reg, to_map); |
Register fixed_object_reg = ToRegister(instr->temp_reg()); |
ASSERT(fixed_object_reg.is(edx)); |
ASSERT(new_map_reg.is(ebx)); |