Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index 678b8b103657a0f6a6b53f4c16d804e6eada7b4f..70b1fd0cff082976aa9362ab2e84d27a001140bb 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -4279,26 +4279,41 @@ 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. |
+ lw(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
+ lw(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); |
+ lw(at, MemOperand(scratch, Context::SlotOffset(expected_index))); |
+ Branch(no_map_match, ne, map_in_out, Operand(at)); |
+ |
+ // Use the transitioned cached map. |
+ int trans_index = |
+ Context::GetContextMapIndexFromElementsKind(transitioned_kind); |
+ lw(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; |
lw(map_out, FieldMemOperand(function_in, |
JSFunction::kPrototypeOrInitialMapOffset)); |
if (!FLAG_smi_only_arrays) { |
- // Load the global or builtins object from the current context. |
- lw(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
- lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
- |
- // Check that the function's map is same as the cached map. |
- lw(at, MemOperand( |
- scratch, Context::SlotOffset(Context::SMI_JS_ARRAY_MAP_INDEX))); |
- Branch(&done, ne, map_out, Operand(at)); |
- |
- // Use the cached transitioned map. |
- lw(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); |
} |