| 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/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 5617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5628 | 5628 |
| 5629 typedef FunctionCallbackArguments FCA; | 5629 typedef FunctionCallbackArguments FCA; |
| 5630 | 5630 |
| 5631 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 5631 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
| 5632 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 5632 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
| 5633 STATIC_ASSERT(FCA::kDataIndex == 4); | 5633 STATIC_ASSERT(FCA::kDataIndex == 4); |
| 5634 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 5634 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
| 5635 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 5635 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
| 5636 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 5636 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
| 5637 STATIC_ASSERT(FCA::kHolderIndex == 0); | 5637 STATIC_ASSERT(FCA::kHolderIndex == 0); |
| 5638 STATIC_ASSERT(FCA::kArgsLength == 7); | 5638 STATIC_ASSERT(FCA::kNewTargetIndex == 7); |
| 5639 STATIC_ASSERT(FCA::kArgsLength == 8); |
| 5640 |
| 5641 // new target |
| 5642 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 5639 | 5643 |
| 5640 // context save | 5644 // context save |
| 5641 __ push(context); | 5645 __ push(context); |
| 5642 if (!is_lazy()) { | 5646 if (!is_lazy()) { |
| 5643 // load context from callee | 5647 // load context from callee |
| 5644 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); | 5648 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
| 5645 } | 5649 } |
| 5646 | 5650 |
| 5647 // callee | 5651 // callee |
| 5648 __ push(callee); | 5652 __ push(callee); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5664 // holder | 5668 // holder |
| 5665 __ push(holder); | 5669 __ push(holder); |
| 5666 | 5670 |
| 5667 // Prepare arguments. | 5671 // Prepare arguments. |
| 5668 __ mr(scratch, sp); | 5672 __ mr(scratch, sp); |
| 5669 | 5673 |
| 5670 // Allocate the v8::Arguments structure in the arguments' space since | 5674 // Allocate the v8::Arguments structure in the arguments' space since |
| 5671 // it's not controlled by GC. | 5675 // it's not controlled by GC. |
| 5672 // PPC LINUX ABI: | 5676 // PPC LINUX ABI: |
| 5673 // | 5677 // |
| 5674 // Create 5 extra slots on stack: | 5678 // Create 4 extra slots on stack: |
| 5675 // [0] space for DirectCEntryStub's LR save | 5679 // [0] space for DirectCEntryStub's LR save |
| 5676 // [1-4] FunctionCallbackInfo | 5680 // [1-3] FunctionCallbackInfo |
| 5677 const int kApiStackSpace = 5; | 5681 const int kApiStackSpace = 4; |
| 5678 const int kFunctionCallbackInfoOffset = | 5682 const int kFunctionCallbackInfoOffset = |
| 5679 (kStackFrameExtraParamSlot + 1) * kPointerSize; | 5683 (kStackFrameExtraParamSlot + 1) * kPointerSize; |
| 5680 | 5684 |
| 5681 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5685 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 5682 __ EnterExitFrame(false, kApiStackSpace); | 5686 __ EnterExitFrame(false, kApiStackSpace); |
| 5683 | 5687 |
| 5684 DCHECK(!api_function_address.is(r3) && !scratch.is(r3)); | 5688 DCHECK(!api_function_address.is(r3) && !scratch.is(r3)); |
| 5685 // r3 = FunctionCallbackInfo& | 5689 // r3 = FunctionCallbackInfo& |
| 5686 // Arguments is after the return address. | 5690 // Arguments is after the return address. |
| 5687 __ addi(r3, sp, Operand(kFunctionCallbackInfoOffset)); | 5691 __ addi(r3, sp, Operand(kFunctionCallbackInfoOffset)); |
| 5688 // FunctionCallbackInfo::implicit_args_ | 5692 // FunctionCallbackInfo::implicit_args_ |
| 5689 __ StoreP(scratch, MemOperand(r3, 0 * kPointerSize)); | 5693 __ StoreP(scratch, MemOperand(r3, 0 * kPointerSize)); |
| 5690 // FunctionCallbackInfo::values_ | 5694 // FunctionCallbackInfo::values_ |
| 5691 __ addi(ip, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); | 5695 __ addi(ip, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); |
| 5692 __ StoreP(ip, MemOperand(r3, 1 * kPointerSize)); | 5696 __ StoreP(ip, MemOperand(r3, 1 * kPointerSize)); |
| 5693 // FunctionCallbackInfo::length_ = argc | 5697 // FunctionCallbackInfo::length_ = argc |
| 5694 __ li(ip, Operand(argc())); | 5698 __ li(ip, Operand(argc())); |
| 5695 __ stw(ip, MemOperand(r3, 2 * kPointerSize)); | 5699 __ stw(ip, MemOperand(r3, 2 * kPointerSize)); |
| 5696 // FunctionCallbackInfo::is_construct_call_ = 0 | |
| 5697 __ li(ip, Operand::Zero()); | |
| 5698 __ stw(ip, MemOperand(r3, 2 * kPointerSize + kIntSize)); | |
| 5699 | 5700 |
| 5700 ExternalReference thunk_ref = | 5701 ExternalReference thunk_ref = |
| 5701 ExternalReference::invoke_function_callback(masm->isolate()); | 5702 ExternalReference::invoke_function_callback(masm->isolate()); |
| 5702 | 5703 |
| 5703 AllowExternalCallThatCantCauseGC scope(masm); | 5704 AllowExternalCallThatCantCauseGC scope(masm); |
| 5704 MemOperand context_restore_operand( | 5705 MemOperand context_restore_operand( |
| 5705 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); | 5706 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); |
| 5706 // Stores return the first js argument | 5707 // Stores return the first js argument |
| 5707 int return_value_offset = 0; | 5708 int return_value_offset = 0; |
| 5708 if (is_store()) { | 5709 if (is_store()) { |
| 5709 return_value_offset = 2 + FCA::kArgsLength; | 5710 return_value_offset = 2 + FCA::kArgsLength; |
| 5710 } else { | 5711 } else { |
| 5711 return_value_offset = 2 + FCA::kReturnValueOffset; | 5712 return_value_offset = 2 + FCA::kReturnValueOffset; |
| 5712 } | 5713 } |
| 5713 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); | 5714 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); |
| 5714 int stack_space = 0; | 5715 int stack_space = 0; |
| 5715 MemOperand is_construct_call_operand = | 5716 MemOperand length_operand = |
| 5716 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize + kIntSize); | 5717 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize); |
| 5717 MemOperand* stack_space_operand = &is_construct_call_operand; | 5718 MemOperand* stack_space_operand = &length_operand; |
| 5718 stack_space = argc() + FCA::kArgsLength + 1; | 5719 stack_space = argc() + FCA::kArgsLength + 1; |
| 5719 stack_space_operand = NULL; | 5720 stack_space_operand = NULL; |
| 5720 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5721 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
| 5721 stack_space_operand, return_value_operand, | 5722 stack_space_operand, return_value_operand, |
| 5722 &context_restore_operand); | 5723 &context_restore_operand); |
| 5723 } | 5724 } |
| 5724 | 5725 |
| 5725 | 5726 |
| 5726 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5727 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5727 int arg0Slot = 0; | 5728 int arg0Slot = 0; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5813 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5814 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
| 5814 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5815 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5815 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5816 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5816 } | 5817 } |
| 5817 | 5818 |
| 5818 #undef __ | 5819 #undef __ |
| 5819 } // namespace internal | 5820 } // namespace internal |
| 5820 } // namespace v8 | 5821 } // namespace v8 |
| 5821 | 5822 |
| 5822 #endif // V8_TARGET_ARCH_PPC | 5823 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |