Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 70ef8848167c3393c95542f6b31d5e6fc92bb9e2..24da839ab8f0d061c778e6710833d0a93f485759 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3487,6 +3487,48 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
} |
+void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
+ Register object_reg = ToRegister(instr->object()); |
+ Register new_map_reg = ToRegister(instr->new_map_reg()); |
+ Register scratch = scratch0(); |
+ |
+ Handle<Map> from_map = instr->original_map(); |
+ Handle<Map> to_map = instr->transitioned_map(); |
+ ElementsKind from_kind = from_map->elements_kind(); |
+ ElementsKind to_kind = to_map->elements_kind(); |
+ |
+ Label not_applicable; |
+ __ ldr(scratch, FieldMemOperand(object_reg, HeapObject::kMapOffset)); |
+ __ cmp(scratch, Operand(from_map)); |
+ __ b(ne, ¬_applicable); |
+ __ mov(new_map_reg, Operand(to_map)); |
+ if (from_kind == FAST_SMI_ONLY_ELEMENTS && to_kind == FAST_ELEMENTS) { |
+ __ str(new_map_reg, FieldMemOperand(object_reg, HeapObject::kMapOffset)); |
+ // Write barrier. |
+ __ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg, |
+ scratch, kLRHasBeenSaved, kDontSaveFPRegs); |
+ } else if (from_kind == FAST_SMI_ONLY_ELEMENTS && |
+ to_kind == FAST_DOUBLE_ELEMENTS) { |
+ Register fixed_object_reg = ToRegister(instr->temp_reg()); |
+ ASSERT(fixed_object_reg.is(r2)); |
+ ASSERT(new_map_reg.is(r3)); |
+ __ mov(fixed_object_reg, object_reg); |
+ CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(), |
+ RelocInfo::CODE_TARGET, instr); |
+ } else if (from_kind == FAST_DOUBLE_ELEMENTS && to_kind == FAST_ELEMENTS) { |
+ Register fixed_object_reg = ToRegister(instr->temp_reg()); |
+ ASSERT(fixed_object_reg.is(r2)); |
+ ASSERT(new_map_reg.is(r3)); |
+ __ mov(fixed_object_reg, object_reg); |
+ CallCode(isolate()->builtins()->TransitionElementsDoubleToObject(), |
+ RelocInfo::CODE_TARGET, instr); |
+ } else { |
+ UNREACHABLE(); |
+ } |
+ __ bind(¬_applicable); |
+} |
+ |
+ |
void LCodeGen::DoStringAdd(LStringAdd* instr) { |
__ push(ToRegister(instr->left())); |
__ push(ToRegister(instr->right())); |