Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index 22970e4ecad5214cc474d02b23285cecb8f28743..c92b94381791b44f86d0b1cebb03e3ab9a2ce2ac 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -2879,27 +2879,42 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
} |
-void MacroAssembler::LoadGlobalInitialConstructedArrayMap( |
+void MacroAssembler::LoadTransitionedArrayMapConditional( |
+ ElementsKind expected_kind, |
+ ElementsKind transitioned_kind, |
+ Register map_in_out, |
+ Register scratch, |
+ Label* no_map_match) { |
+ // Load the global or builtins object from the current context. |
+ ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
+ ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
+ |
+ // Check that the function's map is the same as the expected cached map. |
+ int expected_index = |
+ Context::GetContextMapIndexFromElementsKind(expected_kind); |
+ ldr(ip, MemOperand(scratch, Context::SlotOffset(expected_index))); |
+ cmp(map_in_out, ip); |
+ b(ne, no_map_match); |
+ |
+ // Use the transitioned cached map. |
+ int trans_index = |
+ Context::GetContextMapIndexFromElementsKind(transitioned_kind); |
+ ldr(map_in_out, MemOperand(scratch, Context::SlotOffset(trans_index))); |
+} |
+ |
+ |
+void MacroAssembler::LoadInitialArrayMap( |
Register function_in, Register scratch, Register map_out) { |
ASSERT(!function_in.is(map_out)); |
Label done; |
ldr(map_out, FieldMemOperand(function_in, |
JSFunction::kPrototypeOrInitialMapOffset)); |
if (!FLAG_smi_only_arrays) { |
- // Load the global or builtins object from the current context. |
- ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
- ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
- |
- // Check that the function's map is same as the cached map. |
- ldr(ip, MemOperand( |
- scratch, Context::SlotOffset(Context::SMI_JS_ARRAY_MAP_INDEX))); |
- cmp(map_out, ip); |
- b(ne, &done); |
- |
- // Use the cached transitioned map. |
- ldr(map_out, |
- MemOperand(scratch, |
- Context::SlotOffset(Context::OBJECT_JS_ARRAY_MAP_INDEX))); |
+ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, |
+ FAST_ELEMENTS, |
+ map_out, |
+ scratch, |
+ &done); |
} |
bind(&done); |
} |