| 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
| 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 5528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5539 | 5539 |
| 5540 typedef FunctionCallbackArguments FCA; | 5540 typedef FunctionCallbackArguments FCA; |
| 5541 | 5541 |
| 5542 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 5542 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
| 5543 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 5543 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
| 5544 STATIC_ASSERT(FCA::kDataIndex == 4); | 5544 STATIC_ASSERT(FCA::kDataIndex == 4); |
| 5545 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 5545 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
| 5546 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 5546 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
| 5547 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 5547 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
| 5548 STATIC_ASSERT(FCA::kHolderIndex == 0); | 5548 STATIC_ASSERT(FCA::kHolderIndex == 0); |
| 5549 STATIC_ASSERT(FCA::kArgsLength == 7); | 5549 STATIC_ASSERT(FCA::kNewTargetIndex == 7); |
| 5550 STATIC_ASSERT(FCA::kArgsLength == 8); |
| 5551 |
| 5552 // new target |
| 5553 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 5550 | 5554 |
| 5551 // context save | 5555 // context save |
| 5552 __ push(context); | 5556 __ push(context); |
| 5553 if (!is_lazy()) { | 5557 if (!is_lazy()) { |
| 5554 // load context from callee | 5558 // load context from callee |
| 5555 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); | 5559 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
| 5556 } | 5560 } |
| 5557 | 5561 |
| 5558 // callee | 5562 // callee |
| 5559 __ push(callee); | 5563 __ push(callee); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5575 // holder | 5579 // holder |
| 5576 __ push(holder); | 5580 __ push(holder); |
| 5577 | 5581 |
| 5578 // Prepare arguments. | 5582 // Prepare arguments. |
| 5579 __ LoadRR(scratch, sp); | 5583 __ LoadRR(scratch, sp); |
| 5580 | 5584 |
| 5581 // Allocate the v8::Arguments structure in the arguments' space since | 5585 // Allocate the v8::Arguments structure in the arguments' space since |
| 5582 // it's not controlled by GC. | 5586 // it's not controlled by GC. |
| 5583 // S390 LINUX ABI: | 5587 // S390 LINUX ABI: |
| 5584 // | 5588 // |
| 5585 // Create 5 extra slots on stack: | 5589 // Create 4 extra slots on stack: |
| 5586 // [0] space for DirectCEntryStub's LR save | 5590 // [0] space for DirectCEntryStub's LR save |
| 5587 // [1-4] FunctionCallbackInfo | 5591 // [1-3] FunctionCallbackInfo |
| 5588 const int kApiStackSpace = 5; | 5592 const int kApiStackSpace = 4; |
| 5589 const int kFunctionCallbackInfoOffset = | 5593 const int kFunctionCallbackInfoOffset = |
| 5590 (kStackFrameExtraParamSlot + 1) * kPointerSize; | 5594 (kStackFrameExtraParamSlot + 1) * kPointerSize; |
| 5591 | 5595 |
| 5592 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5596 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 5593 __ EnterExitFrame(false, kApiStackSpace); | 5597 __ EnterExitFrame(false, kApiStackSpace); |
| 5594 | 5598 |
| 5595 DCHECK(!api_function_address.is(r2) && !scratch.is(r2)); | 5599 DCHECK(!api_function_address.is(r2) && !scratch.is(r2)); |
| 5596 // r2 = FunctionCallbackInfo& | 5600 // r2 = FunctionCallbackInfo& |
| 5597 // Arguments is after the return address. | 5601 // Arguments is after the return address. |
| 5598 __ AddP(r2, sp, Operand(kFunctionCallbackInfoOffset)); | 5602 __ AddP(r2, sp, Operand(kFunctionCallbackInfoOffset)); |
| 5599 // FunctionCallbackInfo::implicit_args_ | 5603 // FunctionCallbackInfo::implicit_args_ |
| 5600 __ StoreP(scratch, MemOperand(r2, 0 * kPointerSize)); | 5604 __ StoreP(scratch, MemOperand(r2, 0 * kPointerSize)); |
| 5601 // FunctionCallbackInfo::values_ | 5605 // FunctionCallbackInfo::values_ |
| 5602 __ AddP(ip, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); | 5606 __ AddP(ip, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); |
| 5603 __ StoreP(ip, MemOperand(r2, 1 * kPointerSize)); | 5607 __ StoreP(ip, MemOperand(r2, 1 * kPointerSize)); |
| 5604 // FunctionCallbackInfo::length_ = argc | 5608 // FunctionCallbackInfo::length_ = argc |
| 5605 __ LoadImmP(ip, Operand(argc())); | 5609 __ LoadImmP(ip, Operand(argc())); |
| 5606 __ StoreW(ip, MemOperand(r2, 2 * kPointerSize)); | 5610 __ StoreW(ip, MemOperand(r2, 2 * kPointerSize)); |
| 5607 // FunctionCallbackInfo::is_construct_call_ = 0 | |
| 5608 __ LoadImmP(ip, Operand::Zero()); | |
| 5609 __ StoreW(ip, MemOperand(r2, 2 * kPointerSize + kIntSize)); | |
| 5610 | 5611 |
| 5611 ExternalReference thunk_ref = | 5612 ExternalReference thunk_ref = |
| 5612 ExternalReference::invoke_function_callback(masm->isolate()); | 5613 ExternalReference::invoke_function_callback(masm->isolate()); |
| 5613 | 5614 |
| 5614 AllowExternalCallThatCantCauseGC scope(masm); | 5615 AllowExternalCallThatCantCauseGC scope(masm); |
| 5615 MemOperand context_restore_operand( | 5616 MemOperand context_restore_operand( |
| 5616 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); | 5617 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); |
| 5617 // Stores return the first js argument | 5618 // Stores return the first js argument |
| 5618 int return_value_offset = 0; | 5619 int return_value_offset = 0; |
| 5619 if (is_store()) { | 5620 if (is_store()) { |
| 5620 return_value_offset = 2 + FCA::kArgsLength; | 5621 return_value_offset = 2 + FCA::kArgsLength; |
| 5621 } else { | 5622 } else { |
| 5622 return_value_offset = 2 + FCA::kReturnValueOffset; | 5623 return_value_offset = 2 + FCA::kReturnValueOffset; |
| 5623 } | 5624 } |
| 5624 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); | 5625 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); |
| 5625 int stack_space = 0; | 5626 int stack_space = 0; |
| 5626 MemOperand is_construct_call_operand = | 5627 MemOperand length_operand = |
| 5627 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize + kIntSize); | 5628 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize); |
| 5628 MemOperand* stack_space_operand = &is_construct_call_operand; | 5629 MemOperand* stack_space_operand = &length_operand; |
| 5629 stack_space = argc() + FCA::kArgsLength + 1; | 5630 stack_space = argc() + FCA::kArgsLength + 1; |
| 5630 stack_space_operand = NULL; | 5631 stack_space_operand = NULL; |
| 5631 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5632 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
| 5632 stack_space_operand, return_value_operand, | 5633 stack_space_operand, return_value_operand, |
| 5633 &context_restore_operand); | 5634 &context_restore_operand); |
| 5634 } | 5635 } |
| 5635 | 5636 |
| 5636 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5637 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5637 int arg0Slot = 0; | 5638 int arg0Slot = 0; |
| 5638 int accessorInfoSlot = 0; | 5639 int accessorInfoSlot = 0; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5724 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5725 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5725 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5726 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5726 } | 5727 } |
| 5727 | 5728 |
| 5728 #undef __ | 5729 #undef __ |
| 5729 | 5730 |
| 5730 } // namespace internal | 5731 } // namespace internal |
| 5731 } // namespace v8 | 5732 } // namespace v8 |
| 5732 | 5733 |
| 5733 #endif // V8_TARGET_ARCH_S390 | 5734 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |