| Index: src/mips/builtins-mips.cc
|
| diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
|
| index f32b779578fa906d105b9f56259e82c17db9c0e9..f6365f3a80309432c77ea4db2013797540f769ba 100644
|
| --- a/src/mips/builtins-mips.cc
|
| +++ b/src/mips/builtins-mips.cc
|
| @@ -555,34 +555,62 @@ void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- a0 : number of arguments
|
| // -- a1 : constructor function
|
| + // -- a2 : type info cell
|
| // -- ra : return address
|
| // -- sp[...]: constructor arguments
|
| // -----------------------------------
|
| - Label generic_constructor;
|
|
|
| if (FLAG_debug_code) {
|
| // The array construct code is only set for the builtin and internal
|
| // Array functions which always have a map.
|
| // Initial map for the builtin Array function should be a map.
|
| - __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
|
| - __ And(t0, a2, Operand(kSmiTagMask));
|
| + __ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
|
| + __ And(t0, a3, Operand(kSmiTagMask));
|
| __ Assert(ne, "Unexpected initial map for Array function (3)",
|
| t0, Operand(zero_reg));
|
| - __ GetObjectType(a2, a3, t0);
|
| + __ GetObjectType(a1, a3, t0);
|
| __ Assert(eq, "Unexpected initial map for Array function (4)",
|
| t0, Operand(MAP_TYPE));
|
| +
|
| + // We should either have undefined in a2 or a valid jsglobalpropertycell
|
| + Label okay_here;
|
| + Handle<Object> undefined_sentinel(
|
| + masm->isolate()->heap()->undefined_value(), masm->isolate());
|
| + Handle<Map> global_property_cell_map(
|
| + masm->isolate()->heap()->global_property_cell_map());
|
| + __ Branch(&okay_here, eq, a2, Operand(undefined_sentinel));
|
| + __ lw(a3, FieldMemOperand(a2, 0));
|
| + __ Assert(eq, "Expected property cell in register a3",
|
| + a3, Operand(global_property_cell_map));
|
| + __ bind(&okay_here);
|
| }
|
|
|
| - // Run the native code for the Array function called as a constructor.
|
| - ArrayNativeCode(masm, &generic_constructor);
|
| + if (FLAG_optimize_constructed_arrays) {
|
| + Label not_zero_case, not_one_case;
|
| + __ Branch(¬_zero_case, ne, a0, Operand(zero_reg));
|
| + ArrayNoArgumentConstructorStub no_argument_stub;
|
| + __ TailCallStub(&no_argument_stub);
|
|
|
| - // Jump to the generic construct code in case the specialized code cannot
|
| - // handle the construction.
|
| - __ bind(&generic_constructor);
|
| + __ bind(¬_zero_case);
|
| + __ Branch(¬_one_case, gt, a0, Operand(1));
|
| + ArraySingleArgumentConstructorStub single_argument_stub;
|
| + __ TailCallStub(&single_argument_stub);
|
|
|
| - Handle<Code> generic_construct_stub =
|
| - masm->isolate()->builtins()->JSConstructStubGeneric();
|
| - __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
|
| + __ bind(¬_one_case);
|
| + ArrayNArgumentsConstructorStub n_argument_stub;
|
| + __ TailCallStub(&n_argument_stub);
|
| + } else {
|
| + Label generic_constructor;
|
| + // Run the native code for the Array function called as a constructor.
|
| + ArrayNativeCode(masm, &generic_constructor);
|
| +
|
| + // Jump to the generic construct code in case the specialized code cannot
|
| + // handle the construction.
|
| + __ bind(&generic_constructor);
|
| + Handle<Code> generic_construct_stub =
|
| + masm->isolate()->builtins()->JSConstructStubGeneric();
|
| + __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
|
| + }
|
| }
|
|
|
|
|
| @@ -1171,6 +1199,10 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
|
| // Invoke the code and pass argc as a0.
|
| __ mov(a0, a3);
|
| if (is_construct) {
|
| + // No type feedback cell is available
|
| + Handle<Object> undefined_sentinel(
|
| + masm->isolate()->heap()->undefined_value(), masm->isolate());
|
| + __ li(a2, Operand(undefined_sentinel));
|
| CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
|
| __ CallStub(&stub);
|
| } else {
|
|
|