| OLD | NEW |
| 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 4740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4751 __ ld(a0, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); | 4751 __ ld(a0, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); |
| 4752 __ Branch(&new_object, ne, a0, Operand(a1)); | 4752 __ Branch(&new_object, ne, a0, Operand(a1)); |
| 4753 | 4753 |
| 4754 // Allocate the JSObject on the heap. | 4754 // Allocate the JSObject on the heap. |
| 4755 Label allocate, done_allocate; | 4755 Label allocate, done_allocate; |
| 4756 __ lbu(a4, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | 4756 __ lbu(a4, FieldMemOperand(a2, Map::kInstanceSizeOffset)); |
| 4757 __ Allocate(a4, v0, a5, a0, &allocate, SIZE_IN_WORDS); | 4757 __ Allocate(a4, v0, a5, a0, &allocate, SIZE_IN_WORDS); |
| 4758 __ bind(&done_allocate); | 4758 __ bind(&done_allocate); |
| 4759 | 4759 |
| 4760 // Initialize the JSObject fields. | 4760 // Initialize the JSObject fields. |
| 4761 __ sd(a2, MemOperand(v0, JSObject::kMapOffset)); | 4761 __ sd(a2, FieldMemOperand(v0, JSObject::kMapOffset)); |
| 4762 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); | 4762 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); |
| 4763 __ sd(a3, MemOperand(v0, JSObject::kPropertiesOffset)); | 4763 __ sd(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
| 4764 __ sd(a3, MemOperand(v0, JSObject::kElementsOffset)); | 4764 __ sd(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); |
| 4765 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 4765 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); |
| 4766 __ Daddu(a1, v0, Operand(JSObject::kHeaderSize)); | 4766 __ Daddu(a1, v0, Operand(JSObject::kHeaderSize - kHeapObjectTag)); |
| 4767 | 4767 |
| 4768 // ----------- S t a t e ------------- | 4768 // ----------- S t a t e ------------- |
| 4769 // -- v0 : result (untagged) | 4769 // -- v0 : result (tagged) |
| 4770 // -- a1 : result fields (untagged) | 4770 // -- a1 : result fields (untagged) |
| 4771 // -- a5 : result end (untagged) | 4771 // -- a5 : result end (untagged) |
| 4772 // -- a2 : initial map | 4772 // -- a2 : initial map |
| 4773 // -- cp : context | 4773 // -- cp : context |
| 4774 // -- ra : return address | 4774 // -- ra : return address |
| 4775 // ----------------------------------- | 4775 // ----------------------------------- |
| 4776 | 4776 |
| 4777 // Perform in-object slack tracking if requested. | 4777 // Perform in-object slack tracking if requested. |
| 4778 Label slack_tracking; | 4778 Label slack_tracking; |
| 4779 STATIC_ASSERT(Map::kNoSlackTracking == 0); | 4779 STATIC_ASSERT(Map::kNoSlackTracking == 0); |
| 4780 __ lwu(a3, FieldMemOperand(a2, Map::kBitField3Offset)); | 4780 __ lwu(a3, FieldMemOperand(a2, Map::kBitField3Offset)); |
| 4781 __ And(at, a3, Operand(Map::ConstructionCounter::kMask)); | 4781 __ And(at, a3, Operand(Map::ConstructionCounter::kMask)); |
| 4782 __ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(zero_reg)); | 4782 __ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(zero_reg)); |
| 4783 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot. | 4783 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot. |
| 4784 { | 4784 { |
| 4785 // Initialize all in-object fields with undefined. | 4785 // Initialize all in-object fields with undefined. |
| 4786 __ InitializeFieldsWithFiller(a1, a5, a0); | 4786 __ InitializeFieldsWithFiller(a1, a5, a0); |
| 4787 | 4787 __ Ret(); |
| 4788 // Add the object tag to make the JSObject real. | |
| 4789 STATIC_ASSERT(kHeapObjectTag == 1); | |
| 4790 __ Ret(USE_DELAY_SLOT); | |
| 4791 __ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. | |
| 4792 } | 4788 } |
| 4793 __ bind(&slack_tracking); | 4789 __ bind(&slack_tracking); |
| 4794 { | 4790 { |
| 4795 // Decrease generous allocation count. | 4791 // Decrease generous allocation count. |
| 4796 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); | 4792 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); |
| 4797 __ Subu(a3, a3, Operand(1 << Map::ConstructionCounter::kShift)); | 4793 __ Subu(a3, a3, Operand(1 << Map::ConstructionCounter::kShift)); |
| 4798 __ sw(a3, FieldMemOperand(a2, Map::kBitField3Offset)); | 4794 __ sw(a3, FieldMemOperand(a2, Map::kBitField3Offset)); |
| 4799 | 4795 |
| 4800 // Initialize the in-object fields with undefined. | 4796 // Initialize the in-object fields with undefined. |
| 4801 __ lbu(a4, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); | 4797 __ lbu(a4, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); |
| 4802 __ dsll(a4, a4, kPointerSizeLog2); | 4798 __ dsll(a4, a4, kPointerSizeLog2); |
| 4803 __ Dsubu(a4, a5, a4); | 4799 __ Dsubu(a4, a5, a4); |
| 4804 __ InitializeFieldsWithFiller(a1, a4, a0); | 4800 __ InitializeFieldsWithFiller(a1, a4, a0); |
| 4805 | 4801 |
| 4806 // Initialize the remaining (reserved) fields with one pointer filler map. | 4802 // Initialize the remaining (reserved) fields with one pointer filler map. |
| 4807 __ LoadRoot(a0, Heap::kOnePointerFillerMapRootIndex); | 4803 __ LoadRoot(a0, Heap::kOnePointerFillerMapRootIndex); |
| 4808 __ InitializeFieldsWithFiller(a1, a5, a0); | 4804 __ InitializeFieldsWithFiller(a1, a5, a0); |
| 4809 | 4805 |
| 4810 // Check if we can finalize the instance size. | 4806 // Check if we can finalize the instance size. |
| 4811 Label finalize; | 4807 Label finalize; |
| 4812 STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); | 4808 STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); |
| 4813 __ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); | 4809 __ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); |
| 4814 __ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg)); | 4810 __ Branch(&finalize, eq, a3, Operand(zero_reg)); |
| 4815 STATIC_ASSERT(kHeapObjectTag == 1); | |
| 4816 __ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. | |
| 4817 __ Ret(); | 4811 __ Ret(); |
| 4818 | 4812 |
| 4819 // Finalize the instance size. | 4813 // Finalize the instance size. |
| 4820 __ bind(&finalize); | 4814 __ bind(&finalize); |
| 4821 { | 4815 { |
| 4822 FrameScope scope(masm, StackFrame::INTERNAL); | 4816 FrameScope scope(masm, StackFrame::INTERNAL); |
| 4823 __ Push(v0, a2); | 4817 __ Push(v0, a2); |
| 4824 __ CallRuntime(Runtime::kFinalizeInstanceSize); | 4818 __ CallRuntime(Runtime::kFinalizeInstanceSize); |
| 4825 __ Pop(v0); | 4819 __ Pop(v0); |
| 4826 } | 4820 } |
| 4827 __ Ret(); | 4821 __ Ret(); |
| 4828 } | 4822 } |
| 4829 | 4823 |
| 4830 // Fall back to %AllocateInNewSpace. | 4824 // Fall back to %AllocateInNewSpace. |
| 4831 __ bind(&allocate); | 4825 __ bind(&allocate); |
| 4832 { | 4826 { |
| 4833 FrameScope scope(masm, StackFrame::INTERNAL); | 4827 FrameScope scope(masm, StackFrame::INTERNAL); |
| 4834 STATIC_ASSERT(kSmiTag == 0); | 4828 STATIC_ASSERT(kSmiTag == 0); |
| 4835 STATIC_ASSERT(kSmiTagSize == 1); | 4829 STATIC_ASSERT(kSmiTagSize == 1); |
| 4836 __ dsll(a4, a4, kPointerSizeLog2 + kSmiShiftSize + kSmiTagSize); | 4830 __ dsll(a4, a4, kPointerSizeLog2 + kSmiShiftSize + kSmiTagSize); |
| 4837 __ SmiTag(a4); | 4831 __ SmiTag(a4); |
| 4838 __ Push(a2, a4); | 4832 __ Push(a2, a4); |
| 4839 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4833 __ CallRuntime(Runtime::kAllocateInNewSpace); |
| 4840 __ Pop(a2); | 4834 __ Pop(a2); |
| 4841 } | 4835 } |
| 4842 STATIC_ASSERT(kHeapObjectTag == 1); | |
| 4843 __ Dsubu(v0, v0, Operand(kHeapObjectTag)); | |
| 4844 __ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | 4836 __ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset)); |
| 4845 __ Dlsa(a5, v0, a5, kPointerSizeLog2); | 4837 __ Dlsa(a5, v0, a5, kPointerSizeLog2); |
| 4838 STATIC_ASSERT(kHeapObjectTag == 1); |
| 4839 __ Dsubu(a5, a5, Operand(kHeapObjectTag)); |
| 4846 __ jmp(&done_allocate); | 4840 __ jmp(&done_allocate); |
| 4847 | 4841 |
| 4848 // Fall back to %NewObject. | 4842 // Fall back to %NewObject. |
| 4849 __ bind(&new_object); | 4843 __ bind(&new_object); |
| 4850 __ Push(a1, a3); | 4844 __ Push(a1, a3); |
| 4851 __ TailCallRuntime(Runtime::kNewObject); | 4845 __ TailCallRuntime(Runtime::kNewObject); |
| 4852 } | 4846 } |
| 4853 | 4847 |
| 4854 | 4848 |
| 4855 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4849 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4898 // Return an empty rest parameter array. | 4892 // Return an empty rest parameter array. |
| 4899 __ bind(&no_rest_parameters); | 4893 __ bind(&no_rest_parameters); |
| 4900 { | 4894 { |
| 4901 // ----------- S t a t e ------------- | 4895 // ----------- S t a t e ------------- |
| 4902 // -- cp : context | 4896 // -- cp : context |
| 4903 // -- ra : return address | 4897 // -- ra : return address |
| 4904 // ----------------------------------- | 4898 // ----------------------------------- |
| 4905 | 4899 |
| 4906 // Allocate an empty rest parameter array. | 4900 // Allocate an empty rest parameter array. |
| 4907 Label allocate, done_allocate; | 4901 Label allocate, done_allocate; |
| 4908 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, TAG_OBJECT); | 4902 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS); |
| 4909 __ bind(&done_allocate); | 4903 __ bind(&done_allocate); |
| 4910 | 4904 |
| 4911 // Setup the rest parameter array in v0. | 4905 // Setup the rest parameter array in v0. |
| 4912 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1); | 4906 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1); |
| 4913 __ sd(a1, FieldMemOperand(v0, JSArray::kMapOffset)); | 4907 __ sd(a1, FieldMemOperand(v0, JSArray::kMapOffset)); |
| 4914 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex); | 4908 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex); |
| 4915 __ sd(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset)); | 4909 __ sd(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset)); |
| 4916 __ sd(a1, FieldMemOperand(v0, JSArray::kElementsOffset)); | 4910 __ sd(a1, FieldMemOperand(v0, JSArray::kElementsOffset)); |
| 4917 __ Move(a1, Smi::FromInt(0)); | 4911 __ Move(a1, Smi::FromInt(0)); |
| 4918 __ Ret(USE_DELAY_SLOT); | 4912 __ Ret(USE_DELAY_SLOT); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4940 // -- cp : context | 4934 // -- cp : context |
| 4941 // -- a0 : number of rest parameters | 4935 // -- a0 : number of rest parameters |
| 4942 // -- a2 : pointer to first rest parameters | 4936 // -- a2 : pointer to first rest parameters |
| 4943 // -- ra : return address | 4937 // -- ra : return address |
| 4944 // ----------------------------------- | 4938 // ----------------------------------- |
| 4945 | 4939 |
| 4946 // Allocate space for the rest parameter array plus the backing store. | 4940 // Allocate space for the rest parameter array plus the backing store. |
| 4947 Label allocate, done_allocate; | 4941 Label allocate, done_allocate; |
| 4948 __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); | 4942 __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); |
| 4949 __ Dlsa(a1, a1, a0, kPointerSizeLog2); | 4943 __ Dlsa(a1, a1, a0, kPointerSizeLog2); |
| 4950 __ Allocate(a1, v0, a3, a4, &allocate, TAG_OBJECT); | 4944 __ Allocate(a1, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS); |
| 4951 __ bind(&done_allocate); | 4945 __ bind(&done_allocate); |
| 4952 | 4946 |
| 4953 // Compute arguments.length in a4. | 4947 // Compute arguments.length in a4. |
| 4954 __ SmiTag(a4, a0); | 4948 __ SmiTag(a4, a0); |
| 4955 | 4949 |
| 4956 // Setup the elements array in v0. | 4950 // Setup the elements array in v0. |
| 4957 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); | 4951 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); |
| 4958 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset)); | 4952 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset)); |
| 4959 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 4953 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
| 4960 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize)); | 4954 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize)); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5081 | 5075 |
| 5082 // 2. Backing store. | 5076 // 2. Backing store. |
| 5083 __ SmiScale(t2, a5, kPointerSizeLog2); | 5077 __ SmiScale(t2, a5, kPointerSizeLog2); |
| 5084 __ Daddu(t1, t1, Operand(t2)); | 5078 __ Daddu(t1, t1, Operand(t2)); |
| 5085 __ Daddu(t1, t1, Operand(FixedArray::kHeaderSize)); | 5079 __ Daddu(t1, t1, Operand(FixedArray::kHeaderSize)); |
| 5086 | 5080 |
| 5087 // 3. Arguments object. | 5081 // 3. Arguments object. |
| 5088 __ Daddu(t1, t1, Operand(JSSloppyArgumentsObject::kSize)); | 5082 __ Daddu(t1, t1, Operand(JSSloppyArgumentsObject::kSize)); |
| 5089 | 5083 |
| 5090 // Do the allocation of all three objects in one go. | 5084 // Do the allocation of all three objects in one go. |
| 5091 __ Allocate(t1, v0, t1, a4, &runtime, TAG_OBJECT); | 5085 __ Allocate(t1, v0, t1, a4, &runtime, NO_ALLOCATION_FLAGS); |
| 5092 | 5086 |
| 5093 // v0 = address of new object(s) (tagged) | 5087 // v0 = address of new object(s) (tagged) |
| 5094 // a2 = argument count (smi-tagged) | 5088 // a2 = argument count (smi-tagged) |
| 5095 // Get the arguments boilerplate from the current native context into a4. | 5089 // Get the arguments boilerplate from the current native context into a4. |
| 5096 const int kNormalOffset = | 5090 const int kNormalOffset = |
| 5097 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); | 5091 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
| 5098 const int kAliasedOffset = | 5092 const int kAliasedOffset = |
| 5099 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX); | 5093 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX); |
| 5100 | 5094 |
| 5101 __ ld(a4, NativeContextMemOperand()); | 5095 __ ld(a4, NativeContextMemOperand()); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5287 // -- cp : context | 5281 // -- cp : context |
| 5288 // -- a0 : number of rest parameters | 5282 // -- a0 : number of rest parameters |
| 5289 // -- a2 : pointer to first rest parameters | 5283 // -- a2 : pointer to first rest parameters |
| 5290 // -- ra : return address | 5284 // -- ra : return address |
| 5291 // ----------------------------------- | 5285 // ----------------------------------- |
| 5292 | 5286 |
| 5293 // Allocate space for the rest parameter array plus the backing store. | 5287 // Allocate space for the rest parameter array plus the backing store. |
| 5294 Label allocate, done_allocate; | 5288 Label allocate, done_allocate; |
| 5295 __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); | 5289 __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); |
| 5296 __ Dlsa(a1, a1, a0, kPointerSizeLog2); | 5290 __ Dlsa(a1, a1, a0, kPointerSizeLog2); |
| 5297 __ Allocate(a1, v0, a3, a4, &allocate, TAG_OBJECT); | 5291 __ Allocate(a1, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS); |
| 5298 __ bind(&done_allocate); | 5292 __ bind(&done_allocate); |
| 5299 | 5293 |
| 5300 // Compute arguments.length in a4. | 5294 // Compute arguments.length in a4. |
| 5301 __ SmiTag(a4, a0); | 5295 __ SmiTag(a4, a0); |
| 5302 | 5296 |
| 5303 // Setup the elements array in v0. | 5297 // Setup the elements array in v0. |
| 5304 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); | 5298 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); |
| 5305 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset)); | 5299 __ sd(at, FieldMemOperand(v0, FixedArray::kMapOffset)); |
| 5306 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 5300 __ sd(a4, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
| 5307 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize)); | 5301 __ Daddu(a3, v0, Operand(FixedArray::kHeaderSize)); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5785 kStackUnwindSpace, kInvalidStackOffset, | 5779 kStackUnwindSpace, kInvalidStackOffset, |
| 5786 return_value_operand, NULL); | 5780 return_value_operand, NULL); |
| 5787 } | 5781 } |
| 5788 | 5782 |
| 5789 #undef __ | 5783 #undef __ |
| 5790 | 5784 |
| 5791 } // namespace internal | 5785 } // namespace internal |
| 5792 } // namespace v8 | 5786 } // namespace v8 |
| 5793 | 5787 |
| 5794 #endif // V8_TARGET_ARCH_MIPS64 | 5788 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |