Index: src/mips/builtins-mips.cc |
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
index 701450b81454d4b9cb8e5c6346bfa80f22d551b4..9a02ccf4bd4aed5e007c5dd23dc509951fb9365d 100644 |
--- a/src/mips/builtins-mips.cc |
+++ b/src/mips/builtins-mips.cc |
@@ -74,6 +74,22 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, |
} |
+// Load the built-in InternalArray function from the current context. |
+static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
+ Register result) { |
+ // Load the global context. |
+ |
+ __ lw(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
+ __ lw(result, |
+ FieldMemOperand(result, GlobalObject::kGlobalContextOffset)); |
+ // Load the InternalArray function from the global context. |
+ __ lw(result, |
+ MemOperand(result, |
+ Context::SlotOffset( |
+ Context::INTERNAL_ARRAY_FUNCTION_INDEX))); |
+} |
+ |
+ |
// Load the built-in Array function from the current context. |
static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { |
// Load the global context. |
@@ -425,6 +441,42 @@ static void ArrayNativeCode(MacroAssembler* masm, |
} |
+void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- a0 : number of arguments |
+ // -- ra : return address |
+ // -- sp[...]: constructor arguments |
+ // ----------------------------------- |
+ Label generic_array_code, one_or_more_arguments, two_or_more_arguments; |
+ |
+ // Get the InternalArray function. |
+ GenerateLoadInternalArrayFunction(masm, a1); |
+ |
+ if (FLAG_debug_code) { |
+ // Initial map for the builtin InternalArray functions should be maps. |
+ __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
+ __ And(t0, a2, Operand(kSmiTagMask)); |
+ __ Assert(ne, "Unexpected initial map for InternalArray function", |
+ t0, Operand(zero_reg)); |
+ __ GetObjectType(a2, a3, t0); |
+ __ Assert(eq, "Unexpected initial map for InternalArray function", |
+ t0, Operand(MAP_TYPE)); |
+ } |
+ |
+ // Run the native code for the InternalArray function called as a normal |
+ // function. |
+ ArrayNativeCode(masm, &generic_array_code); |
+ |
+ // Jump to the generic array code if the specialized code cannot handle the |
+ // construction. |
+ __ bind(&generic_array_code); |
+ |
+ Handle<Code> array_code = |
+ masm->isolate()->builtins()->ArrayCodeGeneric(); |
+ __ Jump(array_code, RelocInfo::CODE_TARGET); |
+} |
+ |
+ |
void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
// -- a0 : number of arguments |