| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 4680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4691 __ cmp(r3, r4); | 4691 __ cmp(r3, r4); |
| 4692 __ bne(&new_object); | 4692 __ bne(&new_object); |
| 4693 | 4693 |
| 4694 // Allocate the JSObject on the heap. | 4694 // Allocate the JSObject on the heap. |
| 4695 Label allocate, done_allocate; | 4695 Label allocate, done_allocate; |
| 4696 __ lbz(r7, FieldMemOperand(r5, Map::kInstanceSizeOffset)); | 4696 __ lbz(r7, FieldMemOperand(r5, Map::kInstanceSizeOffset)); |
| 4697 __ Allocate(r7, r3, r8, r9, &allocate, SIZE_IN_WORDS); | 4697 __ Allocate(r7, r3, r8, r9, &allocate, SIZE_IN_WORDS); |
| 4698 __ bind(&done_allocate); | 4698 __ bind(&done_allocate); |
| 4699 | 4699 |
| 4700 // Initialize the JSObject fields. | 4700 // Initialize the JSObject fields. |
| 4701 __ StoreP(r5, MemOperand(r3, JSObject::kMapOffset)); | 4701 __ StoreP(r5, FieldMemOperand(r3, JSObject::kMapOffset), r0); |
| 4702 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); | 4702 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); |
| 4703 __ StoreP(r6, MemOperand(r3, JSObject::kPropertiesOffset)); | 4703 __ StoreP(r6, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); |
| 4704 __ StoreP(r6, MemOperand(r3, JSObject::kElementsOffset)); | 4704 __ StoreP(r6, FieldMemOperand(r3, JSObject::kElementsOffset), r0); |
| 4705 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 4705 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); |
| 4706 __ addi(r4, r3, Operand(JSObject::kHeaderSize)); | 4706 __ addi(r4, r3, Operand(JSObject::kHeaderSize - kHeapObjectTag)); |
| 4707 | 4707 |
| 4708 // ----------- S t a t e ------------- | 4708 // ----------- S t a t e ------------- |
| 4709 // -- r3 : result (untagged) | 4709 // -- r3 : result (tagged) |
| 4710 // -- r4 : result fields (untagged) | 4710 // -- r4 : result fields (untagged) |
| 4711 // -- r8 : result end (untagged) | 4711 // -- r8 : result end (untagged) |
| 4712 // -- r5 : initial map | 4712 // -- r5 : initial map |
| 4713 // -- cp : context | 4713 // -- cp : context |
| 4714 // -- lr : return address | 4714 // -- lr : return address |
| 4715 // ----------------------------------- | 4715 // ----------------------------------- |
| 4716 | 4716 |
| 4717 // Perform in-object slack tracking if requested. | 4717 // Perform in-object slack tracking if requested. |
| 4718 Label slack_tracking; | 4718 Label slack_tracking; |
| 4719 STATIC_ASSERT(Map::kNoSlackTracking == 0); | 4719 STATIC_ASSERT(Map::kNoSlackTracking == 0); |
| 4720 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex); | 4720 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex); |
| 4721 __ lwz(r6, FieldMemOperand(r5, Map::kBitField3Offset)); | 4721 __ lwz(r6, FieldMemOperand(r5, Map::kBitField3Offset)); |
| 4722 __ DecodeField<Map::ConstructionCounter>(r10, r6, SetRC); | 4722 __ DecodeField<Map::ConstructionCounter>(r10, r6, SetRC); |
| 4723 __ bne(&slack_tracking, cr0); | 4723 __ bne(&slack_tracking, cr0); |
| 4724 { | 4724 { |
| 4725 // Initialize all in-object fields with undefined. | 4725 // Initialize all in-object fields with undefined. |
| 4726 __ InitializeFieldsWithFiller(r4, r8, r9); | 4726 __ InitializeFieldsWithFiller(r4, r8, r9); |
| 4727 | |
| 4728 // Add the object tag to make the JSObject real. | |
| 4729 __ addi(r3, r3, Operand(kHeapObjectTag)); | |
| 4730 __ Ret(); | 4727 __ Ret(); |
| 4731 } | 4728 } |
| 4732 __ bind(&slack_tracking); | 4729 __ bind(&slack_tracking); |
| 4733 { | 4730 { |
| 4734 // Decrease generous allocation count. | 4731 // Decrease generous allocation count. |
| 4735 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); | 4732 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); |
| 4736 __ Add(r6, r6, -(1 << Map::ConstructionCounter::kShift), r0); | 4733 __ Add(r6, r6, -(1 << Map::ConstructionCounter::kShift), r0); |
| 4737 __ stw(r6, FieldMemOperand(r5, Map::kBitField3Offset)); | 4734 __ stw(r6, FieldMemOperand(r5, Map::kBitField3Offset)); |
| 4738 | 4735 |
| 4739 // Initialize the in-object fields with undefined. | 4736 // Initialize the in-object fields with undefined. |
| 4740 __ lbz(r7, FieldMemOperand(r5, Map::kUnusedPropertyFieldsOffset)); | 4737 __ lbz(r7, FieldMemOperand(r5, Map::kUnusedPropertyFieldsOffset)); |
| 4741 __ ShiftLeftImm(r7, r7, Operand(kPointerSizeLog2)); | 4738 __ ShiftLeftImm(r7, r7, Operand(kPointerSizeLog2)); |
| 4742 __ sub(r7, r8, r7); | 4739 __ sub(r7, r8, r7); |
| 4743 __ InitializeFieldsWithFiller(r4, r7, r9); | 4740 __ InitializeFieldsWithFiller(r4, r7, r9); |
| 4744 | 4741 |
| 4745 // Initialize the remaining (reserved) fields with one pointer filler map. | 4742 // Initialize the remaining (reserved) fields with one pointer filler map. |
| 4746 __ LoadRoot(r9, Heap::kOnePointerFillerMapRootIndex); | 4743 __ LoadRoot(r9, Heap::kOnePointerFillerMapRootIndex); |
| 4747 __ InitializeFieldsWithFiller(r4, r8, r9); | 4744 __ InitializeFieldsWithFiller(r4, r8, r9); |
| 4748 | 4745 |
| 4749 // Add the object tag to make the JSObject real. | |
| 4750 __ addi(r3, r3, Operand(kHeapObjectTag)); | |
| 4751 | |
| 4752 // Check if we can finalize the instance size. | 4746 // Check if we can finalize the instance size. |
| 4753 __ cmpi(r10, Operand(Map::kSlackTrackingCounterEnd)); | 4747 __ cmpi(r10, Operand(Map::kSlackTrackingCounterEnd)); |
| 4754 __ Ret(ne); | 4748 __ Ret(ne); |
| 4755 | 4749 |
| 4756 // Finalize the instance size. | 4750 // Finalize the instance size. |
| 4757 { | 4751 { |
| 4758 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 4752 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 4759 __ Push(r3, r5); | 4753 __ Push(r3, r5); |
| 4760 __ CallRuntime(Runtime::kFinalizeInstanceSize); | 4754 __ CallRuntime(Runtime::kFinalizeInstanceSize); |
| 4761 __ Pop(r3); | 4755 __ Pop(r3); |
| 4762 } | 4756 } |
| 4763 __ Ret(); | 4757 __ Ret(); |
| 4764 } | 4758 } |
| 4765 | 4759 |
| 4766 // Fall back to %AllocateInNewSpace. | 4760 // Fall back to %AllocateInNewSpace. |
| 4767 __ bind(&allocate); | 4761 __ bind(&allocate); |
| 4768 { | 4762 { |
| 4769 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 4763 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 4770 STATIC_ASSERT(kSmiTag == 0); | 4764 STATIC_ASSERT(kSmiTag == 0); |
| 4771 __ ShiftLeftImm(r7, r7, | 4765 __ ShiftLeftImm(r7, r7, |
| 4772 Operand(kPointerSizeLog2 + kSmiTagSize + kSmiShiftSize)); | 4766 Operand(kPointerSizeLog2 + kSmiTagSize + kSmiShiftSize)); |
| 4773 __ Push(r5, r7); | 4767 __ Push(r5, r7); |
| 4774 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4768 __ CallRuntime(Runtime::kAllocateInNewSpace); |
| 4775 __ Pop(r5); | 4769 __ Pop(r5); |
| 4776 } | 4770 } |
| 4777 __ subi(r3, r3, Operand(kHeapObjectTag)); | |
| 4778 __ lbz(r8, FieldMemOperand(r5, Map::kInstanceSizeOffset)); | 4771 __ lbz(r8, FieldMemOperand(r5, Map::kInstanceSizeOffset)); |
| 4779 __ ShiftLeftImm(r8, r8, Operand(kPointerSizeLog2)); | 4772 __ ShiftLeftImm(r8, r8, Operand(kPointerSizeLog2)); |
| 4780 __ add(r8, r3, r8); | 4773 __ add(r8, r3, r8); |
| 4774 __ subi(r8, r8, Operand(kHeapObjectTag)); |
| 4781 __ b(&done_allocate); | 4775 __ b(&done_allocate); |
| 4782 | 4776 |
| 4783 // Fall back to %NewObject. | 4777 // Fall back to %NewObject. |
| 4784 __ bind(&new_object); | 4778 __ bind(&new_object); |
| 4785 __ Push(r4, r6); | 4779 __ Push(r4, r6); |
| 4786 __ TailCallRuntime(Runtime::kNewObject); | 4780 __ TailCallRuntime(Runtime::kNewObject); |
| 4787 } | 4781 } |
| 4788 | 4782 |
| 4789 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4783 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
| 4790 // ----------- S t a t e ------------- | 4784 // ----------- S t a t e ------------- |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4835 // Return an empty rest parameter array. | 4829 // Return an empty rest parameter array. |
| 4836 __ bind(&no_rest_parameters); | 4830 __ bind(&no_rest_parameters); |
| 4837 { | 4831 { |
| 4838 // ----------- S t a t e ------------- | 4832 // ----------- S t a t e ------------- |
| 4839 // -- cp : context | 4833 // -- cp : context |
| 4840 // -- lr : return address | 4834 // -- lr : return address |
| 4841 // ----------------------------------- | 4835 // ----------------------------------- |
| 4842 | 4836 |
| 4843 // Allocate an empty rest parameter array. | 4837 // Allocate an empty rest parameter array. |
| 4844 Label allocate, done_allocate; | 4838 Label allocate, done_allocate; |
| 4845 __ Allocate(JSArray::kSize, r3, r4, r5, &allocate, TAG_OBJECT); | 4839 __ Allocate(JSArray::kSize, r3, r4, r5, &allocate, NO_ALLOCATION_FLAGS); |
| 4846 __ bind(&done_allocate); | 4840 __ bind(&done_allocate); |
| 4847 | 4841 |
| 4848 // Setup the rest parameter array in r0. | 4842 // Setup the rest parameter array in r0. |
| 4849 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, r4); | 4843 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, r4); |
| 4850 __ StoreP(r4, FieldMemOperand(r3, JSArray::kMapOffset), r0); | 4844 __ StoreP(r4, FieldMemOperand(r3, JSArray::kMapOffset), r0); |
| 4851 __ LoadRoot(r4, Heap::kEmptyFixedArrayRootIndex); | 4845 __ LoadRoot(r4, Heap::kEmptyFixedArrayRootIndex); |
| 4852 __ StoreP(r4, FieldMemOperand(r3, JSArray::kPropertiesOffset), r0); | 4846 __ StoreP(r4, FieldMemOperand(r3, JSArray::kPropertiesOffset), r0); |
| 4853 __ StoreP(r4, FieldMemOperand(r3, JSArray::kElementsOffset), r0); | 4847 __ StoreP(r4, FieldMemOperand(r3, JSArray::kElementsOffset), r0); |
| 4854 __ li(r4, Operand::Zero()); | 4848 __ li(r4, Operand::Zero()); |
| 4855 __ StoreP(r4, FieldMemOperand(r3, JSArray::kLengthOffset), r0); | 4849 __ StoreP(r4, FieldMemOperand(r3, JSArray::kLengthOffset), r0); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4878 // -- r3 : number of rest parameters (tagged) | 4872 // -- r3 : number of rest parameters (tagged) |
| 4879 // -- r5 : pointer just past first rest parameters | 4873 // -- r5 : pointer just past first rest parameters |
| 4880 // -- r9 : size of rest parameters | 4874 // -- r9 : size of rest parameters |
| 4881 // -- lr : return address | 4875 // -- lr : return address |
| 4882 // ----------------------------------- | 4876 // ----------------------------------- |
| 4883 | 4877 |
| 4884 // Allocate space for the rest parameter array plus the backing store. | 4878 // Allocate space for the rest parameter array plus the backing store. |
| 4885 Label allocate, done_allocate; | 4879 Label allocate, done_allocate; |
| 4886 __ mov(r4, Operand(JSArray::kSize + FixedArray::kHeaderSize)); | 4880 __ mov(r4, Operand(JSArray::kSize + FixedArray::kHeaderSize)); |
| 4887 __ add(r4, r4, r9); | 4881 __ add(r4, r4, r9); |
| 4888 __ Allocate(r4, r6, r7, r8, &allocate, TAG_OBJECT); | 4882 __ Allocate(r4, r6, r7, r8, &allocate, NO_ALLOCATION_FLAGS); |
| 4889 __ bind(&done_allocate); | 4883 __ bind(&done_allocate); |
| 4890 | 4884 |
| 4891 // Setup the elements array in r6. | 4885 // Setup the elements array in r6. |
| 4892 __ LoadRoot(r4, Heap::kFixedArrayMapRootIndex); | 4886 __ LoadRoot(r4, Heap::kFixedArrayMapRootIndex); |
| 4893 __ StoreP(r4, FieldMemOperand(r6, FixedArray::kMapOffset), r0); | 4887 __ StoreP(r4, FieldMemOperand(r6, FixedArray::kMapOffset), r0); |
| 4894 __ StoreP(r3, FieldMemOperand(r6, FixedArray::kLengthOffset), r0); | 4888 __ StoreP(r3, FieldMemOperand(r6, FixedArray::kLengthOffset), r0); |
| 4895 __ addi(r7, r6, | 4889 __ addi(r7, r6, |
| 4896 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 4890 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); |
| 4897 { | 4891 { |
| 4898 Label loop; | 4892 Label loop; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5033 | 5027 |
| 5034 // 2. Backing store. | 5028 // 2. Backing store. |
| 5035 __ SmiToPtrArrayOffset(r7, r8); | 5029 __ SmiToPtrArrayOffset(r7, r8); |
| 5036 __ add(r11, r11, r7); | 5030 __ add(r11, r11, r7); |
| 5037 __ addi(r11, r11, Operand(FixedArray::kHeaderSize)); | 5031 __ addi(r11, r11, Operand(FixedArray::kHeaderSize)); |
| 5038 | 5032 |
| 5039 // 3. Arguments object. | 5033 // 3. Arguments object. |
| 5040 __ addi(r11, r11, Operand(JSSloppyArgumentsObject::kSize)); | 5034 __ addi(r11, r11, Operand(JSSloppyArgumentsObject::kSize)); |
| 5041 | 5035 |
| 5042 // Do the allocation of all three objects in one go. | 5036 // Do the allocation of all three objects in one go. |
| 5043 __ Allocate(r11, r3, r11, r7, &runtime, TAG_OBJECT); | 5037 __ Allocate(r11, r3, r11, r7, &runtime, NO_ALLOCATION_FLAGS); |
| 5044 | 5038 |
| 5045 // r3 = address of new object(s) (tagged) | 5039 // r3 = address of new object(s) (tagged) |
| 5046 // r5 = argument count (smi-tagged) | 5040 // r5 = argument count (smi-tagged) |
| 5047 // Get the arguments boilerplate from the current native context into r4. | 5041 // Get the arguments boilerplate from the current native context into r4. |
| 5048 const int kNormalOffset = | 5042 const int kNormalOffset = |
| 5049 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); | 5043 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
| 5050 const int kAliasedOffset = | 5044 const int kAliasedOffset = |
| 5051 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX); | 5045 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX); |
| 5052 | 5046 |
| 5053 __ LoadP(r7, NativeContextMemOperand()); | 5047 __ LoadP(r7, NativeContextMemOperand()); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5257 // -- r3 : number of rest parameters (tagged) | 5251 // -- r3 : number of rest parameters (tagged) |
| 5258 // -- r5 : pointer just past first rest parameters | 5252 // -- r5 : pointer just past first rest parameters |
| 5259 // -- r9 : size of rest parameters | 5253 // -- r9 : size of rest parameters |
| 5260 // -- lr : return address | 5254 // -- lr : return address |
| 5261 // ----------------------------------- | 5255 // ----------------------------------- |
| 5262 | 5256 |
| 5263 // Allocate space for the strict arguments object plus the backing store. | 5257 // Allocate space for the strict arguments object plus the backing store. |
| 5264 Label allocate, done_allocate; | 5258 Label allocate, done_allocate; |
| 5265 __ mov(r4, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); | 5259 __ mov(r4, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); |
| 5266 __ add(r4, r4, r9); | 5260 __ add(r4, r4, r9); |
| 5267 __ Allocate(r4, r6, r7, r8, &allocate, TAG_OBJECT); | 5261 __ Allocate(r4, r6, r7, r8, &allocate, NO_ALLOCATION_FLAGS); |
| 5268 __ bind(&done_allocate); | 5262 __ bind(&done_allocate); |
| 5269 | 5263 |
| 5270 // Setup the elements array in r6. | 5264 // Setup the elements array in r6. |
| 5271 __ LoadRoot(r4, Heap::kFixedArrayMapRootIndex); | 5265 __ LoadRoot(r4, Heap::kFixedArrayMapRootIndex); |
| 5272 __ StoreP(r4, FieldMemOperand(r6, FixedArray::kMapOffset), r0); | 5266 __ StoreP(r4, FieldMemOperand(r6, FixedArray::kMapOffset), r0); |
| 5273 __ StoreP(r3, FieldMemOperand(r6, FixedArray::kLengthOffset), r0); | 5267 __ StoreP(r3, FieldMemOperand(r6, FixedArray::kLengthOffset), r0); |
| 5274 __ addi(r7, r6, | 5268 __ addi(r7, r6, |
| 5275 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 5269 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); |
| 5276 { | 5270 { |
| 5277 Label loop, done_loop; | 5271 Label loop, done_loop; |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5819 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5813 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
| 5820 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5814 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5821 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5815 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5822 } | 5816 } |
| 5823 | 5817 |
| 5824 #undef __ | 5818 #undef __ |
| 5825 } // namespace internal | 5819 } // namespace internal |
| 5826 } // namespace v8 | 5820 } // namespace v8 |
| 5827 | 5821 |
| 5828 #endif // V8_TARGET_ARCH_PPC | 5822 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |