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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 5672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5683 int32_t stack_space_offset = 4 * kPointerSize; | 5683 int32_t stack_space_offset = 4 * kPointerSize; |
5684 stack_space = argc() + FCA::kArgsLength + 1; | 5684 stack_space = argc() + FCA::kArgsLength + 1; |
5685 stack_space_offset = kInvalidStackOffset; | 5685 stack_space_offset = kInvalidStackOffset; |
5686 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5686 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
5687 stack_space_offset, return_value_operand, | 5687 stack_space_offset, return_value_operand, |
5688 &context_restore_operand); | 5688 &context_restore_operand); |
5689 } | 5689 } |
5690 | 5690 |
5691 | 5691 |
5692 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5692 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
5693 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 5693 // ----------- S t a t e ------------- |
5694 // name below the exit frame to make GC aware of them. | 5694 // -- sp[0] : name |
5695 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | 5695 // -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ |
5696 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | 5696 // -- ... |
5697 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | 5697 // -- a2 : api_function_address |
5698 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | 5698 // ----------------------------------- |
5699 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
5700 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
5701 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
5702 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
5703 | 5699 |
5704 Register receiver = ApiGetterDescriptor::ReceiverRegister(); | 5700 Register api_function_address = ApiGetterDescriptor::function_address(); |
5705 Register holder = ApiGetterDescriptor::HolderRegister(); | 5701 DCHECK(api_function_address.is(a2)); |
5706 Register callback = ApiGetterDescriptor::CallbackRegister(); | |
5707 Register scratch = t0; | |
5708 Register scratch2 = t1; | |
5709 Register scratch3 = t2; | |
5710 DCHECK(!AreAliased(receiver, holder, callback, scratch, scratch2, scratch3)); | |
5711 | 5702 |
5712 Register api_function_address = a2; | |
5713 | |
5714 __ Push(receiver); | |
5715 // Push data from AccessorInfo. | |
5716 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | |
5717 __ li(scratch2, Operand(ExternalReference::isolate_address(isolate()))); | |
5718 __ lw(scratch3, FieldMemOperand(callback, AccessorInfo::kDataOffset)); | |
5719 __ Push(scratch3, scratch, scratch, scratch2, holder); | |
5720 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false | |
5721 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); | |
5722 __ push(scratch); | |
5723 // v8::PropertyCallbackInfo::args_ array and name handle. | 5703 // v8::PropertyCallbackInfo::args_ array and name handle. |
5724 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5704 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
5725 | 5705 |
5726 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5706 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
5727 __ mov(a0, sp); // a0 = Handle<Name> | 5707 __ mov(a0, sp); // a0 = Handle<Name> |
5728 __ Addu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_ | 5708 __ Addu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_ |
5729 | 5709 |
5730 const int kApiStackSpace = 1; | 5710 const int kApiStackSpace = 1; |
5731 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5711 FrameScope frame_scope(masm, StackFrame::MANUAL); |
5732 __ EnterExitFrame(false, kApiStackSpace); | 5712 __ EnterExitFrame(false, kApiStackSpace); |
5733 | 5713 |
5734 // Create v8::PropertyCallbackInfo object on the stack and initialize | 5714 // Create v8::PropertyCallbackInfo object on the stack and initialize |
5735 // it's args_ field. | 5715 // it's args_ field. |
5736 __ sw(a1, MemOperand(sp, 1 * kPointerSize)); | 5716 __ sw(a1, MemOperand(sp, 1 * kPointerSize)); |
5737 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = v8::PropertyCallbackInfo& | 5717 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = v8::PropertyCallbackInfo& |
5738 | 5718 |
5739 ExternalReference thunk_ref = | 5719 ExternalReference thunk_ref = |
5740 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5720 ExternalReference::invoke_accessor_getter_callback(isolate()); |
5741 | 5721 |
5742 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); | |
5743 __ lw(api_function_address, | |
5744 FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); | |
5745 | |
5746 // +3 is to skip prolog, return address and name handle. | 5722 // +3 is to skip prolog, return address and name handle. |
5747 MemOperand return_value_operand( | 5723 MemOperand return_value_operand( |
5748 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5724 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5749 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5725 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5750 kStackUnwindSpace, kInvalidStackOffset, | 5726 kStackUnwindSpace, kInvalidStackOffset, |
5751 return_value_operand, NULL); | 5727 return_value_operand, NULL); |
5752 } | 5728 } |
5753 | 5729 |
5754 void AtomicsLoadStub::Generate(MacroAssembler* masm) { | 5730 void AtomicsLoadStub::Generate(MacroAssembler* masm) { |
5755 // TODO(binji) | 5731 // TODO(binji) |
5756 } | 5732 } |
5757 | 5733 |
5758 #undef __ | 5734 #undef __ |
5759 | 5735 |
5760 } // namespace internal | 5736 } // namespace internal |
5761 } // namespace v8 | 5737 } // namespace v8 |
5762 | 5738 |
5763 #endif // V8_TARGET_ARCH_MIPS | 5739 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |