| 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 5614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5625 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize + kIntSize); | 5625 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize + kIntSize); |
| 5626 MemOperand* stack_space_operand = &is_construct_call_operand; | 5626 MemOperand* stack_space_operand = &is_construct_call_operand; |
| 5627 stack_space = argc() + FCA::kArgsLength + 1; | 5627 stack_space = argc() + FCA::kArgsLength + 1; |
| 5628 stack_space_operand = NULL; | 5628 stack_space_operand = NULL; |
| 5629 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5629 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
| 5630 stack_space_operand, return_value_operand, | 5630 stack_space_operand, return_value_operand, |
| 5631 &context_restore_operand); | 5631 &context_restore_operand); |
| 5632 } | 5632 } |
| 5633 | 5633 |
| 5634 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5634 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5635 // ----------- S t a t e ------------- | |
| 5636 // -- sp[0] : name | |
| 5637 // -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ | |
| 5638 // -- ... | |
| 5639 // -- r4 : api_function_address | |
| 5640 // ----------------------------------- | |
| 5641 | |
| 5642 Register api_function_address = ApiGetterDescriptor::function_address(); | |
| 5643 int arg0Slot = 0; | 5635 int arg0Slot = 0; |
| 5644 int accessorInfoSlot = 0; | 5636 int accessorInfoSlot = 0; |
| 5645 int apiStackSpace = 0; | 5637 int apiStackSpace = 0; |
| 5646 DCHECK(api_function_address.is(r4)); | 5638 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
| 5639 // name below the exit frame to make GC aware of them. |
| 5640 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
| 5641 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
| 5642 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
| 5643 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
| 5644 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
| 5645 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
| 5646 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
| 5647 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
| 5648 |
| 5649 Register receiver = ApiGetterDescriptor::ReceiverRegister(); |
| 5650 Register holder = ApiGetterDescriptor::HolderRegister(); |
| 5651 Register callback = ApiGetterDescriptor::CallbackRegister(); |
| 5652 Register scratch = r6; |
| 5653 DCHECK(!AreAliased(receiver, holder, callback, scratch)); |
| 5654 |
| 5655 Register api_function_address = r4; |
| 5656 |
| 5657 __ push(receiver); |
| 5658 // Push data from AccessorInfo. |
| 5659 __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); |
| 5660 __ push(scratch); |
| 5661 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 5662 __ Push(scratch, scratch); |
| 5663 __ mov(scratch, Operand(ExternalReference::isolate_address(isolate()))); |
| 5664 __ Push(scratch, holder); |
| 5665 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false |
| 5666 __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); |
| 5667 __ push(scratch); |
| 5647 | 5668 |
| 5648 // v8::PropertyCallbackInfo::args_ array and name handle. | 5669 // v8::PropertyCallbackInfo::args_ array and name handle. |
| 5649 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5670 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
| 5650 | 5671 |
| 5651 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5672 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
| 5652 __ LoadRR(r2, sp); // r2 = Handle<Name> | 5673 __ LoadRR(r2, sp); // r2 = Handle<Name> |
| 5653 __ AddP(r3, r2, Operand(1 * kPointerSize)); // r3 = v8::PCI::args_ | 5674 __ AddP(r3, r2, Operand(1 * kPointerSize)); // r3 = v8::PCI::args_ |
| 5654 | 5675 |
| 5655 // If ABI passes Handles (pointer-sized struct) in a register: | 5676 // If ABI passes Handles (pointer-sized struct) in a register: |
| 5656 // | 5677 // |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5684 | 5705 |
| 5685 // Create v8::PropertyCallbackInfo object on the stack and initialize | 5706 // Create v8::PropertyCallbackInfo object on the stack and initialize |
| 5686 // it's args_ field. | 5707 // it's args_ field. |
| 5687 __ StoreP(r3, MemOperand(sp, accessorInfoSlot * kPointerSize)); | 5708 __ StoreP(r3, MemOperand(sp, accessorInfoSlot * kPointerSize)); |
| 5688 __ AddP(r3, sp, Operand(accessorInfoSlot * kPointerSize)); | 5709 __ AddP(r3, sp, Operand(accessorInfoSlot * kPointerSize)); |
| 5689 // r3 = v8::PropertyCallbackInfo& | 5710 // r3 = v8::PropertyCallbackInfo& |
| 5690 | 5711 |
| 5691 ExternalReference thunk_ref = | 5712 ExternalReference thunk_ref = |
| 5692 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5713 ExternalReference::invoke_accessor_getter_callback(isolate()); |
| 5693 | 5714 |
| 5715 __ LoadP(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); |
| 5716 __ LoadP(api_function_address, |
| 5717 FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); |
| 5718 |
| 5694 // +3 is to skip prolog, return address and name handle. | 5719 // +3 is to skip prolog, return address and name handle. |
| 5695 MemOperand return_value_operand( | 5720 MemOperand return_value_operand( |
| 5696 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5721 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
| 5697 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5722 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5698 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5723 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5699 } | 5724 } |
| 5700 | 5725 |
| 5701 #undef __ | 5726 #undef __ |
| 5702 | 5727 |
| 5703 } // namespace internal | 5728 } // namespace internal |
| 5704 } // namespace v8 | 5729 } // namespace v8 |
| 5705 | 5730 |
| 5706 #endif // V8_TARGET_ARCH_S390 | 5731 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |