Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 667afbddf47bf1112c3b1a9e36a17ca010666dbd..cd2f23f0ff2d7fec973a4457656c2bfe9a8fea52 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -1728,7 +1728,7 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
__ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); |
// 3. Arguments object. |
- __ Addu(t5, t5, Operand(Heap::kSloppyArgumentsObjectSize)); |
+ __ Addu(t5, t5, Operand(JSSloppyArgumentsObject::kSize)); |
// Do the allocation of all three objects in one go. |
__ Allocate(t5, v0, t5, t0, &runtime, TAG_OBJECT); |
@@ -1761,23 +1761,17 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
__ sw(t5, FieldMemOperand(v0, JSObject::kElementsOffset)); |
// Set up the callee in-object property. |
- STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
__ AssertNotSmi(a1); |
- const int kCalleeOffset = JSObject::kHeaderSize + |
- Heap::kArgumentsCalleeIndex * kPointerSize; |
- __ sw(a1, FieldMemOperand(v0, kCalleeOffset)); |
+ __ sw(a1, FieldMemOperand(v0, JSSloppyArgumentsObject::kCalleeOffset)); |
// Use the length (smi tagged) and set that as an in-object property too. |
__ AssertSmi(t1); |
- STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
- const int kLengthOffset = JSObject::kHeaderSize + |
- Heap::kArgumentsLengthIndex * kPointerSize; |
- __ sw(t1, FieldMemOperand(v0, kLengthOffset)); |
+ __ sw(t1, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset)); |
// Set up the elements pointer in the allocated arguments object. |
// If we allocated a parameter map, t0 will point there, otherwise |
// it will point to the backing store. |
- __ Addu(t0, v0, Operand(Heap::kSloppyArgumentsObjectSize)); |
+ __ Addu(t0, v0, Operand(JSSloppyArgumentsObject::kSize)); |
__ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); |
// v0 = address of new object (tagged) |
@@ -1841,7 +1835,7 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
__ Branch(¶meters_loop, ne, t1, Operand(Smi::FromInt(0))); |
// t1 = argument count (tagged). |
- __ lw(t1, FieldMemOperand(v0, kLengthOffset)); |
+ __ lw(t1, FieldMemOperand(v0, JSSloppyArgumentsObject::kLengthOffset)); |
__ bind(&skip_parameter_map); |
// v0 = address of new object (tagged) |
@@ -1903,95 +1897,6 @@ void LoadIndexedInterceptorStub::Generate(MacroAssembler* masm) { |
} |
-void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
- // a1 : function |
- // a2 : number of parameters (tagged) |
- // a3 : parameters pointer |
- |
- DCHECK(a1.is(ArgumentsAccessNewDescriptor::function())); |
- DCHECK(a2.is(ArgumentsAccessNewDescriptor::parameter_count())); |
- DCHECK(a3.is(ArgumentsAccessNewDescriptor::parameter_pointer())); |
- |
- // Check if the calling frame is an arguments adaptor frame. |
- Label try_allocate, runtime; |
- __ lw(t0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
- __ lw(a0, MemOperand(t0, StandardFrameConstants::kContextOffset)); |
- __ Branch(&try_allocate, ne, a0, |
- Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
- |
- // Patch the arguments.length and the parameters pointer. |
- __ lw(a2, MemOperand(t0, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
- __ Lsa(t0, t0, a2, kPointerSizeLog2 - kSmiTagSize); |
- __ Addu(a3, t0, Operand(StandardFrameConstants::kCallerSPOffset)); |
- |
- // Try the new space allocation. Start out with computing the size |
- // of the arguments object and the elements array in words. |
- Label add_arguments_object; |
- __ bind(&try_allocate); |
- __ SmiUntag(t5, a2); |
- __ Branch(&add_arguments_object, eq, a2, Operand(zero_reg)); |
- |
- __ Addu(t5, t5, Operand(FixedArray::kHeaderSize / kPointerSize)); |
- __ bind(&add_arguments_object); |
- __ Addu(t5, t5, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); |
- |
- // Do the allocation of both objects in one go. |
- __ Allocate(t5, v0, t0, t1, &runtime, |
- static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
- |
- // Get the arguments boilerplate from the current native context. |
- __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, t0); |
- |
- __ sw(t0, FieldMemOperand(v0, JSObject::kMapOffset)); |
- __ LoadRoot(t1, Heap::kEmptyFixedArrayRootIndex); |
- __ sw(t1, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
- __ sw(t1, FieldMemOperand(v0, JSObject::kElementsOffset)); |
- |
- // Get the length (smi tagged) and set that as an in-object property too. |
- STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
- __ AssertSmi(a2); |
- __ sw(a2, |
- FieldMemOperand(v0, JSObject::kHeaderSize + |
- Heap::kArgumentsLengthIndex * kPointerSize)); |
- |
- Label done; |
- __ Branch(&done, eq, a2, Operand(zero_reg)); |
- |
- // Set up the elements pointer in the allocated arguments object and |
- // initialize the header in the elements fixed array. |
- __ Addu(t0, v0, Operand(Heap::kStrictArgumentsObjectSize)); |
- __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); |
- __ LoadRoot(t1, Heap::kFixedArrayMapRootIndex); |
- __ sw(t1, FieldMemOperand(t0, FixedArray::kMapOffset)); |
- __ sw(a2, FieldMemOperand(t0, FixedArray::kLengthOffset)); |
- __ SmiUntag(a2); |
- |
- // Copy the fixed array slots. |
- Label loop; |
- // Set up t0 to point to the first array slot. |
- __ Addu(t0, t0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
- __ bind(&loop); |
- // Pre-decrement a3 with kPointerSize on each iteration. |
- // Pre-decrement in order to skip receiver. |
- __ Addu(a3, a3, Operand(-kPointerSize)); |
- __ lw(t1, MemOperand(a3)); |
- // Post-increment t0 with kPointerSize on each iteration. |
- __ sw(t1, MemOperand(t0)); |
- __ Addu(t0, t0, Operand(kPointerSize)); |
- __ Subu(a2, a2, Operand(1)); |
- __ Branch(&loop, ne, a2, Operand(zero_reg)); |
- |
- // Return. |
- __ bind(&done); |
- __ Ret(); |
- |
- // Do the runtime call to allocate the arguments object. |
- __ bind(&runtime); |
- __ Push(a1, a3, a2); |
- __ TailCallRuntime(Runtime::kNewStrictArguments); |
-} |
- |
- |
void RegExpExecStub::Generate(MacroAssembler* masm) { |
// Just jump directly to runtime if native RegExp is not selected at compile |
// time or if regexp entry in generated code is turned off runtime switch or |
@@ -5260,7 +5165,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
__ sw(at, FieldMemOperand(a3, 0 * kPointerSize)); |
__ Subu(a2, a2, Operand(1 * kPointerSize)); |
__ Addu(a3, a3, Operand(1 * kPointerSize)); |
- __ b(&loop); |
+ __ jmp(&loop); |
__ bind(&done_loop); |
} |
@@ -5289,6 +5194,111 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
} |
+void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- a1 : function |
+ // -- cp : context |
+ // -- fp : frame pointer |
+ // -- ra : return address |
+ // ----------------------------------- |
+ __ AssertFunction(a1); |
+ |
+ // For Ignition we need to skip all possible handler/stub frames until |
+ // we reach the JavaScript frame for the function (similar to what the |
+ // runtime fallback implementation does). So make a2 point to that |
+ // JavaScript frame. |
+ { |
+ Label loop, loop_entry; |
+ __ Branch(USE_DELAY_SLOT, &loop_entry); |
+ __ mov(a2, fp); // In delay slot. |
+ __ bind(&loop); |
+ __ lw(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
+ __ bind(&loop_entry); |
+ __ lw(a3, MemOperand(a2, StandardFrameConstants::kMarkerOffset)); |
+ __ Branch(&loop, ne, a1, Operand(a3)); |
+ } |
+ |
+ // Check if we have an arguments adaptor frame below the function frame. |
+ Label arguments_adaptor, arguments_done; |
+ __ lw(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
+ __ lw(a0, MemOperand(a3, StandardFrameConstants::kContextOffset)); |
+ __ Branch(&arguments_adaptor, eq, a0, |
+ Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
+ { |
+ __ lw(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
+ __ lw(a0, |
+ FieldMemOperand(a1, SharedFunctionInfo::kFormalParameterCountOffset)); |
+ __ Lsa(a2, a2, a0, kPointerSizeLog2 - 1); |
+ __ Addu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset - |
+ 1 * kPointerSize)); |
+ } |
+ __ Branch(&arguments_done); |
+ __ bind(&arguments_adaptor); |
+ { |
+ __ lw(a0, MemOperand(a3, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ __ Lsa(a2, a3, a0, kPointerSizeLog2 - 1); |
+ __ Addu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset - |
+ 1 * kPointerSize)); |
+ } |
+ __ bind(&arguments_done); |
+ |
+ // ----------- S t a t e ------------- |
+ // -- cp : context |
+ // -- a0 : number of rest parameters (tagged) |
+ // -- a2 : pointer to first rest parameters |
+ // -- ra : return address |
+ // ----------------------------------- |
+ |
+ // Allocate space for the strict arguments object plus the backing store. |
+ Label allocate, done_allocate; |
+ __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); |
+ __ Lsa(a1, a1, a0, kPointerSizeLog2 - 1); |
+ __ Allocate(a1, v0, a3, t0, &allocate, TAG_OBJECT); |
+ __ bind(&done_allocate); |
+ |
+ // Setup the elements array in v0. |
+ __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); |
+ __ sw(at, FieldMemOperand(v0, FixedArray::kMapOffset)); |
+ __ sw(a0, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
+ __ Addu(a3, v0, Operand(FixedArray::kHeaderSize)); |
+ { |
+ Label loop, done_loop; |
+ __ sll(at, a0, kPointerSizeLog2 - 1); |
+ __ Addu(a1, a3, at); |
+ __ bind(&loop); |
+ __ Branch(&done_loop, eq, a1, Operand(a3)); |
+ __ lw(at, MemOperand(a2, 0 * kPointerSize)); |
+ __ sw(at, FieldMemOperand(a3, 0 * kPointerSize)); |
+ __ Subu(a2, a2, Operand(1 * kPointerSize)); |
+ __ Addu(a3, a3, Operand(1 * kPointerSize)); |
+ __ Branch(&loop); |
+ __ bind(&done_loop); |
+ } |
+ |
+ // Setup the strict arguments object in a3. |
+ __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, at); |
+ __ sw(at, FieldMemOperand(a3, JSStrictArgumentsObject::kMapOffset)); |
+ __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
+ __ sw(at, FieldMemOperand(a3, JSStrictArgumentsObject::kPropertiesOffset)); |
+ __ sw(v0, FieldMemOperand(a3, JSStrictArgumentsObject::kElementsOffset)); |
+ __ sw(a0, FieldMemOperand(a3, JSStrictArgumentsObject::kLengthOffset)); |
+ STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); |
+ __ Ret(USE_DELAY_SLOT); |
+ __ mov(v0, a3); // In delay slot |
+ |
+ // Fall back to %AllocateInNewSpace. |
+ __ bind(&allocate); |
+ { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ __ SmiTag(a1); |
+ __ Push(a0, a2, a1); |
+ __ CallRuntime(Runtime::kAllocateInNewSpace); |
+ __ Pop(a0, a2); |
+ } |
+ __ jmp(&done_allocate); |
+} |
+ |
+ |
void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { |
Register context_reg = cp; |
Register slot_reg = a2; |