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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 5567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5578 bool is_store = this->is_store(); | 5578 bool is_store = this->is_store(); |
5579 int argc = this->argc(); | 5579 int argc = this->argc(); |
5580 bool call_data_undefined = this->call_data_undefined(); | 5580 bool call_data_undefined = this->call_data_undefined(); |
5581 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, | 5581 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, |
5582 call_data_undefined); | 5582 call_data_undefined); |
5583 } | 5583 } |
5584 | 5584 |
5585 | 5585 |
5586 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5586 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
5587 // ----------- S t a t e ------------- | 5587 // ----------- S t a t e ------------- |
5588 // -- sp[0] : name | 5588 // -- sp[0] : name |
5589 // -- sp[4 - kArgsLength*4] : PropertyCallbackArguments object | 5589 // -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ |
5590 // -- ... | 5590 // -- ... |
5591 // -- r5 : api_function_address | 5591 // -- r5 : api_function_address |
5592 // ----------------------------------- | 5592 // ----------------------------------- |
5593 | 5593 |
5594 Register api_function_address = ApiGetterDescriptor::function_address(); | 5594 Register api_function_address = ApiGetterDescriptor::function_address(); |
5595 int arg0Slot = 0; | 5595 int arg0Slot = 0; |
5596 int accessorInfoSlot = 0; | 5596 int accessorInfoSlot = 0; |
5597 int apiStackSpace = 0; | 5597 int apiStackSpace = 0; |
5598 DCHECK(api_function_address.is(r5)); | 5598 DCHECK(api_function_address.is(r5)); |
5599 | 5599 |
| 5600 // v8::PropertyCallbackInfo::args_ array and name handle. |
| 5601 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
| 5602 |
| 5603 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
5600 __ mr(r3, sp); // r3 = Handle<Name> | 5604 __ mr(r3, sp); // r3 = Handle<Name> |
5601 __ addi(r4, r3, Operand(1 * kPointerSize)); // r4 = PCA | 5605 __ addi(r4, r3, Operand(1 * kPointerSize)); // r4 = v8::PCI::args_ |
5602 | 5606 |
5603 // If ABI passes Handles (pointer-sized struct) in a register: | 5607 // If ABI passes Handles (pointer-sized struct) in a register: |
5604 // | 5608 // |
5605 // Create 2 extra slots on stack: | 5609 // Create 2 extra slots on stack: |
5606 // [0] space for DirectCEntryStub's LR save | 5610 // [0] space for DirectCEntryStub's LR save |
5607 // [1] AccessorInfo& | 5611 // [1] AccessorInfo& |
5608 // | 5612 // |
5609 // Otherwise: | 5613 // Otherwise: |
5610 // | 5614 // |
5611 // Create 3 extra slots on stack: | 5615 // Create 3 extra slots on stack: |
(...skipping 11 matching lines...) Expand all Loading... |
5623 | 5627 |
5624 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5628 FrameScope frame_scope(masm, StackFrame::MANUAL); |
5625 __ EnterExitFrame(false, apiStackSpace); | 5629 __ EnterExitFrame(false, apiStackSpace); |
5626 | 5630 |
5627 if (!ABI_PASSES_HANDLES_IN_REGS) { | 5631 if (!ABI_PASSES_HANDLES_IN_REGS) { |
5628 // pass 1st arg by reference | 5632 // pass 1st arg by reference |
5629 __ StoreP(r3, MemOperand(sp, arg0Slot * kPointerSize)); | 5633 __ StoreP(r3, MemOperand(sp, arg0Slot * kPointerSize)); |
5630 __ addi(r3, sp, Operand(arg0Slot * kPointerSize)); | 5634 __ addi(r3, sp, Operand(arg0Slot * kPointerSize)); |
5631 } | 5635 } |
5632 | 5636 |
5633 // Create PropertyAccessorInfo instance on the stack above the exit frame with | 5637 // Create v8::PropertyCallbackInfo object on the stack and initialize |
5634 // r4 (internal::Object** args_) as the data. | 5638 // it's args_ field. |
5635 __ StoreP(r4, MemOperand(sp, accessorInfoSlot * kPointerSize)); | 5639 __ StoreP(r4, MemOperand(sp, accessorInfoSlot * kPointerSize)); |
5636 // r4 = AccessorInfo& | |
5637 __ addi(r4, sp, Operand(accessorInfoSlot * kPointerSize)); | 5640 __ addi(r4, sp, Operand(accessorInfoSlot * kPointerSize)); |
5638 | 5641 // r4 = v8::PropertyCallbackInfo& |
5639 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | |
5640 | 5642 |
5641 ExternalReference thunk_ref = | 5643 ExternalReference thunk_ref = |
5642 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5644 ExternalReference::invoke_accessor_getter_callback(isolate()); |
| 5645 |
| 5646 // +3 is to skip prolog, return address and name handle. |
| 5647 MemOperand return_value_operand( |
| 5648 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5643 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5649 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5644 kStackUnwindSpace, NULL, | 5650 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5645 MemOperand(fp, 6 * kPointerSize), NULL); | |
5646 } | 5651 } |
5647 | 5652 |
5648 | 5653 |
5649 #undef __ | 5654 #undef __ |
5650 } // namespace internal | 5655 } // namespace internal |
5651 } // namespace v8 | 5656 } // namespace v8 |
5652 | 5657 |
5653 #endif // V8_TARGET_ARCH_PPC | 5658 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |