Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/mips64/code-stubs-mips64.cc

Issue 2054853002: Fix arguments object stubs for large arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Port to most architectures. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 4721 matching lines...) Expand 10 before | Expand all | Expand 10 after
4732 __ ld(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); 4732 __ ld(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset));
4733 __ ld(a3, MemOperand(a2, CommonFrameConstants::kContextOrFrameTypeOffset)); 4733 __ ld(a3, MemOperand(a2, CommonFrameConstants::kContextOrFrameTypeOffset));
4734 __ Branch(&no_rest_parameters, ne, a3, 4734 __ Branch(&no_rest_parameters, ne, a3,
4735 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 4735 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
4736 4736
4737 // Check if the arguments adaptor frame contains more arguments than 4737 // Check if the arguments adaptor frame contains more arguments than
4738 // specified by the function's internal formal parameter count. 4738 // specified by the function's internal formal parameter count.
4739 Label rest_parameters; 4739 Label rest_parameters;
4740 __ SmiLoadUntag( 4740 __ SmiLoadUntag(
4741 a0, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); 4741 a0, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset));
4742 __ ld(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 4742 __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
4743 __ lw(a1, 4743 __ lw(a3,
4744 FieldMemOperand(a1, SharedFunctionInfo::kFormalParameterCountOffset)); 4744 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset));
4745 __ Dsubu(a0, a0, Operand(a1)); 4745 __ Dsubu(a0, a0, Operand(a3));
4746 __ Branch(&rest_parameters, gt, a0, Operand(zero_reg)); 4746 __ Branch(&rest_parameters, gt, a0, Operand(zero_reg));
4747 4747
4748 // Return an empty rest parameter array. 4748 // Return an empty rest parameter array.
4749 __ bind(&no_rest_parameters); 4749 __ bind(&no_rest_parameters);
4750 { 4750 {
4751 // ----------- S t a t e ------------- 4751 // ----------- S t a t e -------------
4752 // -- cp : context 4752 // -- cp : context
4753 // -- ra : return address 4753 // -- ra : return address
4754 // ----------------------------------- 4754 // -----------------------------------
4755 4755
(...skipping 26 matching lines...) Expand all
4782 __ bind(&rest_parameters); 4782 __ bind(&rest_parameters);
4783 { 4783 {
4784 // Compute the pointer to the first rest parameter (skippping the receiver). 4784 // Compute the pointer to the first rest parameter (skippping the receiver).
4785 __ Dlsa(a2, a2, a0, kPointerSizeLog2); 4785 __ Dlsa(a2, a2, a0, kPointerSizeLog2);
4786 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset - 4786 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset -
4787 1 * kPointerSize)); 4787 1 * kPointerSize));
4788 4788
4789 // ----------- S t a t e ------------- 4789 // ----------- S t a t e -------------
4790 // -- cp : context 4790 // -- cp : context
4791 // -- a0 : number of rest parameters 4791 // -- a0 : number of rest parameters
4792 // -- a1 : function
4792 // -- a2 : pointer to first rest parameters 4793 // -- a2 : pointer to first rest parameters
4793 // -- ra : return address 4794 // -- ra : return address
4794 // ----------------------------------- 4795 // -----------------------------------
4795 4796
4796 // Allocate space for the rest parameter array plus the backing store. 4797 // Allocate space for the rest parameter array plus the backing store.
4797 Label allocate, done_allocate; 4798 Label allocate, done_allocate;
4798 __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); 4799 __ li(a5, Operand(JSArray::kSize + FixedArray::kHeaderSize));
4799 __ Dlsa(a1, a1, a0, kPointerSizeLog2); 4800 __ Dlsa(a5, a5, a0, kPointerSizeLog2);
4800 __ Allocate(a1, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS); 4801 __ Allocate(a5, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS);
4801 __ bind(&done_allocate); 4802 __ bind(&done_allocate);
4802 4803
4803 // Compute arguments.length in a4. 4804 // Compute arguments.length in a4.
4804 __ SmiTag(a4, a0); 4805 __ SmiTag(a4, a0);
4805 4806
4806 // Setup the elements array in v0. 4807 // Setup the elements array in v0.
4807 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); 4808 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
4808 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset)); 4809 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset));
4809 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset)); 4810 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset));
4810 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize)); 4811 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize));
(...skipping 14 matching lines...) Expand all
4825 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, at); 4826 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, at);
4826 __ sd(at, FieldMemOperand(a3, JSArray::kMapOffset)); 4827 __ sd(at, FieldMemOperand(a3, JSArray::kMapOffset));
4827 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); 4828 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
4828 __ sd(at, FieldMemOperand(a3, JSArray::kPropertiesOffset)); 4829 __ sd(at, FieldMemOperand(a3, JSArray::kPropertiesOffset));
4829 __ sd(v0, FieldMemOperand(a3, JSArray::kElementsOffset)); 4830 __ sd(v0, FieldMemOperand(a3, JSArray::kElementsOffset));
4830 __ sd(a4, FieldMemOperand(a3, JSArray::kLengthOffset)); 4831 __ sd(a4, FieldMemOperand(a3, JSArray::kLengthOffset));
4831 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); 4832 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize);
4832 __ Ret(USE_DELAY_SLOT); 4833 __ Ret(USE_DELAY_SLOT);
4833 __ mov(v0, a3); // In delay slot 4834 __ mov(v0, a3); // In delay slot
4834 4835
4835 // Fall back to %AllocateInNewSpace. 4836 // Fall back to %AllocateInNewSpace (if not too big).
4837 Label too_big_for_new_space;
4836 __ bind(&allocate); 4838 __ bind(&allocate);
4839 __ Branch(&too_big_for_new_space, gt, a5,
4840 Operand(Page::kMaxRegularHeapObjectSize));
4837 { 4841 {
4838 FrameScope scope(masm, StackFrame::INTERNAL); 4842 FrameScope scope(masm, StackFrame::INTERNAL);
4839 __ SmiTag(a0); 4843 __ SmiTag(a0);
4840 __ SmiTag(a1); 4844 __ SmiTag(a5);
4841 __ Push(a0, a2, a1); 4845 __ Push(a0, a2, a5);
4842 __ CallRuntime(Runtime::kAllocateInNewSpace); 4846 __ CallRuntime(Runtime::kAllocateInNewSpace);
4843 __ Pop(a0, a2); 4847 __ Pop(a0, a2);
4844 __ SmiUntag(a0); 4848 __ SmiUntag(a0);
4845 } 4849 }
4846 __ jmp(&done_allocate); 4850 __ jmp(&done_allocate);
4851
4852 // Fall back to %NewStrictArguments.
4853 __ bind(&too_big_for_new_space);
4854 __ Push(a1);
4855 __ TailCallRuntime(Runtime::kNewStrictArguments);
4847 } 4856 }
4848 } 4857 }
4849 4858
4850 4859
4851 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { 4860 void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
4852 // ----------- S t a t e ------------- 4861 // ----------- S t a t e -------------
4853 // -- a1 : function 4862 // -- a1 : function
4854 // -- cp : context 4863 // -- cp : context
4855 // -- fp : frame pointer 4864 // -- fp : frame pointer
4856 // -- ra : return address 4865 // -- ra : return address
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
5108 __ bind(&ok); 5117 __ bind(&ok);
5109 } 5118 }
5110 5119
5111 // Check if we have an arguments adaptor frame below the function frame. 5120 // Check if we have an arguments adaptor frame below the function frame.
5112 Label arguments_adaptor, arguments_done; 5121 Label arguments_adaptor, arguments_done;
5113 __ ld(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); 5122 __ ld(a3, MemOperand(a2, StandardFrameConstants::kCallerFPOffset));
5114 __ ld(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset)); 5123 __ ld(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset));
5115 __ Branch(&arguments_adaptor, eq, a0, 5124 __ Branch(&arguments_adaptor, eq, a0,
5116 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 5125 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
5117 { 5126 {
5118 __ ld(a1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 5127 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
5119 __ lw(a0, 5128 __ lw(a0,
5120 FieldMemOperand(a1, SharedFunctionInfo::kFormalParameterCountOffset)); 5129 FieldMemOperand(a4, SharedFunctionInfo::kFormalParameterCountOffset));
5121 __ Dlsa(a2, a2, a0, kPointerSizeLog2); 5130 __ Dlsa(a2, a2, a0, kPointerSizeLog2);
5122 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset - 5131 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset -
5123 1 * kPointerSize)); 5132 1 * kPointerSize));
5124 } 5133 }
5125 __ Branch(&arguments_done); 5134 __ Branch(&arguments_done);
5126 __ bind(&arguments_adaptor); 5135 __ bind(&arguments_adaptor);
5127 { 5136 {
5128 __ SmiLoadUntag( 5137 __ SmiLoadUntag(
5129 a0, MemOperand(a3, ArgumentsAdaptorFrameConstants::kLengthOffset)); 5138 a0, MemOperand(a3, ArgumentsAdaptorFrameConstants::kLengthOffset));
5130 __ Dlsa(a2, a3, a0, kPointerSizeLog2); 5139 __ Dlsa(a2, a3, a0, kPointerSizeLog2);
5131 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset - 5140 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset -
5132 1 * kPointerSize)); 5141 1 * kPointerSize));
5133 } 5142 }
5134 __ bind(&arguments_done); 5143 __ bind(&arguments_done);
5135 5144
5136 // ----------- S t a t e ------------- 5145 // ----------- S t a t e -------------
5137 // -- cp : context 5146 // -- cp : context
5138 // -- a0 : number of rest parameters 5147 // -- a0 : number of rest parameters
5148 // -- a1 : function
5139 // -- a2 : pointer to first rest parameters 5149 // -- a2 : pointer to first rest parameters
5140 // -- ra : return address 5150 // -- ra : return address
5141 // ----------------------------------- 5151 // -----------------------------------
5142 5152
5143 // Allocate space for the rest parameter array plus the backing store. 5153 // Allocate space for the rest parameter array plus the backing store.
5144 Label allocate, done_allocate; 5154 Label allocate, done_allocate;
5145 __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); 5155 __ li(a5, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
5146 __ Dlsa(a1, a1, a0, kPointerSizeLog2); 5156 __ Dlsa(a5, a5, a0, kPointerSizeLog2);
5147 __ Allocate(a1, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS); 5157 __ Allocate(a5, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS);
5148 __ bind(&done_allocate); 5158 __ bind(&done_allocate);
5149 5159
5150 // Compute arguments.length in a4. 5160 // Compute arguments.length in a4.
5151 __ SmiTag(a4, a0); 5161 __ SmiTag(a4, a0);
5152 5162
5153 // Setup the elements array in v0. 5163 // Setup the elements array in v0.
5154 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); 5164 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
5155 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset)); 5165 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset));
5156 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset)); 5166 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset));
5157 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize)); 5167 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize));
(...skipping 14 matching lines...) Expand all
5172 __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, at); 5182 __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, at);
5173 __ sd(at, FieldMemOperand(a3, JSStrictArgumentsObject::kMapOffset)); 5183 __ sd(at, FieldMemOperand(a3, JSStrictArgumentsObject::kMapOffset));
5174 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); 5184 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex);
5175 __ sd(at, FieldMemOperand(a3, JSStrictArgumentsObject::kPropertiesOffset)); 5185 __ sd(at, FieldMemOperand(a3, JSStrictArgumentsObject::kPropertiesOffset));
5176 __ sd(v0, FieldMemOperand(a3, JSStrictArgumentsObject::kElementsOffset)); 5186 __ sd(v0, FieldMemOperand(a3, JSStrictArgumentsObject::kElementsOffset));
5177 __ sd(a4, FieldMemOperand(a3, JSStrictArgumentsObject::kLengthOffset)); 5187 __ sd(a4, FieldMemOperand(a3, JSStrictArgumentsObject::kLengthOffset));
5178 STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize); 5188 STATIC_ASSERT(JSStrictArgumentsObject::kSize == 4 * kPointerSize);
5179 __ Ret(USE_DELAY_SLOT); 5189 __ Ret(USE_DELAY_SLOT);
5180 __ mov(v0, a3); // In delay slot 5190 __ mov(v0, a3); // In delay slot
5181 5191
5182 // Fall back to %AllocateInNewSpace. 5192 // Fall back to %AllocateInNewSpace (if not too big).
5193 Label too_big_for_new_space;
5183 __ bind(&allocate); 5194 __ bind(&allocate);
5195 __ Branch(&too_big_for_new_space, gt, a5,
5196 Operand(Page::kMaxRegularHeapObjectSize));
5184 { 5197 {
5185 FrameScope scope(masm, StackFrame::INTERNAL); 5198 FrameScope scope(masm, StackFrame::INTERNAL);
5186 __ SmiTag(a0); 5199 __ SmiTag(a0);
5187 __ SmiTag(a1); 5200 __ SmiTag(a5);
5188 __ Push(a0, a2, a1); 5201 __ Push(a0, a2, a5);
5189 __ CallRuntime(Runtime::kAllocateInNewSpace); 5202 __ CallRuntime(Runtime::kAllocateInNewSpace);
5190 __ Pop(a0, a2); 5203 __ Pop(a0, a2);
5191 __ SmiUntag(a0); 5204 __ SmiUntag(a0);
5192 } 5205 }
5193 __ jmp(&done_allocate); 5206 __ jmp(&done_allocate);
5207
5208 // Fall back to %NewStrictArguments.
5209 __ bind(&too_big_for_new_space);
5210 __ Push(a1);
5211 __ TailCallRuntime(Runtime::kNewStrictArguments);
5194 } 5212 }
5195 5213
5196 5214
5197 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { 5215 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
5198 Register context_reg = cp; 5216 Register context_reg = cp;
5199 Register slot_reg = a2; 5217 Register slot_reg = a2;
5200 Register result_reg = v0; 5218 Register result_reg = v0;
5201 Label slow_case; 5219 Label slow_case;
5202 5220
5203 // Go up context chain to the script context. 5221 // Go up context chain to the script context.
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
5647 kStackUnwindSpace, kInvalidStackOffset, 5665 kStackUnwindSpace, kInvalidStackOffset,
5648 return_value_operand, NULL); 5666 return_value_operand, NULL);
5649 } 5667 }
5650 5668
5651 #undef __ 5669 #undef __
5652 5670
5653 } // namespace internal 5671 } // namespace internal
5654 } // namespace v8 5672 } // namespace v8
5655 5673
5656 #endif // V8_TARGET_ARCH_MIPS64 5674 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698