OLD | NEW |
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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 5699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5710 int32_t stack_space_offset = 4 * kPointerSize; | 5710 int32_t stack_space_offset = 4 * kPointerSize; |
5711 stack_space = argc() + FCA::kArgsLength + 1; | 5711 stack_space = argc() + FCA::kArgsLength + 1; |
5712 stack_space_offset = kInvalidStackOffset; | 5712 stack_space_offset = kInvalidStackOffset; |
5713 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5713 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
5714 stack_space_offset, return_value_operand, | 5714 stack_space_offset, return_value_operand, |
5715 &context_restore_operand); | 5715 &context_restore_operand); |
5716 } | 5716 } |
5717 | 5717 |
5718 | 5718 |
5719 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5719 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
5720 // ----------- S t a t e ------------- | 5720 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
5721 // -- sp[0] : name | 5721 // name below the exit frame to make GC aware of them. |
5722 // -- sp[8 .. (8 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ | 5722 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
5723 // -- ... | 5723 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
5724 // -- a2 : api_function_address | 5724 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
5725 // ----------------------------------- | 5725 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
| 5726 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
| 5727 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
| 5728 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
| 5729 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
5726 | 5730 |
5727 Register api_function_address = ApiGetterDescriptor::function_address(); | 5731 Register receiver = ApiGetterDescriptor::ReceiverRegister(); |
5728 DCHECK(api_function_address.is(a2)); | 5732 Register holder = ApiGetterDescriptor::HolderRegister(); |
| 5733 Register callback = ApiGetterDescriptor::CallbackRegister(); |
| 5734 Register scratch = a4; |
| 5735 Register scratch2 = a5; |
| 5736 Register scratch3 = a6; |
| 5737 DCHECK(!AreAliased(receiver, holder, callback, scratch, scratch2, scratch3)); |
5729 | 5738 |
| 5739 Register api_function_address = a2; |
| 5740 |
| 5741 __ Push(receiver); |
| 5742 // Push data from AccessorInfo. |
| 5743 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 5744 __ li(scratch2, Operand(ExternalReference::isolate_address(isolate()))); |
| 5745 __ ld(scratch3, FieldMemOperand(callback, AccessorInfo::kDataOffset)); |
| 5746 __ Push(scratch3, scratch, scratch, scratch2, holder); |
| 5747 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false |
| 5748 __ ld(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); |
| 5749 __ Push(scratch); |
5730 // v8::PropertyCallbackInfo::args_ array and name handle. | 5750 // v8::PropertyCallbackInfo::args_ array and name handle. |
5731 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5751 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
5732 | 5752 |
5733 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5753 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
5734 __ mov(a0, sp); // a0 = Handle<Name> | 5754 __ mov(a0, sp); // a0 = Handle<Name> |
5735 __ Daddu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_ | 5755 __ Daddu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_ |
5736 | 5756 |
5737 const int kApiStackSpace = 1; | 5757 const int kApiStackSpace = 1; |
5738 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5758 FrameScope frame_scope(masm, StackFrame::MANUAL); |
5739 __ EnterExitFrame(false, kApiStackSpace); | 5759 __ EnterExitFrame(false, kApiStackSpace); |
5740 | 5760 |
5741 // Create v8::PropertyCallbackInfo object on the stack and initialize | 5761 // Create v8::PropertyCallbackInfo object on the stack and initialize |
5742 // it's args_ field. | 5762 // it's args_ field. |
5743 __ sd(a1, MemOperand(sp, 1 * kPointerSize)); | 5763 __ sd(a1, MemOperand(sp, 1 * kPointerSize)); |
5744 __ Daddu(a1, sp, Operand(1 * kPointerSize)); | 5764 __ Daddu(a1, sp, Operand(1 * kPointerSize)); |
5745 // a1 = v8::PropertyCallbackInfo& | 5765 // a1 = v8::PropertyCallbackInfo& |
5746 | 5766 |
5747 ExternalReference thunk_ref = | 5767 ExternalReference thunk_ref = |
5748 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5768 ExternalReference::invoke_accessor_getter_callback(isolate()); |
5749 | 5769 |
| 5770 __ ld(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); |
| 5771 __ ld(api_function_address, |
| 5772 FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); |
| 5773 |
5750 // +3 is to skip prolog, return address and name handle. | 5774 // +3 is to skip prolog, return address and name handle. |
5751 MemOperand return_value_operand( | 5775 MemOperand return_value_operand( |
5752 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5776 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5753 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5777 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5754 kStackUnwindSpace, kInvalidStackOffset, | 5778 kStackUnwindSpace, kInvalidStackOffset, |
5755 return_value_operand, NULL); | 5779 return_value_operand, NULL); |
5756 } | 5780 } |
5757 | 5781 |
5758 void AtomicsLoadStub::Generate(MacroAssembler* masm) { | 5782 void AtomicsLoadStub::Generate(MacroAssembler* masm) { |
5759 // TODO(binji) | 5783 // TODO(binji) |
5760 } | 5784 } |
5761 | 5785 |
5762 #undef __ | 5786 #undef __ |
5763 | 5787 |
5764 } // namespace internal | 5788 } // namespace internal |
5765 } // namespace v8 | 5789 } // namespace v8 |
5766 | 5790 |
5767 #endif // V8_TARGET_ARCH_MIPS64 | 5791 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |