| Index: src/mips64/builtins-mips64.cc
|
| diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc
|
| index ce4716bdd1442f80aa91a3b1a17a3de063e92844..ff068196b83720322b2369c252f949371d80604b 100644
|
| --- a/src/mips64/builtins-mips64.cc
|
| +++ b/src/mips64/builtins-mips64.cc
|
| @@ -333,8 +333,9 @@ void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) {
|
| __ bind(&new_object);
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| - __ Push(a0, a1, a3); // first argument, constructor, new target
|
| - __ CallRuntime(Runtime::kNewObject);
|
| + __ Push(a0);
|
| + FastNewObjectStub stub(masm->isolate());
|
| + __ CallStub(&stub);
|
| __ Pop(a0);
|
| }
|
| __ Ret(USE_DELAY_SLOT);
|
| @@ -460,8 +461,9 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
|
| __ bind(&new_object);
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| - __ Push(a0, a1, a3); // first argument, constructor, new target
|
| - __ CallRuntime(Runtime::kNewObject);
|
| + __ Push(a0);
|
| + FastNewObjectStub stub(masm->isolate());
|
| + __ CallStub(&stub);
|
| __ Pop(a0);
|
| }
|
| __ Ret(USE_DELAY_SLOT);
|
| @@ -542,143 +544,17 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
| __ Push(a2, a0);
|
|
|
| if (create_implicit_receiver) {
|
| - // Try to allocate the object without transitioning into C code. If any of
|
| - // the preconditions is not met, the code bails out to the runtime call.
|
| - Label rt_call, allocated;
|
| - if (FLAG_inline_new) {
|
| - // Verify that the new target is a JSFunction.
|
| - __ GetObjectType(a3, a5, a4);
|
| - __ Branch(&rt_call, ne, a4, Operand(JS_FUNCTION_TYPE));
|
| -
|
| - // Load the initial map and verify that it is in fact a map.
|
| - // a3: new target
|
| - __ ld(a2,
|
| - FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset));
|
| - __ JumpIfSmi(a2, &rt_call);
|
| - __ GetObjectType(a2, t1, t0);
|
| - __ Branch(&rt_call, ne, t0, Operand(MAP_TYPE));
|
| -
|
| - // Fall back to runtime if the expected base constructor and base
|
| - // constructor differ.
|
| - __ ld(a5, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset));
|
| - __ Branch(&rt_call, ne, a1, Operand(a5));
|
| -
|
| - // Check that the constructor is not constructing a JSFunction (see
|
| - // comments in Runtime_NewObject in runtime.cc). In which case the
|
| - // initial map's instance type would be JS_FUNCTION_TYPE.
|
| - // a1: constructor function
|
| - // a2: initial map
|
| - __ lbu(t1, FieldMemOperand(a2, Map::kInstanceTypeOffset));
|
| - __ Branch(&rt_call, eq, t1, Operand(JS_FUNCTION_TYPE));
|
| -
|
| - // Now allocate the JSObject on the heap.
|
| - // a1: constructor function
|
| - // a2: initial map
|
| - __ lbu(a4, FieldMemOperand(a2, Map::kInstanceSizeOffset));
|
| - __ Allocate(a4, t0, a4, t2, &rt_call, SIZE_IN_WORDS);
|
| -
|
| - // Allocated the JSObject, now initialize the fields. Map is set to
|
| - // initial map and properties and elements are set to empty fixed array.
|
| - // a1: constructor function
|
| - // a2: initial map
|
| - // a3: object size
|
| - // t0: JSObject (not HeapObject tagged - the actual address).
|
| - // a4: start of next object
|
| - __ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex);
|
| - __ mov(t1, t0);
|
| - STATIC_ASSERT(0 * kPointerSize == JSObject::kMapOffset);
|
| - __ sd(a2, MemOperand(t1, JSObject::kMapOffset));
|
| - STATIC_ASSERT(1 * kPointerSize == JSObject::kPropertiesOffset);
|
| - __ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset));
|
| - STATIC_ASSERT(2 * kPointerSize == JSObject::kElementsOffset);
|
| - __ sd(t2, MemOperand(t1, JSObject::kElementsOffset));
|
| - STATIC_ASSERT(3 * kPointerSize == JSObject::kHeaderSize);
|
| - __ Daddu(t1, t1, Operand(3 * kPointerSize));
|
| -
|
| - // Add the object tag to make the JSObject real, so that we can continue
|
| - // and jump into the continuation code at any time from now on.
|
| - __ Daddu(t0, t0, Operand(kHeapObjectTag));
|
| -
|
| - // Fill all the in-object properties with appropriate filler.
|
| - // t0: JSObject (tagged)
|
| - // t1: First in-object property of JSObject (not tagged)
|
| - __ LoadRoot(t3, Heap::kUndefinedValueRootIndex);
|
| -
|
| - if (!is_api_function) {
|
| - Label no_inobject_slack_tracking;
|
| -
|
| - MemOperand bit_field3 = FieldMemOperand(a2, Map::kBitField3Offset);
|
| - // Check if slack tracking is enabled.
|
| - __ lwu(t2, bit_field3);
|
| - __ DecodeField<Map::ConstructionCounter>(a6, t2);
|
| - // a6: slack tracking counter
|
| - __ Branch(&no_inobject_slack_tracking, lt, a6,
|
| - Operand(Map::kSlackTrackingCounterEnd));
|
| - // Decrease generous allocation count.
|
| - __ Dsubu(t2, t2, Operand(1 << Map::ConstructionCounter::kShift));
|
| - __ sw(t2, bit_field3);
|
| -
|
| - // Allocate object with a slack.
|
| - __ lbu(a0, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset));
|
| - __ dsll(a0, a0, kPointerSizeLog2);
|
| - __ dsubu(a0, a4, a0);
|
| - // a0: offset of first field after pre-allocated fields
|
| - if (FLAG_debug_code) {
|
| - __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields, t1,
|
| - Operand(a0));
|
| - }
|
| - __ InitializeFieldsWithFiller(t1, a0, t3);
|
| -
|
| - // To allow truncation fill the remaining fields with one pointer
|
| - // filler map.
|
| - __ LoadRoot(t3, Heap::kOnePointerFillerMapRootIndex);
|
| - __ InitializeFieldsWithFiller(t1, a4, t3);
|
| -
|
| - // a6: slack tracking counter value before decreasing.
|
| - __ Branch(&allocated, ne, a6, Operand(Map::kSlackTrackingCounterEnd));
|
| -
|
| - // Push the constructor, new_target and the object to the stack,
|
| - // and then the initial map as an argument to the runtime call.
|
| - __ Push(a1, a3, t0, a2);
|
| - __ CallRuntime(Runtime::kFinalizeInstanceSize);
|
| - __ Pop(a1, a3, t0);
|
| -
|
| - // Continue with JSObject being successfully allocated.
|
| - // a1: constructor function
|
| - // a3: new target
|
| - // t0: JSObject
|
| - __ jmp(&allocated);
|
| -
|
| - __ bind(&no_inobject_slack_tracking);
|
| - }
|
| -
|
| - __ InitializeFieldsWithFiller(t1, a4, t3);
|
| -
|
| - // Continue with JSObject being successfully allocated.
|
| - // a1: constructor function
|
| - // a3: new target
|
| - // t0: JSObject
|
| - __ jmp(&allocated);
|
| - }
|
| -
|
| - // Allocate the new receiver object using the runtime call.
|
| - // a1: constructor function
|
| - // a3: new target
|
| - __ bind(&rt_call);
|
| -
|
| - // Push the constructor and new_target twice, second pair as arguments
|
| - // to the runtime call.
|
| - __ Push(a1, a3, a1, a3); // constructor function, new target
|
| - __ CallRuntime(Runtime::kNewObject);
|
| + __ Push(a1, a3);
|
| + FastNewObjectStub stub(masm->isolate());
|
| + __ CallStub(&stub);
|
| __ mov(t0, v0);
|
| __ Pop(a1, a3);
|
|
|
| - // Receiver for constructor call allocated.
|
| - // a1: constructor function
|
| - // a3: new target
|
| - // t0: JSObject
|
| - __ bind(&allocated);
|
| -
|
| + // ----------- S t a t e -------------
|
| + // -- a1: constructor function
|
| + // -- a3: new target
|
| + // -- t0: newly allocated object
|
| + // -----------------------------------
|
| __ ld(a0, MemOperand(sp));
|
| }
|
| __ SmiUntag(a0);
|
|
|