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

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

Issue 1773533002: MIPS64: Fix [stubs] Introduce a dedicated FastNewObjectStub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing master Created 4 years, 9 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 | « no previous file | no next file » | 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/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 4737 matching lines...) Expand 10 before | Expand all | Expand 10 after
4748 4748
4749 // Verify that the new target is a JSFunction. 4749 // Verify that the new target is a JSFunction.
4750 Label new_object; 4750 Label new_object;
4751 __ GetObjectType(a3, a2, a2); 4751 __ GetObjectType(a3, a2, a2);
4752 __ Branch(&new_object, ne, a2, Operand(JS_FUNCTION_TYPE)); 4752 __ Branch(&new_object, ne, a2, Operand(JS_FUNCTION_TYPE));
4753 4753
4754 // Load the initial map and verify that it's in fact a map. 4754 // Load the initial map and verify that it's in fact a map.
4755 __ ld(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset)); 4755 __ ld(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset));
4756 __ JumpIfSmi(a2, &new_object); 4756 __ JumpIfSmi(a2, &new_object);
4757 __ GetObjectType(a2, a0, a0); 4757 __ GetObjectType(a2, a0, a0);
4758 __ Branch(&new_object, ne, a2, Operand(MAP_TYPE)); 4758 __ Branch(&new_object, ne, a0, Operand(MAP_TYPE));
4759 4759
4760 // Fall back to runtime if the target differs from the new target's 4760 // Fall back to runtime if the target differs from the new target's
4761 // initial map constructor. 4761 // initial map constructor.
4762 __ ld(a0, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); 4762 __ ld(a0, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset));
4763 __ Branch(&new_object, ne, a0, Operand(a1)); 4763 __ Branch(&new_object, ne, a0, Operand(a1));
4764 4764
4765 // Allocate the JSObject on the heap. 4765 // Allocate the JSObject on the heap.
4766 Label allocate, done_allocate; 4766 Label allocate, done_allocate;
4767 __ lbu(a4, FieldMemOperand(a2, Map::kInstanceSizeOffset)); 4767 __ lbu(a4, FieldMemOperand(a2, Map::kInstanceSizeOffset));
4768 __ Allocate(a4, v0, a5, a0, &allocate, SIZE_IN_WORDS); 4768 __ Allocate(a4, v0, a5, a0, &allocate, SIZE_IN_WORDS);
4769 __ bind(&done_allocate); 4769 __ bind(&done_allocate);
4770 4770
4771 // Initialize the JSObject fields. 4771 // Initialize the JSObject fields.
4772 __ sd(a2, MemOperand(v0, JSObject::kMapOffset)); 4772 __ sd(a2, MemOperand(v0, JSObject::kMapOffset));
4773 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); 4773 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex);
4774 __ sd(a3, MemOperand(v0, JSObject::kPropertiesOffset)); 4774 __ sd(a3, MemOperand(v0, JSObject::kPropertiesOffset));
4775 __ sd(a3, MemOperand(v0, JSObject::kElementsOffset)); 4775 __ sd(a3, MemOperand(v0, JSObject::kElementsOffset));
4776 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); 4776 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
4777 __ Addu(a1, v0, Operand(JSObject::kHeaderSize)); 4777 __ Daddu(a1, v0, Operand(JSObject::kHeaderSize));
4778 4778
4779 // ----------- S t a t e ------------- 4779 // ----------- S t a t e -------------
4780 // -- v0 : result (untagged) 4780 // -- v0 : result (untagged)
4781 // -- a1 : result fields (untagged) 4781 // -- a1 : result fields (untagged)
4782 // -- a5 : result end (untagged) 4782 // -- a5 : result end (untagged)
4783 // -- a2 : initial map 4783 // -- a2 : initial map
4784 // -- cp : context 4784 // -- cp : context
4785 // -- ra : return address 4785 // -- ra : return address
4786 // ----------------------------------- 4786 // -----------------------------------
4787 4787
4788 // Perform in-object slack tracking if requested. 4788 // Perform in-object slack tracking if requested.
4789 Label slack_tracking; 4789 Label slack_tracking;
4790 STATIC_ASSERT(Map::kNoSlackTracking == 0); 4790 STATIC_ASSERT(Map::kNoSlackTracking == 0);
4791 __ lw(a3, FieldMemOperand(a2, Map::kBitField3Offset)); 4791 __ lwu(a3, FieldMemOperand(a2, Map::kBitField3Offset));
4792 __ And(at, a3, Operand(Map::ConstructionCounter::kMask)); 4792 __ And(at, a3, Operand(Map::ConstructionCounter::kMask));
4793 __ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(zero_reg)); 4793 __ Branch(USE_DELAY_SLOT, &slack_tracking, ne, at, Operand(zero_reg));
4794 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot. 4794 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); // In delay slot.
4795 { 4795 {
4796 // Initialize all in-object fields with undefined. 4796 // Initialize all in-object fields with undefined.
4797 __ InitializeFieldsWithFiller(a1, a5, a0); 4797 __ InitializeFieldsWithFiller(a1, a5, a0);
4798 4798
4799 // Add the object tag to make the JSObject real. 4799 // Add the object tag to make the JSObject real.
4800 STATIC_ASSERT(kHeapObjectTag == 1); 4800 STATIC_ASSERT(kHeapObjectTag == 1);
4801 __ Ret(USE_DELAY_SLOT); 4801 __ Ret(USE_DELAY_SLOT);
4802 __ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. 4802 __ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
4803 } 4803 }
4804 __ bind(&slack_tracking); 4804 __ bind(&slack_tracking);
4805 { 4805 {
4806 // Decrease generous allocation count. 4806 // Decrease generous allocation count.
4807 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); 4807 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32);
4808 __ Subu(a3, a3, Operand(1 << Map::ConstructionCounter::kShift)); 4808 __ Subu(a3, a3, Operand(1 << Map::ConstructionCounter::kShift));
4809 __ sw(a3, FieldMemOperand(a2, Map::kBitField3Offset)); 4809 __ sw(a3, FieldMemOperand(a2, Map::kBitField3Offset));
4810 4810
4811 // Initialize the in-object fields with undefined. 4811 // Initialize the in-object fields with undefined.
4812 __ lbu(a4, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); 4812 __ lbu(a4, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset));
4813 __ dsll(a4, a4, kPointerSizeLog2); 4813 __ dsll(a4, a4, kPointerSizeLog2);
4814 __ Dsubu(a4, a5, a4); 4814 __ Dsubu(a4, a5, a4);
4815 __ InitializeFieldsWithFiller(a1, a4, a0); 4815 __ InitializeFieldsWithFiller(a1, a4, a0);
4816 4816
4817 // Initialize the remaining (reserved) fields with one pointer filler map. 4817 // Initialize the remaining (reserved) fields with one pointer filler map.
4818 __ LoadRoot(a0, Heap::kOnePointerFillerMapRootIndex); 4818 __ LoadRoot(a0, Heap::kOnePointerFillerMapRootIndex);
4819 __ InitializeFieldsWithFiller(a1, a5, a0); 4819 __ InitializeFieldsWithFiller(a1, a5, a0);
4820 4820
4821 // Check if we can finalize the instance size. 4821 // Check if we can finalize the instance size.
4822 Label finalize; 4822 Label finalize;
4823 STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); 4823 STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
4824 __ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); 4824 __ And(a3, a3, Operand(Map::ConstructionCounter::kMask));
4825 __ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg)); 4825 __ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg));
4826 STATIC_ASSERT(kHeapObjectTag == 1); 4826 STATIC_ASSERT(kHeapObjectTag == 1);
4827 __ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. 4827 __ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
4828 __ Ret(); 4828 __ Ret();
4829 4829
4830 // Finalize the instance size. 4830 // Finalize the instance size.
4831 __ bind(&finalize); 4831 __ bind(&finalize);
4832 { 4832 {
4833 FrameScope scope(masm, StackFrame::INTERNAL); 4833 FrameScope scope(masm, StackFrame::INTERNAL);
4834 __ Push(v0, a2); 4834 __ Push(v0, a2);
4835 __ CallRuntime(Runtime::kFinalizeInstanceSize); 4835 __ CallRuntime(Runtime::kFinalizeInstanceSize);
4836 __ Pop(v0); 4836 __ Pop(v0);
4837 } 4837 }
4838 __ Ret(); 4838 __ Ret();
4839 } 4839 }
4840 4840
4841 // Fall back to %AllocateInNewSpace. 4841 // Fall back to %AllocateInNewSpace.
4842 __ bind(&allocate); 4842 __ bind(&allocate);
4843 { 4843 {
4844 FrameScope scope(masm, StackFrame::INTERNAL); 4844 FrameScope scope(masm, StackFrame::INTERNAL);
4845 STATIC_ASSERT(kSmiTag == 0); 4845 STATIC_ASSERT(kSmiTag == 0);
4846 STATIC_ASSERT(kSmiTagSize == 1); 4846 STATIC_ASSERT(kSmiTagSize == 1);
4847 __ dsll(a4, a4, kPointerSizeLog2 + kSmiShiftSize + kSmiTagSize); 4847 __ dsll(a4, a4, kPointerSizeLog2 + kSmiShiftSize + kSmiTagSize);
4848 __ SmiTag(a4);
4848 __ Push(a2, a4); 4849 __ Push(a2, a4);
4849 __ CallRuntime(Runtime::kAllocateInNewSpace); 4850 __ CallRuntime(Runtime::kAllocateInNewSpace);
4850 __ Pop(a2); 4851 __ Pop(a2);
4851 } 4852 }
4852 STATIC_ASSERT(kHeapObjectTag == 1); 4853 STATIC_ASSERT(kHeapObjectTag == 1);
4853 __ Dsubu(v0, v0, Operand(kHeapObjectTag)); 4854 __ Dsubu(v0, v0, Operand(kHeapObjectTag));
4854 __ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset)); 4855 __ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset));
4855 __ Lsa(a5, v0, a5, kPointerSizeLog2); 4856 __ Dlsa(a5, v0, a5, kPointerSizeLog2);
4856 __ jmp(&done_allocate); 4857 __ jmp(&done_allocate);
4857 4858
4858 // Fall back to %NewObject. 4859 // Fall back to %NewObject.
4859 __ bind(&new_object); 4860 __ bind(&new_object);
4860 __ Push(a1, a3); 4861 __ Push(a1, a3);
4861 __ TailCallRuntime(Runtime::kNewObject); 4862 __ TailCallRuntime(Runtime::kNewObject);
4862 } 4863 }
4863 4864
4864 4865
4865 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { 4866 void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
5797 return_value_operand, NULL); 5798 return_value_operand, NULL);
5798 } 5799 }
5799 5800
5800 5801
5801 #undef __ 5802 #undef __
5802 5803
5803 } // namespace internal 5804 } // namespace internal
5804 } // namespace v8 5805 } // namespace v8
5805 5806
5806 #endif // V8_TARGET_ARCH_MIPS64 5807 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698