| 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 5590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5601 | 5601 |
| 5602 typedef FunctionCallbackArguments FCA; | 5602 typedef FunctionCallbackArguments FCA; |
| 5603 | 5603 |
| 5604 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 5604 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
| 5605 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 5605 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
| 5606 STATIC_ASSERT(FCA::kDataIndex == 4); | 5606 STATIC_ASSERT(FCA::kDataIndex == 4); |
| 5607 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 5607 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
| 5608 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 5608 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
| 5609 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 5609 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
| 5610 STATIC_ASSERT(FCA::kHolderIndex == 0); | 5610 STATIC_ASSERT(FCA::kHolderIndex == 0); |
| 5611 STATIC_ASSERT(FCA::kArgsLength == 7); | 5611 STATIC_ASSERT(FCA::kNewTargetIndex == 7); |
| 5612 STATIC_ASSERT(FCA::kArgsLength == 8); |
| 5613 |
| 5614 // new target |
| 5615 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 5612 | 5616 |
| 5613 // Save context, callee and call data. | 5617 // Save context, callee and call data. |
| 5614 __ Push(context, callee, call_data); | 5618 __ Push(context, callee, call_data); |
| 5615 if (!is_lazy()) { | 5619 if (!is_lazy()) { |
| 5616 // Load context from callee. | 5620 // Load context from callee. |
| 5617 __ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset)); | 5621 __ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
| 5618 } | 5622 } |
| 5619 | 5623 |
| 5620 Register scratch = call_data; | 5624 Register scratch = call_data; |
| 5621 if (!call_data_undefined()) { | 5625 if (!call_data_undefined()) { |
| 5622 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 5626 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 5623 } | 5627 } |
| 5624 // Push return value and default return value. | 5628 // Push return value and default return value. |
| 5625 __ Push(scratch, scratch); | 5629 __ Push(scratch, scratch); |
| 5626 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); | 5630 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); |
| 5627 // Push isolate and holder. | 5631 // Push isolate and holder. |
| 5628 __ Push(scratch, holder); | 5632 __ Push(scratch, holder); |
| 5629 | 5633 |
| 5630 // Prepare arguments. | 5634 // Prepare arguments. |
| 5631 __ mov(scratch, sp); | 5635 __ mov(scratch, sp); |
| 5632 | 5636 |
| 5633 // Allocate the v8::Arguments structure in the arguments' space since | 5637 // Allocate the v8::Arguments structure in the arguments' space since |
| 5634 // it's not controlled by GC. | 5638 // it's not controlled by GC. |
| 5635 const int kApiStackSpace = 4; | 5639 const int kApiStackSpace = 3; |
| 5636 | 5640 |
| 5637 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5641 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 5638 __ EnterExitFrame(false, kApiStackSpace); | 5642 __ EnterExitFrame(false, kApiStackSpace); |
| 5639 | 5643 |
| 5640 DCHECK(!api_function_address.is(a0) && !scratch.is(a0)); | 5644 DCHECK(!api_function_address.is(a0) && !scratch.is(a0)); |
| 5641 // a0 = FunctionCallbackInfo& | 5645 // a0 = FunctionCallbackInfo& |
| 5642 // Arguments is after the return address. | 5646 // Arguments is after the return address. |
| 5643 __ Addu(a0, sp, Operand(1 * kPointerSize)); | 5647 __ Addu(a0, sp, Operand(1 * kPointerSize)); |
| 5644 // FunctionCallbackInfo::implicit_args_ | 5648 // FunctionCallbackInfo::implicit_args_ |
| 5645 __ sw(scratch, MemOperand(a0, 0 * kPointerSize)); | 5649 __ sw(scratch, MemOperand(a0, 0 * kPointerSize)); |
| 5646 // FunctionCallbackInfo::values_ | 5650 // FunctionCallbackInfo::values_ |
| 5647 __ Addu(at, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); | 5651 __ Addu(at, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); |
| 5648 __ sw(at, MemOperand(a0, 1 * kPointerSize)); | 5652 __ sw(at, MemOperand(a0, 1 * kPointerSize)); |
| 5649 // FunctionCallbackInfo::length_ = argc | 5653 // FunctionCallbackInfo::length_ = argc |
| 5650 __ li(at, Operand(argc())); | 5654 __ li(at, Operand(argc())); |
| 5651 __ sw(at, MemOperand(a0, 2 * kPointerSize)); | 5655 __ sw(at, MemOperand(a0, 2 * kPointerSize)); |
| 5652 // FunctionCallbackInfo::is_construct_call_ = 0 | |
| 5653 __ sw(zero_reg, MemOperand(a0, 3 * kPointerSize)); | |
| 5654 | 5656 |
| 5655 ExternalReference thunk_ref = | 5657 ExternalReference thunk_ref = |
| 5656 ExternalReference::invoke_function_callback(masm->isolate()); | 5658 ExternalReference::invoke_function_callback(masm->isolate()); |
| 5657 | 5659 |
| 5658 AllowExternalCallThatCantCauseGC scope(masm); | 5660 AllowExternalCallThatCantCauseGC scope(masm); |
| 5659 MemOperand context_restore_operand( | 5661 MemOperand context_restore_operand( |
| 5660 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); | 5662 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); |
| 5661 // Stores return the first js argument. | 5663 // Stores return the first js argument. |
| 5662 int return_value_offset = 0; | 5664 int return_value_offset = 0; |
| 5663 if (is_store()) { | 5665 if (is_store()) { |
| 5664 return_value_offset = 2 + FCA::kArgsLength; | 5666 return_value_offset = 2 + FCA::kArgsLength; |
| 5665 } else { | 5667 } else { |
| 5666 return_value_offset = 2 + FCA::kReturnValueOffset; | 5668 return_value_offset = 2 + FCA::kReturnValueOffset; |
| 5667 } | 5669 } |
| 5668 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); | 5670 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); |
| 5669 int stack_space = 0; | 5671 int stack_space = 0; |
| 5670 int32_t stack_space_offset = 4 * kPointerSize; | 5672 int32_t stack_space_offset = 3 * kPointerSize; |
| 5671 stack_space = argc() + FCA::kArgsLength + 1; | 5673 stack_space = argc() + FCA::kArgsLength + 1; |
| 5674 // TODO(adamk): Why are we clobbering this immediately? |
| 5672 stack_space_offset = kInvalidStackOffset; | 5675 stack_space_offset = kInvalidStackOffset; |
| 5673 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5676 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
| 5674 stack_space_offset, return_value_operand, | 5677 stack_space_offset, return_value_operand, |
| 5675 &context_restore_operand); | 5678 &context_restore_operand); |
| 5676 } | 5679 } |
| 5677 | 5680 |
| 5678 | 5681 |
| 5679 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5682 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5680 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 5683 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
| 5681 // name below the exit frame to make GC aware of them. | 5684 // name below the exit frame to make GC aware of them. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5737 kStackUnwindSpace, kInvalidStackOffset, | 5740 kStackUnwindSpace, kInvalidStackOffset, |
| 5738 return_value_operand, NULL); | 5741 return_value_operand, NULL); |
| 5739 } | 5742 } |
| 5740 | 5743 |
| 5741 #undef __ | 5744 #undef __ |
| 5742 | 5745 |
| 5743 } // namespace internal | 5746 } // namespace internal |
| 5744 } // namespace v8 | 5747 } // namespace v8 |
| 5745 | 5748 |
| 5746 #endif // V8_TARGET_ARCH_MIPS | 5749 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |