| 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 5704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5715 MemOperand* stack_space_operand = &is_construct_call_operand; | 5715 MemOperand* stack_space_operand = &is_construct_call_operand; |
| 5716 stack_space = argc() + FCA::kArgsLength + 1; | 5716 stack_space = argc() + FCA::kArgsLength + 1; |
| 5717 stack_space_operand = NULL; | 5717 stack_space_operand = NULL; |
| 5718 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5718 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
| 5719 stack_space_operand, return_value_operand, | 5719 stack_space_operand, return_value_operand, |
| 5720 &context_restore_operand); | 5720 &context_restore_operand); |
| 5721 } | 5721 } |
| 5722 | 5722 |
| 5723 | 5723 |
| 5724 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5724 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5725 // ----------- S t a t e ------------- | |
| 5726 // -- sp[0] : name | |
| 5727 // -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ | |
| 5728 // -- ... | |
| 5729 // -- r5 : api_function_address | |
| 5730 // ----------------------------------- | |
| 5731 | |
| 5732 Register api_function_address = ApiGetterDescriptor::function_address(); | |
| 5733 int arg0Slot = 0; | 5725 int arg0Slot = 0; |
| 5734 int accessorInfoSlot = 0; | 5726 int accessorInfoSlot = 0; |
| 5735 int apiStackSpace = 0; | 5727 int apiStackSpace = 0; |
| 5736 DCHECK(api_function_address.is(r5)); | 5728 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
| 5729 // name below the exit frame to make GC aware of them. |
| 5730 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
| 5731 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
| 5732 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
| 5733 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
| 5734 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
| 5735 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
| 5736 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
| 5737 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
| 5738 |
| 5739 Register receiver = ApiGetterDescriptor::ReceiverRegister(); |
| 5740 Register holder = ApiGetterDescriptor::HolderRegister(); |
| 5741 Register callback = ApiGetterDescriptor::CallbackRegister(); |
| 5742 Register scratch = r7; |
| 5743 DCHECK(!AreAliased(receiver, holder, callback, scratch)); |
| 5744 |
| 5745 Register api_function_address = r5; |
| 5746 |
| 5747 __ push(receiver); |
| 5748 // Push data from AccessorInfo. |
| 5749 __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); |
| 5750 __ push(scratch); |
| 5751 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 5752 __ Push(scratch, scratch); |
| 5753 __ mov(scratch, Operand(ExternalReference::isolate_address(isolate()))); |
| 5754 __ Push(scratch, holder); |
| 5755 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false |
| 5756 __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); |
| 5757 __ push(scratch); |
| 5737 | 5758 |
| 5738 // v8::PropertyCallbackInfo::args_ array and name handle. | 5759 // v8::PropertyCallbackInfo::args_ array and name handle. |
| 5739 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5760 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
| 5740 | 5761 |
| 5741 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5762 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
| 5742 __ mr(r3, sp); // r3 = Handle<Name> | 5763 __ mr(r3, sp); // r3 = Handle<Name> |
| 5743 __ addi(r4, r3, Operand(1 * kPointerSize)); // r4 = v8::PCI::args_ | 5764 __ addi(r4, r3, Operand(1 * kPointerSize)); // r4 = v8::PCI::args_ |
| 5744 | 5765 |
| 5745 // If ABI passes Handles (pointer-sized struct) in a register: | 5766 // If ABI passes Handles (pointer-sized struct) in a register: |
| 5746 // | 5767 // |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5774 | 5795 |
| 5775 // Create v8::PropertyCallbackInfo object on the stack and initialize | 5796 // Create v8::PropertyCallbackInfo object on the stack and initialize |
| 5776 // it's args_ field. | 5797 // it's args_ field. |
| 5777 __ StoreP(r4, MemOperand(sp, accessorInfoSlot * kPointerSize)); | 5798 __ StoreP(r4, MemOperand(sp, accessorInfoSlot * kPointerSize)); |
| 5778 __ addi(r4, sp, Operand(accessorInfoSlot * kPointerSize)); | 5799 __ addi(r4, sp, Operand(accessorInfoSlot * kPointerSize)); |
| 5779 // r4 = v8::PropertyCallbackInfo& | 5800 // r4 = v8::PropertyCallbackInfo& |
| 5780 | 5801 |
| 5781 ExternalReference thunk_ref = | 5802 ExternalReference thunk_ref = |
| 5782 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5803 ExternalReference::invoke_accessor_getter_callback(isolate()); |
| 5783 | 5804 |
| 5805 __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); |
| 5806 __ LoadP(api_function_address, |
| 5807 FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); |
| 5808 |
| 5784 // +3 is to skip prolog, return address and name handle. | 5809 // +3 is to skip prolog, return address and name handle. |
| 5785 MemOperand return_value_operand( | 5810 MemOperand return_value_operand( |
| 5786 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5811 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
| 5787 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5812 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5788 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5813 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5789 } | 5814 } |
| 5790 | 5815 |
| 5791 #undef __ | 5816 #undef __ |
| 5792 } // namespace internal | 5817 } // namespace internal |
| 5793 } // namespace v8 | 5818 } // namespace v8 |
| 5794 | 5819 |
| 5795 #endif // V8_TARGET_ARCH_PPC | 5820 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |