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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 4608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 __ CmpP(r2, r3); | 4619 __ CmpP(r2, r3); |
4620 __ bne(&new_object); | 4620 __ bne(&new_object); |
4621 | 4621 |
4622 // Allocate the JSObject on the heap. | 4622 // Allocate the JSObject on the heap. |
4623 Label allocate, done_allocate; | 4623 Label allocate, done_allocate; |
4624 __ LoadlB(r6, FieldMemOperand(r4, Map::kInstanceSizeOffset)); | 4624 __ LoadlB(r6, FieldMemOperand(r4, Map::kInstanceSizeOffset)); |
4625 __ Allocate(r6, r2, r7, r8, &allocate, SIZE_IN_WORDS); | 4625 __ Allocate(r6, r2, r7, r8, &allocate, SIZE_IN_WORDS); |
4626 __ bind(&done_allocate); | 4626 __ bind(&done_allocate); |
4627 | 4627 |
4628 // Initialize the JSObject fields. | 4628 // Initialize the JSObject fields. |
4629 __ StoreP(r4, MemOperand(r2, JSObject::kMapOffset)); | 4629 __ StoreP(r4, FieldMemOperand(r2, JSObject::kMapOffset)); |
4630 __ LoadRoot(r5, Heap::kEmptyFixedArrayRootIndex); | 4630 __ LoadRoot(r5, Heap::kEmptyFixedArrayRootIndex); |
4631 __ StoreP(r5, MemOperand(r2, JSObject::kPropertiesOffset)); | 4631 __ StoreP(r5, FieldMemOperand(r2, JSObject::kPropertiesOffset)); |
4632 __ StoreP(r5, MemOperand(r2, JSObject::kElementsOffset)); | 4632 __ StoreP(r5, FieldMemOperand(r2, JSObject::kElementsOffset)); |
4633 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); | 4633 STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); |
4634 __ AddP(r3, r2, Operand(JSObject::kHeaderSize)); | 4634 __ AddP(r3, r2, Operand(JSObject::kHeaderSize - kHeapObjectTag)); |
4635 | 4635 |
4636 // ----------- S t a t e ------------- | 4636 // ----------- S t a t e ------------- |
4637 // -- r2 : result (untagged) | 4637 // -- r2 : result (tagged) |
4638 // -- r3 : result fields (untagged) | 4638 // -- r3 : result fields (untagged) |
4639 // -- r7 : result end (untagged) | 4639 // -- r7 : result end (untagged) |
4640 // -- r4 : initial map | 4640 // -- r4 : initial map |
4641 // -- cp : context | 4641 // -- cp : context |
4642 // -- lr : return address | 4642 // -- lr : return address |
4643 // ----------------------------------- | 4643 // ----------------------------------- |
4644 | 4644 |
4645 // Perform in-object slack tracking if requested. | 4645 // Perform in-object slack tracking if requested. |
4646 Label slack_tracking; | 4646 Label slack_tracking; |
4647 STATIC_ASSERT(Map::kNoSlackTracking == 0); | 4647 STATIC_ASSERT(Map::kNoSlackTracking == 0); |
4648 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); | 4648 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); |
4649 __ LoadlW(r5, FieldMemOperand(r4, Map::kBitField3Offset)); | 4649 __ LoadlW(r5, FieldMemOperand(r4, Map::kBitField3Offset)); |
4650 __ DecodeField<Map::ConstructionCounter>(r9, r5); | 4650 __ DecodeField<Map::ConstructionCounter>(r9, r5); |
4651 __ LoadAndTestP(r9, r9); | 4651 __ LoadAndTestP(r9, r9); |
4652 __ bne(&slack_tracking); | 4652 __ bne(&slack_tracking); |
4653 { | 4653 { |
4654 // Initialize all in-object fields with undefined. | 4654 // Initialize all in-object fields with undefined. |
4655 __ InitializeFieldsWithFiller(r3, r7, r8); | 4655 __ InitializeFieldsWithFiller(r3, r7, r8); |
4656 | 4656 |
4657 // Add the object tag to make the JSObject real. | |
4658 __ AddP(r2, r2, Operand(kHeapObjectTag)); | |
4659 __ Ret(); | 4657 __ Ret(); |
4660 } | 4658 } |
4661 __ bind(&slack_tracking); | 4659 __ bind(&slack_tracking); |
4662 { | 4660 { |
4663 // Decrease generous allocation count. | 4661 // Decrease generous allocation count. |
4664 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); | 4662 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32); |
4665 __ Add32(r5, r5, Operand(-(1 << Map::ConstructionCounter::kShift))); | 4663 __ Add32(r5, r5, Operand(-(1 << Map::ConstructionCounter::kShift))); |
4666 __ StoreW(r5, FieldMemOperand(r4, Map::kBitField3Offset)); | 4664 __ StoreW(r5, FieldMemOperand(r4, Map::kBitField3Offset)); |
4667 | 4665 |
4668 // Initialize the in-object fields with undefined. | 4666 // Initialize the in-object fields with undefined. |
4669 __ LoadlB(r6, FieldMemOperand(r4, Map::kUnusedPropertyFieldsOffset)); | 4667 __ LoadlB(r6, FieldMemOperand(r4, Map::kUnusedPropertyFieldsOffset)); |
4670 __ ShiftLeftP(r6, r6, Operand(kPointerSizeLog2)); | 4668 __ ShiftLeftP(r6, r6, Operand(kPointerSizeLog2)); |
4671 __ SubP(r6, r7, r6); | 4669 __ SubP(r6, r7, r6); |
4672 __ InitializeFieldsWithFiller(r3, r6, r8); | 4670 __ InitializeFieldsWithFiller(r3, r6, r8); |
4673 | 4671 |
4674 // Initialize the remaining (reserved) fields with one pointer filler map. | 4672 // Initialize the remaining (reserved) fields with one pointer filler map. |
4675 __ LoadRoot(r8, Heap::kOnePointerFillerMapRootIndex); | 4673 __ LoadRoot(r8, Heap::kOnePointerFillerMapRootIndex); |
4676 __ InitializeFieldsWithFiller(r3, r7, r8); | 4674 __ InitializeFieldsWithFiller(r3, r7, r8); |
4677 | 4675 |
4678 // Add the object tag to make the JSObject real. | |
4679 __ AddP(r2, r2, Operand(kHeapObjectTag)); | |
4680 | |
4681 // Check if we can finalize the instance size. | 4676 // Check if we can finalize the instance size. |
4682 __ CmpP(r9, Operand(Map::kSlackTrackingCounterEnd)); | 4677 __ CmpP(r9, Operand(Map::kSlackTrackingCounterEnd)); |
4683 __ Ret(ne); | 4678 __ Ret(ne); |
4684 | 4679 |
4685 // Finalize the instance size. | 4680 // Finalize the instance size. |
4686 { | 4681 { |
4687 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 4682 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
4688 __ Push(r2, r4); | 4683 __ Push(r2, r4); |
4689 __ CallRuntime(Runtime::kFinalizeInstanceSize); | 4684 __ CallRuntime(Runtime::kFinalizeInstanceSize); |
4690 __ Pop(r2); | 4685 __ Pop(r2); |
4691 } | 4686 } |
4692 __ Ret(); | 4687 __ Ret(); |
4693 } | 4688 } |
4694 | 4689 |
4695 // Fall back to %AllocateInNewSpace. | 4690 // Fall back to %AllocateInNewSpace. |
4696 __ bind(&allocate); | 4691 __ bind(&allocate); |
4697 { | 4692 { |
4698 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 4693 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
4699 STATIC_ASSERT(kSmiTag == 0); | 4694 STATIC_ASSERT(kSmiTag == 0); |
4700 __ ShiftLeftP(r6, r6, | 4695 __ ShiftLeftP(r6, r6, |
4701 Operand(kPointerSizeLog2 + kSmiTagSize + kSmiShiftSize)); | 4696 Operand(kPointerSizeLog2 + kSmiTagSize + kSmiShiftSize)); |
4702 __ Push(r4, r6); | 4697 __ Push(r4, r6); |
4703 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4698 __ CallRuntime(Runtime::kAllocateInNewSpace); |
4704 __ Pop(r4); | 4699 __ Pop(r4); |
4705 } | 4700 } |
4706 __ SubP(r2, r2, Operand(kHeapObjectTag)); | |
4707 __ LoadlB(r7, FieldMemOperand(r4, Map::kInstanceSizeOffset)); | 4701 __ LoadlB(r7, FieldMemOperand(r4, Map::kInstanceSizeOffset)); |
4708 __ ShiftLeftP(r7, r7, Operand(kPointerSizeLog2)); | 4702 __ ShiftLeftP(r7, r7, Operand(kPointerSizeLog2)); |
4709 __ AddP(r7, r2, r7); | 4703 __ AddP(r7, r2, r7); |
| 4704 __ SubP(r7, r7, Operand(kHeapObjectTag)); |
4710 __ b(&done_allocate); | 4705 __ b(&done_allocate); |
4711 | 4706 |
4712 // Fall back to %NewObject. | 4707 // Fall back to %NewObject. |
4713 __ bind(&new_object); | 4708 __ bind(&new_object); |
4714 __ Push(r3, r5); | 4709 __ Push(r3, r5); |
4715 __ TailCallRuntime(Runtime::kNewObject); | 4710 __ TailCallRuntime(Runtime::kNewObject); |
4716 } | 4711 } |
4717 | 4712 |
4718 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { | 4713 void FastNewRestParameterStub::Generate(MacroAssembler* masm) { |
4719 // ----------- S t a t e ------------- | 4714 // ----------- S t a t e ------------- |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4764 // Return an empty rest parameter array. | 4759 // Return an empty rest parameter array. |
4765 __ bind(&no_rest_parameters); | 4760 __ bind(&no_rest_parameters); |
4766 { | 4761 { |
4767 // ----------- S t a t e ------------- | 4762 // ----------- S t a t e ------------- |
4768 // -- cp : context | 4763 // -- cp : context |
4769 // -- lr : return address | 4764 // -- lr : return address |
4770 // ----------------------------------- | 4765 // ----------------------------------- |
4771 | 4766 |
4772 // Allocate an empty rest parameter array. | 4767 // Allocate an empty rest parameter array. |
4773 Label allocate, done_allocate; | 4768 Label allocate, done_allocate; |
4774 __ Allocate(JSArray::kSize, r2, r3, r4, &allocate, TAG_OBJECT); | 4769 __ Allocate(JSArray::kSize, r2, r3, r4, &allocate, NO_ALLOCATION_FLAGS); |
4775 __ bind(&done_allocate); | 4770 __ bind(&done_allocate); |
4776 | 4771 |
4777 // Setup the rest parameter array in r0. | 4772 // Setup the rest parameter array in r0. |
4778 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, r3); | 4773 __ LoadNativeContextSlot(Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, r3); |
4779 __ StoreP(r3, FieldMemOperand(r2, JSArray::kMapOffset), r0); | 4774 __ StoreP(r3, FieldMemOperand(r2, JSArray::kMapOffset), r0); |
4780 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 4775 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); |
4781 __ StoreP(r3, FieldMemOperand(r2, JSArray::kPropertiesOffset), r0); | 4776 __ StoreP(r3, FieldMemOperand(r2, JSArray::kPropertiesOffset), r0); |
4782 __ StoreP(r3, FieldMemOperand(r2, JSArray::kElementsOffset), r0); | 4777 __ StoreP(r3, FieldMemOperand(r2, JSArray::kElementsOffset), r0); |
4783 __ LoadImmP(r3, Operand::Zero()); | 4778 __ LoadImmP(r3, Operand::Zero()); |
4784 __ StoreP(r3, FieldMemOperand(r2, JSArray::kLengthOffset), r0); | 4779 __ StoreP(r3, FieldMemOperand(r2, JSArray::kLengthOffset), r0); |
(...skipping 22 matching lines...) Expand all Loading... |
4807 // -- r2 : number of rest parameters (tagged) | 4802 // -- r2 : number of rest parameters (tagged) |
4808 // -- r4 : pointer just past first rest parameters | 4803 // -- r4 : pointer just past first rest parameters |
4809 // -- r8 : size of rest parameters | 4804 // -- r8 : size of rest parameters |
4810 // -- lr : return address | 4805 // -- lr : return address |
4811 // ----------------------------------- | 4806 // ----------------------------------- |
4812 | 4807 |
4813 // Allocate space for the rest parameter array plus the backing store. | 4808 // Allocate space for the rest parameter array plus the backing store. |
4814 Label allocate, done_allocate; | 4809 Label allocate, done_allocate; |
4815 __ mov(r3, Operand(JSArray::kSize + FixedArray::kHeaderSize)); | 4810 __ mov(r3, Operand(JSArray::kSize + FixedArray::kHeaderSize)); |
4816 __ AddP(r3, r3, r8); | 4811 __ AddP(r3, r3, r8); |
4817 __ Allocate(r3, r5, r6, r7, &allocate, TAG_OBJECT); | 4812 __ Allocate(r3, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS); |
4818 __ bind(&done_allocate); | 4813 __ bind(&done_allocate); |
4819 | 4814 |
4820 // Setup the elements array in r5. | 4815 // Setup the elements array in r5. |
4821 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 4816 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
4822 __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); | 4817 __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); |
4823 __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); | 4818 __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); |
4824 __ AddP(r6, r5, | 4819 __ AddP(r6, r5, |
4825 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 4820 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); |
4826 { | 4821 { |
4827 Label loop; | 4822 Label loop; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4954 | 4949 |
4955 // 2. Backing store. | 4950 // 2. Backing store. |
4956 __ SmiToPtrArrayOffset(r6, r7); | 4951 __ SmiToPtrArrayOffset(r6, r7); |
4957 __ AddP(r1, r1, r6); | 4952 __ AddP(r1, r1, r6); |
4958 __ AddP(r1, r1, Operand(FixedArray::kHeaderSize)); | 4953 __ AddP(r1, r1, Operand(FixedArray::kHeaderSize)); |
4959 | 4954 |
4960 // 3. Arguments object. | 4955 // 3. Arguments object. |
4961 __ AddP(r1, r1, Operand(JSSloppyArgumentsObject::kSize)); | 4956 __ AddP(r1, r1, Operand(JSSloppyArgumentsObject::kSize)); |
4962 | 4957 |
4963 // Do the allocation of all three objects in one go. | 4958 // Do the allocation of all three objects in one go. |
4964 __ Allocate(r1, r2, r1, r6, &runtime, TAG_OBJECT); | 4959 __ Allocate(r1, r2, r1, r6, &runtime, NO_ALLOCATION_FLAGS); |
4965 | 4960 |
4966 // r2 = address of new object(s) (tagged) | 4961 // r2 = address of new object(s) (tagged) |
4967 // r4 = argument count (smi-tagged) | 4962 // r4 = argument count (smi-tagged) |
4968 // Get the arguments boilerplate from the current native context into r3. | 4963 // Get the arguments boilerplate from the current native context into r3. |
4969 const int kNormalOffset = | 4964 const int kNormalOffset = |
4970 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); | 4965 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
4971 const int kAliasedOffset = | 4966 const int kAliasedOffset = |
4972 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX); | 4967 Context::SlotOffset(Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX); |
4973 | 4968 |
4974 __ LoadP(r6, NativeContextMemOperand()); | 4969 __ LoadP(r6, NativeContextMemOperand()); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5172 // -- r2 : number of rest parameters (tagged) | 5167 // -- r2 : number of rest parameters (tagged) |
5173 // -- r4 : pointer just past first rest parameters | 5168 // -- r4 : pointer just past first rest parameters |
5174 // -- r8 : size of rest parameters | 5169 // -- r8 : size of rest parameters |
5175 // -- lr : return address | 5170 // -- lr : return address |
5176 // ----------------------------------- | 5171 // ----------------------------------- |
5177 | 5172 |
5178 // Allocate space for the strict arguments object plus the backing store. | 5173 // Allocate space for the strict arguments object plus the backing store. |
5179 Label allocate, done_allocate; | 5174 Label allocate, done_allocate; |
5180 __ mov(r3, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); | 5175 __ mov(r3, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); |
5181 __ AddP(r3, r3, r8); | 5176 __ AddP(r3, r3, r8); |
5182 __ Allocate(r3, r5, r6, r7, &allocate, TAG_OBJECT); | 5177 __ Allocate(r3, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS); |
5183 __ bind(&done_allocate); | 5178 __ bind(&done_allocate); |
5184 | 5179 |
5185 // Setup the elements array in r5. | 5180 // Setup the elements array in r5. |
5186 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 5181 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
5187 __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); | 5182 __ StoreP(r3, FieldMemOperand(r5, FixedArray::kMapOffset), r0); |
5188 __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); | 5183 __ StoreP(r2, FieldMemOperand(r5, FixedArray::kLengthOffset), r0); |
5189 __ AddP(r6, r5, | 5184 __ AddP(r6, r5, |
5190 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | 5185 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); |
5191 { | 5186 { |
5192 Label loop, done_loop; | 5187 Label loop, done_loop; |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5729 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5724 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5730 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5725 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5731 } | 5726 } |
5732 | 5727 |
5733 #undef __ | 5728 #undef __ |
5734 | 5729 |
5735 } // namespace internal | 5730 } // namespace internal |
5736 } // namespace v8 | 5731 } // namespace v8 |
5737 | 5732 |
5738 #endif // V8_TARGET_ARCH_S390 | 5733 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |