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

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

Issue 1922553002: Get rid of AllocationFlags::TAG_OBJECT (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove TAG_OBJECT from AllocationFlags Created 4 years, 8 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/macro-assembler.h ('k') | src/mips/codegen-mips.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 4730 matching lines...) Expand 10 before | Expand all | Expand 10 after
4741 __ lw(a0, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); 4741 __ lw(a0, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset));
4742 __ Branch(&new_object, ne, a0, Operand(a1)); 4742 __ Branch(&new_object, ne, a0, Operand(a1));
4743 4743
4744 // Allocate the JSObject on the heap. 4744 // Allocate the JSObject on the heap.
4745 Label allocate, done_allocate; 4745 Label allocate, done_allocate;
4746 __ lbu(t0, FieldMemOperand(a2, Map::kInstanceSizeOffset)); 4746 __ lbu(t0, FieldMemOperand(a2, Map::kInstanceSizeOffset));
4747 __ Allocate(t0, v0, t1, a0, &allocate, SIZE_IN_WORDS); 4747 __ Allocate(t0, v0, t1, a0, &allocate, SIZE_IN_WORDS);
4748 __ bind(&done_allocate); 4748 __ bind(&done_allocate);
4749 4749
4750 // Initialize the JSObject fields. 4750 // Initialize the JSObject fields.
4751 __ sw(a2, MemOperand(v0, JSObject::kMapOffset)); 4751 __ sw(a2, FieldMemOperand(v0, JSObject::kMapOffset));
4752 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); 4752 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex);
4753 __ sw(a3, MemOperand(v0, JSObject::kPropertiesOffset)); 4753 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset));
4754 __ sw(a3, MemOperand(v0, JSObject::kElementsOffset)); 4754 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset));
4755 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); 4755 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
4756 __ Addu(a1, v0, Operand(JSObject::kHeaderSize)); 4756 __ Addu(a1, v0, Operand(JSObject::kHeaderSize - kHeapObjectTag));
4757 4757
4758 // ----------- S t a t e ------------- 4758 // ----------- S t a t e -------------
4759 // -- v0 : result (untagged) 4759 // -- v0 : result (tagged)
4760 // -- a1 : result fields (untagged) 4760 // -- a1 : result fields (untagged)
4761 // -- t1 : result end (untagged) 4761 // -- t1 : result end (untagged)
4762 // -- a2 : initial map 4762 // -- a2 : initial map
4763 // -- cp : context 4763 // -- cp : context
4764 // -- ra : return address 4764 // -- ra : return address
4765 // ----------------------------------- 4765 // -----------------------------------
4766 4766
4767 // Perform in-object slack tracking if requested. 4767 // Perform in-object slack tracking if requested.
4768 Label slack_tracking; 4768 Label slack_tracking;
4769 STATIC_ASSERT(Map::kNoSlackTracking == 0); 4769 STATIC_ASSERT(Map::kNoSlackTracking == 0);
4770 __ lw(a3, FieldMemOperand(a2, Map::kBitField3Offset)); 4770 __ lw(a3, FieldMemOperand(a2, Map::kBitField3Offset));
4771 __ And(at, a3, Operand(Map::ConstructionCounter::kMask)); 4771 __ And(at, a3, Operand(Map::ConstructionCounter::kMask));
4772 __ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(0)); 4772 __ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(0));
4773 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot. 4773 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot.
4774 { 4774 {
4775 // Initialize all in-object fields with undefined. 4775 // Initialize all in-object fields with undefined.
4776 __ InitializeFieldsWithFiller(a1, t1, a0); 4776 __ InitializeFieldsWithFiller(a1, t1, a0);
4777 4777 __ Ret();
4778 // Add the object tag to make the JSObject real.
4779 STATIC_ASSERT(kHeapObjectTag == 1);
4780 __ Ret(USE_DELAY_SLOT);
4781 __ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
4782 } 4778 }
4783 __ bind(&slack_tracking); 4779 __ bind(&slack_tracking);
4784 { 4780 {
4785 // Decrease generous allocation count. 4781 // Decrease generous allocation count.
4786 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); 4782 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32);
4787 __ Subu(a3, a3, Operand(1 << Map::ConstructionCounter::kShift)); 4783 __ Subu(a3, a3, Operand(1 << Map::ConstructionCounter::kShift));
4788 __ sw(a3, FieldMemOperand(a2, Map::kBitField3Offset)); 4784 __ sw(a3, FieldMemOperand(a2, Map::kBitField3Offset));
4789 4785
4790 // Initialize the in-object fields with undefined. 4786 // Initialize the in-object fields with undefined.
4791 __ lbu(t0, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); 4787 __ lbu(t0, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset));
4792 __ sll(t0, t0, kPointerSizeLog2); 4788 __ sll(t0, t0, kPointerSizeLog2);
4793 __ subu(t0, t1, t0); 4789 __ subu(t0, t1, t0);
4794 __ InitializeFieldsWithFiller(a1, t0, a0); 4790 __ InitializeFieldsWithFiller(a1, t0, a0);
4795 4791
4796 // Initialize the remaining (reserved) fields with one pointer filler map. 4792 // Initialize the remaining (reserved) fields with one pointer filler map.
4797 __ LoadRoot(a0, Heap::kOnePointerFillerMapRootIndex); 4793 __ LoadRoot(a0, Heap::kOnePointerFillerMapRootIndex);
4798 __ InitializeFieldsWithFiller(a1, t1, a0); 4794 __ InitializeFieldsWithFiller(a1, t1, a0);
4799 4795
4800 // Check if we can finalize the instance size. 4796 // Check if we can finalize the instance size.
4801 Label finalize; 4797 Label finalize;
4802 STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); 4798 STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
4803 __ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); 4799 __ And(a3, a3, Operand(Map::ConstructionCounter::kMask));
4804 __ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg)); 4800 __ Branch(&finalize, eq, a3, Operand(zero_reg));
4805 STATIC_ASSERT(kHeapObjectTag == 1);
4806 __ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
4807 __ Ret(); 4801 __ Ret();
4808 4802
4809 // Finalize the instance size. 4803 // Finalize the instance size.
4810 __ bind(&finalize); 4804 __ bind(&finalize);
4811 { 4805 {
4812 FrameScope scope(masm, StackFrame::INTERNAL); 4806 FrameScope scope(masm, StackFrame::INTERNAL);
4813 __ Push(v0, a2); 4807 __ Push(v0, a2);
4814 __ CallRuntime(Runtime::kFinalizeInstanceSize); 4808 __ CallRuntime(Runtime::kFinalizeInstanceSize);
4815 __ Pop(v0); 4809 __ Pop(v0);
4816 } 4810 }
4817 __ Ret(); 4811 __ Ret();
4818 } 4812 }
4819 4813
4820 // Fall back to %AllocateInNewSpace. 4814 // Fall back to %AllocateInNewSpace.
4821 __ bind(&allocate); 4815 __ bind(&allocate);
4822 { 4816 {
4823 FrameScope scope(masm, StackFrame::INTERNAL); 4817 FrameScope scope(masm, StackFrame::INTERNAL);
4824 STATIC_ASSERT(kSmiTag == 0); 4818 STATIC_ASSERT(kSmiTag == 0);
4825 STATIC_ASSERT(kSmiTagSize == 1); 4819 STATIC_ASSERT(kSmiTagSize == 1);
4826 __ sll(t0, t0, kPointerSizeLog2 + kSmiTagSize); 4820 __ sll(t0, t0, kPointerSizeLog2 + kSmiTagSize);
4827 __ Push(a2, t0); 4821 __ Push(a2, t0);
4828 __ CallRuntime(Runtime::kAllocateInNewSpace); 4822 __ CallRuntime(Runtime::kAllocateInNewSpace);
4829 __ Pop(a2); 4823 __ Pop(a2);
4830 } 4824 }
4831 STATIC_ASSERT(kHeapObjectTag == 1);
4832 __ Subu(v0, v0, Operand(kHeapObjectTag));
4833 __ lbu(t1, FieldMemOperand(a2, Map::kInstanceSizeOffset)); 4825 __ lbu(t1, FieldMemOperand(a2, Map::kInstanceSizeOffset));
4834 __ Lsa(t1, v0, t1, kPointerSizeLog2); 4826 __ Lsa(t1, v0, t1, kPointerSizeLog2);
4827 STATIC_ASSERT(kHeapObjectTag == 1);
4828 __ Subu(t1, t1, Operand(kHeapObjectTag));
4835 __ jmp(&done_allocate); 4829 __ jmp(&done_allocate);
4836 4830
4837 // Fall back to %NewObject. 4831 // Fall back to %NewObject.
4838 __ bind(&new_object); 4832 __ bind(&new_object);
4839 __ Push(a1, a3); 4833 __ Push(a1, a3);
4840 __ TailCallRuntime(Runtime::kNewObject); 4834 __ TailCallRuntime(Runtime::kNewObject);
4841 } 4835 }
4842 4836
4843 4837
4844 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { 4838 void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4886 // Return an empty rest parameter array. 4880 // Return an empty rest parameter array.
4887 __ bind(&no_rest_parameters); 4881 __ bind(&no_rest_parameters);
4888 { 4882 {
4889 // ----------- S t a t e ------------- 4883 // ----------- S t a t e -------------
4890 // -- cp : context 4884 // -- cp : context
4891 // -- ra : return address 4885 // -- ra : return address
4892 // ----------------------------------- 4886 // -----------------------------------
4893 4887
4894 // Allocate an empty rest parameter array. 4888 // Allocate an empty rest parameter array.
4895 Label allocate, done_allocate; 4889 Label allocate, done_allocate;
4896 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, TAG_OBJECT); 4890 __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS);
4897 __ bind(&done_allocate); 4891 __ bind(&done_allocate);
4898 4892
4899 // Setup the rest parameter array in v0. 4893 // Setup the rest parameter array in v0.
4900 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1); 4894 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, a1);
4901 __ sw(a1, FieldMemOperand(v0, JSArray::kMapOffset)); 4895 __ sw(a1, FieldMemOperand(v0, JSArray::kMapOffset));
4902 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex); 4896 __ LoadRoot(a1, Heap::kEmptyFixedArrayRootIndex);
4903 __ sw(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset)); 4897 __ sw(a1, FieldMemOperand(v0, JSArray::kPropertiesOffset));
4904 __ sw(a1, FieldMemOperand(v0, JSArray::kElementsOffset)); 4898 __ sw(a1, FieldMemOperand(v0, JSArray::kElementsOffset));
4905 __ Move(a1, Smi::FromInt(0)); 4899 __ Move(a1, Smi::FromInt(0));
4906 __ Ret(USE_DELAY_SLOT); 4900 __ Ret(USE_DELAY_SLOT);
(...skipping 21 matching lines...) Expand all
4928 // -- cp : context 4922 // -- cp : context
4929 // -- a0 : number of rest parameters (tagged) 4923 // -- a0 : number of rest parameters (tagged)
4930 // -- a2 : pointer to first rest parameters 4924 // -- a2 : pointer to first rest parameters
4931 // -- ra : return address 4925 // -- ra : return address
4932 // ----------------------------------- 4926 // -----------------------------------
4933 4927
4934 // Allocate space for the rest parameter array plus the backing store. 4928 // Allocate space for the rest parameter array plus the backing store.
4935 Label allocate, done_allocate; 4929 Label allocate, done_allocate;
4936 __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); 4930 __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize));
4937 __ Lsa(a1, a1, a0, kPointerSizeLog2 - 1); 4931 __ Lsa(a1, a1, a0, kPointerSizeLog2 - 1);
4938 __ Allocate(a1, v0, a3, t0, &allocate, TAG_OBJECT); 4932 __ Allocate(a1, v0, a3, t0, &allocate, NO_ALLOCATION_FLAGS);
4939 __ bind(&done_allocate); 4933 __ bind(&done_allocate);
4940 4934
4941 // Setup the elements array in v0. 4935 // Setup the elements array in v0.
4942 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); 4936 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
4943 __ sw(at, FieldMemOperand(v0, FixedArray::kMapOffset)); 4937 __ sw(at, FieldMemOperand(v0, FixedArray::kMapOffset));
4944 __ sw(a0, FieldMemOperand(v0, FixedArray::kLengthOffset)); 4938 __ sw(a0, FieldMemOperand(v0, FixedArray::kLengthOffset));
4945 __ Addu(a3, v0, Operand(FixedArray::kHeaderSize)); 4939 __ Addu(a3, v0, Operand(FixedArray::kHeaderSize));
4946 { 4940 {
4947 Label loop, done_loop; 4941 Label loop, done_loop;
4948 __ sll(at, a0, kPointerSizeLog2 - 1); 4942 __ sll(at, a0, kPointerSizeLog2 - 1);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 __ bind(&param_map_size); 5056 __ bind(&param_map_size);
5063 5057
5064 // 2. Backing store. 5058 // 2. Backing store.
5065 __ Lsa(t5, t5, t1, 1); 5059 __ Lsa(t5, t5, t1, 1);
5066 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); 5060 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize));
5067 5061
5068 // 3. Arguments object. 5062 // 3. Arguments object.
5069 __ Addu(t5, t5, Operand(JSSloppyArgumentsObject::kSize)); 5063 __ Addu(t5, t5, Operand(JSSloppyArgumentsObject::kSize));
5070 5064
5071 // Do the allocation of all three objects in one go. 5065 // Do the allocation of all three objects in one go.
5072 __ Allocate(t5, v0, t5, t0, &runtime, TAG_OBJECT); 5066 __ Allocate(t5, v0, t5, t0, &runtime, NO_ALLOCATION_FLAGS);
5073 5067
5074 // v0 = address of new object(s) (tagged) 5068 // v0 = address of new object(s) (tagged)
5075 // a2 = argument count (smi-tagged) 5069 // a2 = argument count (smi-tagged)
5076 // Get the arguments boilerplate from the current native context into t0. 5070 // Get the arguments boilerplate from the current native context into t0.
5077 const int kNormalOffset = 5071 const int kNormalOffset =
5078 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); 5072 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX);
5079 const int kAliasedOffset = 5073 const int kAliasedOffset =
5080 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX); 5074 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX);
5081 5075
5082 __ lw(t0, NativeContextMemOperand()); 5076 __ lw(t0, NativeContextMemOperand());
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
5264 // -- cp : context 5258 // -- cp : context
5265 // -- a0 : number of rest parameters (tagged) 5259 // -- a0 : number of rest parameters (tagged)
5266 // -- a2 : pointer to first rest parameters 5260 // -- a2 : pointer to first rest parameters
5267 // -- ra : return address 5261 // -- ra : return address
5268 // ----------------------------------- 5262 // -----------------------------------
5269 5263
5270 // Allocate space for the strict arguments object plus the backing store. 5264 // Allocate space for the strict arguments object plus the backing store.
5271 Label allocate, done_allocate; 5265 Label allocate, done_allocate;
5272 __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); 5266 __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
5273 __ Lsa(a1, a1, a0, kPointerSizeLog2 - 1); 5267 __ Lsa(a1, a1, a0, kPointerSizeLog2 - 1);
5274 __ Allocate(a1, v0, a3, t0, &allocate, TAG_OBJECT); 5268 __ Allocate(a1, v0, a3, t0, &allocate, NO_ALLOCATION_FLAGS);
5275 __ bind(&done_allocate); 5269 __ bind(&done_allocate);
5276 5270
5277 // Setup the elements array in v0. 5271 // Setup the elements array in v0.
5278 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex); 5272 __ LoadRoot(at, Heap::kFixedArrayMapRootIndex);
5279 __ sw(at, FieldMemOperand(v0, FixedArray::kMapOffset)); 5273 __ sw(at, FieldMemOperand(v0, FixedArray::kMapOffset));
5280 __ sw(a0, FieldMemOperand(v0, FixedArray::kLengthOffset)); 5274 __ sw(a0, FieldMemOperand(v0, FixedArray::kLengthOffset));
5281 __ Addu(a3, v0, Operand(FixedArray::kHeaderSize)); 5275 __ Addu(a3, v0, Operand(FixedArray::kHeaderSize));
5282 { 5276 {
5283 Label loop, done_loop; 5277 Label loop, done_loop;
5284 __ sll(at, a0, kPointerSizeLog2 - 1); 5278 __ sll(at, a0, kPointerSizeLog2 - 1);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
5753 kStackUnwindSpace, kInvalidStackOffset, 5747 kStackUnwindSpace, kInvalidStackOffset,
5754 return_value_operand, NULL); 5748 return_value_operand, NULL);
5755 } 5749 }
5756 5750
5757 #undef __ 5751 #undef __
5758 5752
5759 } // namespace internal 5753 } // namespace internal
5760 } // namespace v8 5754 } // namespace v8
5761 5755
5762 #endif // V8_TARGET_ARCH_MIPS 5756 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/macro-assembler.h ('k') | src/mips/codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698