| Index: src/mips64/code-stubs-mips64.cc
|
| diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc
|
| index 0968862c7d55c99b81b2a6634a3052b28c385a0b..33909cf7919eb3ed2d0ca73df3f2b12b53157686 100644
|
| --- a/src/mips64/code-stubs-mips64.cc
|
| +++ b/src/mips64/code-stubs-mips64.cc
|
| @@ -3498,515 +3498,6 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
|
| GenerateCase(masm, FAST_ELEMENTS);
|
| }
|
|
|
| -void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- a1 : function
|
| - // -- cp : context
|
| - // -- fp : frame pointer
|
| - // -- ra : return address
|
| - // -----------------------------------
|
| - __ AssertFunction(a1);
|
| -
|
| - // Make a2 point to the JavaScript frame.
|
| - __ mov(a2, fp);
|
| - if (skip_stub_frame()) {
|
| - // For Ignition we need to skip the handler/stub frame to reach the
|
| - // JavaScript frame for the function.
|
| - __ ld(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset));
|
| - }
|
| - if (FLAG_debug_code) {
|
| - Label ok;
|
| - __ ld(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset));
|
| - __ Branch(&ok, eq, a1, Operand(a3));
|
| - __ Abort(kInvalidFrameForFastNewRestArgumentsStub);
|
| - __ bind(&ok);
|
| - }
|
| -
|
| - // Check if we have rest parameters (only possible if we have an
|
| - // arguments adaptor frame below the function frame).
|
| - Label no_rest_parameters;
|
| - __ ld(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset));
|
| - __ ld(a3, MemOperand(a2, CommonFrameConstants::kContextOrFrameTypeOffset));
|
| - __ Branch(&no_rest_parameters, ne, a3,
|
| - Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| -
|
| - // Check if the arguments adaptor frame contains more arguments than
|
| - // specified by the function's internal formal parameter count.
|
| - Label rest_parameters;
|
| - __ SmiLoadUntag(
|
| - a0, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| - __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
|
| - __ lw(a3,
|
| - FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset));
|
| - __ Dsubu(a0, a0, Operand(a3));
|
| - __ Branch(&rest_parameters, gt, a0, Operand(zero_reg));
|
| -
|
| - // Return an empty rest parameter array.
|
| - __ bind(&no_rest_parameters);
|
| - {
|
| - // ----------- S t a t e -------------
|
| - // -- cp : context
|
| - // -- ra : return address
|
| - // -----------------------------------
|
| -
|
| - // Allocate an empty rest parameter array.
|
| - Label allocate, done_allocate;
|
| - __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS);
|
| - __ bind(&done_allocate);
|
| -
|
| - // Setup the rest parameter array in v0.
|
| - __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1);
|
| - __ sd(a1, FieldMemOperand(v0, JSArray::kMapOffset));
|
| - __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex);
|
| - __ sd(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset));
|
| - __ sd(a1, FieldMemOperand(v0, JSArray::kElementsOffset));
|
| - __ Move(a1, Smi::kZero);
|
| - __ Ret(USE_DELAY_SLOT);
|
| - __ sd(a1, FieldMemOperand(v0, JSArray::kLengthOffset)); // In delay slot
|
| - STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize);
|
| -
|
| - // Fall back to %AllocateInNewSpace.
|
| - __ bind(&allocate);
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| - __ Push(Smi::FromInt(JSArray::kSize));
|
| - __ CallRuntime(Runtime::kAllocateInNewSpace);
|
| - }
|
| - __ jmp(&done_allocate);
|
| - }
|
| -
|
| - __ bind(&rest_parameters);
|
| - {
|
| - // Compute the pointer to the first rest parameter (skippping the receiver).
|
| - __ Dlsa(a2, a2, a0, kPointerSizeLog2);
|
| - __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset -
|
| - 1 * kPointerSize));
|
| -
|
| - // ----------- S t a t e -------------
|
| - // -- cp : context
|
| - // -- a0 : number of rest parameters
|
| - // -- a1 : function
|
| - // -- a2 : pointer to first rest parameters
|
| - // -- ra : return address
|
| - // -----------------------------------
|
| -
|
| - // Allocate space for the rest parameter array plus the backing store.
|
| - Label allocate, done_allocate;
|
| - __ li(a5, Operand(JSArray::kSize + FixedArray::kHeaderSize));
|
| - __ Dlsa(a5, a5, a0, kPointerSizeLog2);
|
| - __ Allocate(a5, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS);
|
| - __ bind(&done_allocate);
|
| -
|
| - // Compute arguments.length in a4.
|
| - __ SmiTag(a4, a0);
|
| -
|
| - // Setup the elements array in v0.
|
| - __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
|
| - __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset));
|
| - __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset));
|
| - __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize));
|
| - {
|
| - Label loop, done_loop;
|
| - __ Dlsa(a1, a3, a0, kPointerSizeLog2);
|
| - __ bind(&loop);
|
| - __ Branch(&done_loop, eq, a1, Operand(a3));
|
| - __ ld(at, MemOperand(a2, 0 * kPointerSize));
|
| - __ sd(at, FieldMemOperand(a3, 0 * kPointerSize));
|
| - __ Dsubu(a2, a2, Operand(1 * kPointerSize));
|
| - __ Daddu(a3, a3, Operand(1 * kPointerSize));
|
| - __ Branch(&loop);
|
| - __ bind(&done_loop);
|
| - }
|
| -
|
| - // Setup the rest parameter array in a3.
|
| - __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, at);
|
| - __ sd(at, FieldMemOperand(a3, JSArray::kMapOffset));
|
| - __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
|
| - __ sd(at, FieldMemOperand(a3, JSArray::kPropertiesOffset));
|
| - __ sd(v0, FieldMemOperand(a3, JSArray::kElementsOffset));
|
| - __ sd(a4, FieldMemOperand(a3, JSArray::kLengthOffset));
|
| - STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize);
|
| - __ Ret(USE_DELAY_SLOT);
|
| - __ mov(v0, a3); // In delay slot
|
| -
|
| - // Fall back to %AllocateInNewSpace (if not too big).
|
| - Label too_big_for_new_space;
|
| - __ bind(&allocate);
|
| - __ Branch(&too_big_for_new_space, gt, a5,
|
| - Operand(kMaxRegularHeapObjectSize));
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| - __ SmiTag(a0);
|
| - __ SmiTag(a5);
|
| - __ Push(a0, a2, a5);
|
| - __ CallRuntime(Runtime::kAllocateInNewSpace);
|
| - __ Pop(a0, a2);
|
| - __ SmiUntag(a0);
|
| - }
|
| - __ jmp(&done_allocate);
|
| -
|
| - // Fall back to %NewStrictArguments.
|
| - __ bind(&too_big_for_new_space);
|
| - __ Push(a1);
|
| - __ TailCallRuntime(Runtime::kNewStrictArguments);
|
| - }
|
| -}
|
| -
|
| -
|
| -void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- a1 : function
|
| - // -- cp : context
|
| - // -- fp : frame pointer
|
| - // -- ra : return address
|
| - // -----------------------------------
|
| - __ AssertFunction(a1);
|
| -
|
| - // Make t0 point to the JavaScript frame.
|
| - __ mov(t0, fp);
|
| - if (skip_stub_frame()) {
|
| - // For Ignition we need to skip the handler/stub frame to reach the
|
| - // JavaScript frame for the function.
|
| - __ ld(t0, MemOperand(t0, StandardFrameConstants::kCallerFPOffset));
|
| - }
|
| - if (FLAG_debug_code) {
|
| - Label ok;
|
| - __ ld(a3, MemOperand(t0, StandardFrameConstants::kFunctionOffset));
|
| - __ Branch(&ok, eq, a1, Operand(a3));
|
| - __ Abort(kInvalidFrameForFastNewRestArgumentsStub);
|
| - __ bind(&ok);
|
| - }
|
| -
|
| - // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub.
|
| - __ ld(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
|
| - __ lw(a2,
|
| - FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset));
|
| - __ Lsa(a3, t0, a2, kPointerSizeLog2);
|
| - __ Addu(a3, a3, Operand(StandardFrameConstants::kCallerSPOffset));
|
| - __ SmiTag(a2);
|
| -
|
| - // a1 : function
|
| - // a2 : number of parameters (tagged)
|
| - // a3 : parameters pointer
|
| - // t0 : Javascript frame pointer
|
| - // Registers used over whole function:
|
| - // a5 : arguments count (tagged)
|
| - // a6 : mapped parameter count (tagged)
|
| -
|
| - // Check if the calling frame is an arguments adaptor frame.
|
| - Label adaptor_frame, try_allocate, runtime;
|
| - __ ld(a4, MemOperand(t0, StandardFrameConstants::kCallerFPOffset));
|
| - __ ld(a0, MemOperand(a4, CommonFrameConstants::kContextOrFrameTypeOffset));
|
| - __ Branch(&adaptor_frame, eq, a0,
|
| - Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| -
|
| - // No adaptor, parameter count = argument count.
|
| - __ mov(a5, a2);
|
| - __ Branch(USE_DELAY_SLOT, &try_allocate);
|
| - __ mov(a6, a2); // In delay slot.
|
| -
|
| - // We have an adaptor frame. Patch the parameters pointer.
|
| - __ bind(&adaptor_frame);
|
| - __ ld(a5, MemOperand(a4, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| - __ SmiScale(t2, a5, kPointerSizeLog2);
|
| - __ Daddu(a4, a4, Operand(t2));
|
| - __ Daddu(a3, a4, Operand(StandardFrameConstants::kCallerSPOffset));
|
| -
|
| - // a5 = argument count (tagged)
|
| - // a6 = parameter count (tagged)
|
| - // Compute the mapped parameter count = min(a6, a5) in a6.
|
| - __ mov(a6, a2);
|
| - __ Branch(&try_allocate, le, a6, Operand(a5));
|
| - __ mov(a6, a5);
|
| -
|
| - __ bind(&try_allocate);
|
| -
|
| - // Compute the sizes of backing store, parameter map, and arguments object.
|
| - // 1. Parameter map, has 2 extra words containing context and backing store.
|
| - const int kParameterMapHeaderSize =
|
| - FixedArray::kHeaderSize + 2 * kPointerSize;
|
| - // If there are no mapped parameters, we do not need the parameter_map.
|
| - Label param_map_size;
|
| - DCHECK_EQ(static_cast<Smi*>(0), Smi::kZero);
|
| - __ Branch(USE_DELAY_SLOT, ¶m_map_size, eq, a6, Operand(zero_reg));
|
| - __ mov(t1, zero_reg); // In delay slot: param map size = 0 when a6 == 0.
|
| - __ SmiScale(t1, a6, kPointerSizeLog2);
|
| - __ daddiu(t1, t1, kParameterMapHeaderSize);
|
| - __ bind(¶m_map_size);
|
| -
|
| - // 2. Backing store.
|
| - __ SmiScale(t2, a5, kPointerSizeLog2);
|
| - __ Daddu(t1, t1, Operand(t2));
|
| - __ Daddu(t1, t1, Operand(FixedArray::kHeaderSize));
|
| -
|
| - // 3. Arguments object.
|
| - __ Daddu(t1, t1, Operand(JSSloppyArgumentsObject::kSize));
|
| -
|
| - // Do the allocation of all three objects in one go.
|
| - __ Allocate(t1, v0, t1, a4, &runtime, NO_ALLOCATION_FLAGS);
|
| -
|
| - // v0 = address of new object(s) (tagged)
|
| - // a2 = argument count (smi-tagged)
|
| - // Get the arguments boilerplate from the current native context into a4.
|
| - const int kNormalOffset =
|
| - Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX);
|
| - const int kAliasedOffset =
|
| - Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX);
|
| -
|
| - __ ld(a4, NativeContextMemOperand());
|
| - Label skip2_ne, skip2_eq;
|
| - __ Branch(&skip2_ne, ne, a6, Operand(zero_reg));
|
| - __ ld(a4, MemOperand(a4, kNormalOffset));
|
| - __ bind(&skip2_ne);
|
| -
|
| - __ Branch(&skip2_eq, eq, a6, Operand(zero_reg));
|
| - __ ld(a4, MemOperand(a4, kAliasedOffset));
|
| - __ bind(&skip2_eq);
|
| -
|
| - // v0 = address of new object (tagged)
|
| - // a2 = argument count (smi-tagged)
|
| - // a4 = address of arguments map (tagged)
|
| - // a6 = mapped parameter count (tagged)
|
| - __ sd(a4, FieldMemOperand(v0, JSObject::kMapOffset));
|
| - __ LoadRoot(t1, Heap::kEmptyFixedArrayRootIndex);
|
| - __ sd(t1, FieldMemOperand(v0, JSObject::kPropertiesOffset));
|
| - __ sd(t1, FieldMemOperand(v0, JSObject::kElementsOffset));
|
| -
|
| - // Set up the callee in-object property.
|
| - __ AssertNotSmi(a1);
|
| - __ sd(a1, FieldMemOperand(v0, JSSloppyArgumentsObject::kCalleeOffset));
|
| -
|
| - // Use the length (smi tagged) and set that as an in-object property too.
|
| - __ AssertSmi(a5);
|
| - __ sd(a5, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset));
|
| -
|
| - // Set up the elements pointer in the allocated arguments object.
|
| - // If we allocated a parameter map, a4 will point there, otherwise
|
| - // it will point to the backing store.
|
| - __ Daddu(a4, v0, Operand(JSSloppyArgumentsObject::kSize));
|
| - __ sd(a4, FieldMemOperand(v0, JSObject::kElementsOffset));
|
| -
|
| - // v0 = address of new object (tagged)
|
| - // a2 = argument count (tagged)
|
| - // a4 = address of parameter map or backing store (tagged)
|
| - // a6 = mapped parameter count (tagged)
|
| - // Initialize parameter map. If there are no mapped arguments, we're done.
|
| - Label skip_parameter_map;
|
| - Label skip3;
|
| - __ Branch(&skip3, ne, a6, Operand(Smi::kZero));
|
| - // Move backing store address to a1, because it is
|
| - // expected there when filling in the unmapped arguments.
|
| - __ mov(a1, a4);
|
| - __ bind(&skip3);
|
| -
|
| - __ Branch(&skip_parameter_map, eq, a6, Operand(Smi::kZero));
|
| -
|
| - __ LoadRoot(a5, Heap::kSloppyArgumentsElementsMapRootIndex);
|
| - __ sd(a5, FieldMemOperand(a4, FixedArray::kMapOffset));
|
| - __ Daddu(a5, a6, Operand(Smi::FromInt(2)));
|
| - __ sd(a5, FieldMemOperand(a4, FixedArray::kLengthOffset));
|
| - __ sd(cp, FieldMemOperand(a4, FixedArray::kHeaderSize + 0 * kPointerSize));
|
| - __ SmiScale(t2, a6, kPointerSizeLog2);
|
| - __ Daddu(a5, a4, Operand(t2));
|
| - __ Daddu(a5, a5, Operand(kParameterMapHeaderSize));
|
| - __ sd(a5, FieldMemOperand(a4, FixedArray::kHeaderSize + 1 * kPointerSize));
|
| -
|
| - // Copy the parameter slots and the holes in the arguments.
|
| - // We need to fill in mapped_parameter_count slots. They index the context,
|
| - // where parameters are stored in reverse order, at
|
| - // MIN_CONTEXT_SLOTS .. MIN_CONTEXT_SLOTS+parameter_count-1
|
| - // The mapped parameter thus need to get indices
|
| - // MIN_CONTEXT_SLOTS+parameter_count-1 ..
|
| - // MIN_CONTEXT_SLOTS+parameter_count-mapped_parameter_count
|
| - // We loop from right to left.
|
| - Label parameters_loop, parameters_test;
|
| - __ mov(a5, a6);
|
| - __ Daddu(t1, a2, Operand(Smi::FromInt(Context::MIN_CONTEXT_SLOTS)));
|
| - __ Dsubu(t1, t1, Operand(a6));
|
| - __ LoadRoot(a7, Heap::kTheHoleValueRootIndex);
|
| - __ SmiScale(t2, a5, kPointerSizeLog2);
|
| - __ Daddu(a1, a4, Operand(t2));
|
| - __ Daddu(a1, a1, Operand(kParameterMapHeaderSize));
|
| -
|
| - // a1 = address of backing store (tagged)
|
| - // a4 = address of parameter map (tagged)
|
| - // a0 = temporary scratch (a.o., for address calculation)
|
| - // t1 = loop variable (tagged)
|
| - // a7 = the hole value
|
| - __ jmp(¶meters_test);
|
| -
|
| - __ bind(¶meters_loop);
|
| - __ Dsubu(a5, a5, Operand(Smi::FromInt(1)));
|
| - __ SmiScale(a0, a5, kPointerSizeLog2);
|
| - __ Daddu(a0, a0, Operand(kParameterMapHeaderSize - kHeapObjectTag));
|
| - __ Daddu(t2, a4, a0);
|
| - __ sd(t1, MemOperand(t2));
|
| - __ Dsubu(a0, a0, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize));
|
| - __ Daddu(t2, a1, a0);
|
| - __ sd(a7, MemOperand(t2));
|
| - __ Daddu(t1, t1, Operand(Smi::FromInt(1)));
|
| - __ bind(¶meters_test);
|
| - __ Branch(¶meters_loop, ne, a5, Operand(Smi::kZero));
|
| -
|
| - // Restore t1 = argument count (tagged).
|
| - __ ld(a5, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset));
|
| -
|
| - __ bind(&skip_parameter_map);
|
| - // v0 = address of new object (tagged)
|
| - // a1 = address of backing store (tagged)
|
| - // a5 = argument count (tagged)
|
| - // a6 = mapped parameter count (tagged)
|
| - // t1 = scratch
|
| - // Copy arguments header and remaining slots (if there are any).
|
| - __ LoadRoot(t1, Heap::kFixedArrayMapRootIndex);
|
| - __ sd(t1, FieldMemOperand(a1, FixedArray::kMapOffset));
|
| - __ sd(a5, FieldMemOperand(a1, FixedArray::kLengthOffset));
|
| -
|
| - Label arguments_loop, arguments_test;
|
| - __ SmiScale(t2, a6, kPointerSizeLog2);
|
| - __ Dsubu(a3, a3, Operand(t2));
|
| - __ jmp(&arguments_test);
|
| -
|
| - __ bind(&arguments_loop);
|
| - __ Dsubu(a3, a3, Operand(kPointerSize));
|
| - __ ld(a4, MemOperand(a3, 0));
|
| - __ SmiScale(t2, a6, kPointerSizeLog2);
|
| - __ Daddu(t1, a1, Operand(t2));
|
| - __ sd(a4, FieldMemOperand(t1, FixedArray::kHeaderSize));
|
| - __ Daddu(a6, a6, Operand(Smi::FromInt(1)));
|
| -
|
| - __ bind(&arguments_test);
|
| - __ Branch(&arguments_loop, lt, a6, Operand(a5));
|
| -
|
| - // Return.
|
| - __ Ret();
|
| -
|
| - // Do the runtime call to allocate the arguments object.
|
| - // a5 = argument count (tagged)
|
| - __ bind(&runtime);
|
| - __ Push(a1, a3, a5);
|
| - __ TailCallRuntime(Runtime::kNewSloppyArguments);
|
| -}
|
| -
|
| -
|
| -void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- a1 : function
|
| - // -- cp : context
|
| - // -- fp : frame pointer
|
| - // -- ra : return address
|
| - // -----------------------------------
|
| - __ AssertFunction(a1);
|
| -
|
| - // Make a2 point to the JavaScript frame.
|
| - __ mov(a2, fp);
|
| - if (skip_stub_frame()) {
|
| - // For Ignition we need to skip the handler/stub frame to reach the
|
| - // JavaScript frame for the function.
|
| - __ ld(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset));
|
| - }
|
| - if (FLAG_debug_code) {
|
| - Label ok;
|
| - __ ld(a3, MemOperand(a2, StandardFrameConstants::kFunctionOffset));
|
| - __ Branch(&ok, eq, a1, Operand(a3));
|
| - __ Abort(kInvalidFrameForFastNewRestArgumentsStub);
|
| - __ bind(&ok);
|
| - }
|
| -
|
| - // Check if we have an arguments adaptor frame below the function frame.
|
| - Label arguments_adaptor, arguments_done;
|
| - __ ld(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset));
|
| - __ ld(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset));
|
| - __ Branch(&arguments_adaptor, eq, a0,
|
| - Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| - {
|
| - __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
|
| - __ lw(a0,
|
| - FieldMemOperand(a4, SharedFunctionInfo::kFormalParameterCountOffset));
|
| - __ Dlsa(a2, a2, a0, kPointerSizeLog2);
|
| - __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset -
|
| - 1 * kPointerSize));
|
| - }
|
| - __ Branch(&arguments_done);
|
| - __ bind(&arguments_adaptor);
|
| - {
|
| - __ SmiLoadUntag(
|
| - a0, MemOperand(a3, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| - __ Dlsa(a2, a3, a0, kPointerSizeLog2);
|
| - __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset -
|
| - 1 * kPointerSize));
|
| - }
|
| - __ bind(&arguments_done);
|
| -
|
| - // ----------- S t a t e -------------
|
| - // -- cp : context
|
| - // -- a0 : number of rest parameters
|
| - // -- a1 : function
|
| - // -- a2 : pointer to first rest parameters
|
| - // -- ra : return address
|
| - // -----------------------------------
|
| -
|
| - // Allocate space for the rest parameter array plus the backing store.
|
| - Label allocate, done_allocate;
|
| - __ li(a5, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
|
| - __ Dlsa(a5, a5, a0, kPointerSizeLog2);
|
| - __ Allocate(a5, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS);
|
| - __ bind(&done_allocate);
|
| -
|
| - // Compute arguments.length in a4.
|
| - __ SmiTag(a4, a0);
|
| -
|
| - // Setup the elements array in v0.
|
| - __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
|
| - __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset));
|
| - __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset));
|
| - __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize));
|
| - {
|
| - Label loop, done_loop;
|
| - __ Dlsa(a1, a3, a0, kPointerSizeLog2);
|
| - __ bind(&loop);
|
| - __ Branch(&done_loop, eq, a1, Operand(a3));
|
| - __ ld(at, MemOperand(a2, 0 * kPointerSize));
|
| - __ sd(at, FieldMemOperand(a3, 0 * kPointerSize));
|
| - __ Dsubu(a2, a2, Operand(1 * kPointerSize));
|
| - __ Daddu(a3, a3, Operand(1 * kPointerSize));
|
| - __ Branch(&loop);
|
| - __ bind(&done_loop);
|
| - }
|
| -
|
| - // Setup the strict arguments object in a3.
|
| - __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, at);
|
| - __ sd(at, FieldMemOperand(a3, JSStrictArgumentsObject::kMapOffset));
|
| - __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
|
| - __ sd(at, FieldMemOperand(a3, JSStrictArgumentsObject::kPropertiesOffset));
|
| - __ sd(v0, FieldMemOperand(a3, JSStrictArgumentsObject::kElementsOffset));
|
| - __ sd(a4, FieldMemOperand(a3, JSStrictArgumentsObject::kLengthOffset));
|
| - STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize);
|
| - __ Ret(USE_DELAY_SLOT);
|
| - __ mov(v0, a3); // In delay slot
|
| -
|
| - // Fall back to %AllocateInNewSpace (if not too big).
|
| - Label too_big_for_new_space;
|
| - __ bind(&allocate);
|
| - __ Branch(&too_big_for_new_space, gt, a5, Operand(kMaxRegularHeapObjectSize));
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| - __ SmiTag(a0);
|
| - __ SmiTag(a5);
|
| - __ Push(a0, a2, a5);
|
| - __ CallRuntime(Runtime::kAllocateInNewSpace);
|
| - __ Pop(a0, a2);
|
| - __ SmiUntag(a0);
|
| - }
|
| - __ jmp(&done_allocate);
|
| -
|
| - // Fall back to %NewStrictArguments.
|
| - __ bind(&too_big_for_new_space);
|
| - __ Push(a1);
|
| - __ TailCallRuntime(Runtime::kNewStrictArguments);
|
| -}
|
| -
|
| -
|
| static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
| int64_t offset = (ref0.address() - ref1.address());
|
| DCHECK(static_cast<int>(offset) == offset);
|
|
|