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 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 5720 // ----------- S t a t e ------------- |
5721 // name below the exit frame to make GC aware of them. | 5721 // -- sp[0] : name |
5722 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | 5722 // -- sp[8 .. (8 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ |
5723 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | 5723 // -- ... |
5724 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | 5724 // -- a2 : api_function_address |
5725 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | 5725 // ----------------------------------- |
5726 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
5727 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
5728 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
5729 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
5730 | 5726 |
5731 Register receiver = ApiGetterDescriptor::ReceiverRegister(); | 5727 Register api_function_address = ApiGetterDescriptor::function_address(); |
5732 Register holder = ApiGetterDescriptor::HolderRegister(); | 5728 DCHECK(api_function_address.is(a2)); |
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)); | |
5738 | 5729 |
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); | |
5750 // v8::PropertyCallbackInfo::args_ array and name handle. | 5730 // v8::PropertyCallbackInfo::args_ array and name handle. |
5751 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5731 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
5752 | 5732 |
5753 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5733 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
5754 __ mov(a0, sp); // a0 = Handle<Name> | 5734 __ mov(a0, sp); // a0 = Handle<Name> |
5755 __ Daddu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_ | 5735 __ Daddu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_ |
5756 | 5736 |
5757 const int kApiStackSpace = 1; | 5737 const int kApiStackSpace = 1; |
5758 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5738 FrameScope frame_scope(masm, StackFrame::MANUAL); |
5759 __ EnterExitFrame(false, kApiStackSpace); | 5739 __ EnterExitFrame(false, kApiStackSpace); |
5760 | 5740 |
5761 // Create v8::PropertyCallbackInfo object on the stack and initialize | 5741 // Create v8::PropertyCallbackInfo object on the stack and initialize |
5762 // it's args_ field. | 5742 // it's args_ field. |
5763 __ sd(a1, MemOperand(sp, 1 * kPointerSize)); | 5743 __ sd(a1, MemOperand(sp, 1 * kPointerSize)); |
5764 __ Daddu(a1, sp, Operand(1 * kPointerSize)); | 5744 __ Daddu(a1, sp, Operand(1 * kPointerSize)); |
5765 // a1 = v8::PropertyCallbackInfo& | 5745 // a1 = v8::PropertyCallbackInfo& |
5766 | 5746 |
5767 ExternalReference thunk_ref = | 5747 ExternalReference thunk_ref = |
5768 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5748 ExternalReference::invoke_accessor_getter_callback(isolate()); |
5769 | 5749 |
5770 __ ld(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); | |
5771 __ ld(api_function_address, | |
5772 FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); | |
5773 | |
5774 // +3 is to skip prolog, return address and name handle. | 5750 // +3 is to skip prolog, return address and name handle. |
5775 MemOperand return_value_operand( | 5751 MemOperand return_value_operand( |
5776 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5752 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5777 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5753 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5778 kStackUnwindSpace, kInvalidStackOffset, | 5754 kStackUnwindSpace, kInvalidStackOffset, |
5779 return_value_operand, NULL); | 5755 return_value_operand, NULL); |
5780 } | 5756 } |
5781 | 5757 |
5782 void AtomicsLoadStub::Generate(MacroAssembler* masm) { | 5758 void AtomicsLoadStub::Generate(MacroAssembler* masm) { |
5783 // TODO(binji) | 5759 // TODO(binji) |
5784 } | 5760 } |
5785 | 5761 |
5786 #undef __ | 5762 #undef __ |
5787 | 5763 |
5788 } // namespace internal | 5764 } // namespace internal |
5789 } // namespace v8 | 5765 } // namespace v8 |
5790 | 5766 |
5791 #endif // V8_TARGET_ARCH_MIPS64 | 5767 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |