| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 5498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5509 stack_space = argc() + FCA::kArgsLength + 1; | 5509 stack_space = argc() + FCA::kArgsLength + 1; |
| 5510 stack_space_operand = NULL; | 5510 stack_space_operand = NULL; |
| 5511 | 5511 |
| 5512 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5512 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
| 5513 stack_space_operand, return_value_operand, | 5513 stack_space_operand, return_value_operand, |
| 5514 &context_restore_operand); | 5514 &context_restore_operand); |
| 5515 } | 5515 } |
| 5516 | 5516 |
| 5517 | 5517 |
| 5518 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5518 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5519 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 5519 // ----------- S t a t e ------------- |
| 5520 // name below the exit frame to make GC aware of them. | 5520 // -- sp[0] : name |
| 5521 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | 5521 // -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ |
| 5522 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | 5522 // -- ... |
| 5523 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | 5523 // -- r2 : api_function_address |
| 5524 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | 5524 // ----------------------------------- |
| 5525 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
| 5526 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
| 5527 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
| 5528 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
| 5529 | 5525 |
| 5530 Register receiver = ApiGetterDescriptor::ReceiverRegister(); | 5526 Register api_function_address = ApiGetterDescriptor::function_address(); |
| 5531 Register holder = ApiGetterDescriptor::HolderRegister(); | 5527 DCHECK(api_function_address.is(r2)); |
| 5532 Register callback = ApiGetterDescriptor::CallbackRegister(); | |
| 5533 Register scratch = r4; | |
| 5534 DCHECK(!AreAliased(receiver, holder, callback, scratch)); | |
| 5535 | 5528 |
| 5536 Register api_function_address = r2; | |
| 5537 | |
| 5538 __ push(receiver); | |
| 5539 // Push data from AccessorInfo. | |
| 5540 __ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); | |
| 5541 __ push(scratch); | |
| 5542 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | |
| 5543 __ Push(scratch, scratch); | |
| 5544 __ mov(scratch, Operand(ExternalReference::isolate_address(isolate()))); | |
| 5545 __ Push(scratch, holder); | |
| 5546 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false | |
| 5547 __ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); | |
| 5548 __ push(scratch); | |
| 5549 // v8::PropertyCallbackInfo::args_ array and name handle. | 5529 // v8::PropertyCallbackInfo::args_ array and name handle. |
| 5550 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5530 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
| 5551 | 5531 |
| 5552 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5532 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
| 5553 __ mov(r0, sp); // r0 = Handle<Name> | 5533 __ mov(r0, sp); // r0 = Handle<Name> |
| 5554 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = v8::PCI::args_ | 5534 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = v8::PCI::args_ |
| 5555 | 5535 |
| 5556 const int kApiStackSpace = 1; | 5536 const int kApiStackSpace = 1; |
| 5557 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5537 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 5558 __ EnterExitFrame(false, kApiStackSpace); | 5538 __ EnterExitFrame(false, kApiStackSpace); |
| 5559 | 5539 |
| 5560 // Create v8::PropertyCallbackInfo object on the stack and initialize | 5540 // Create v8::PropertyCallbackInfo object on the stack and initialize |
| 5561 // it's args_ field. | 5541 // it's args_ field. |
| 5562 __ str(r1, MemOperand(sp, 1 * kPointerSize)); | 5542 __ str(r1, MemOperand(sp, 1 * kPointerSize)); |
| 5563 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = v8::PropertyCallbackInfo& | 5543 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = v8::PropertyCallbackInfo& |
| 5564 | 5544 |
| 5565 ExternalReference thunk_ref = | 5545 ExternalReference thunk_ref = |
| 5566 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5546 ExternalReference::invoke_accessor_getter_callback(isolate()); |
| 5567 | 5547 |
| 5568 __ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); | |
| 5569 __ ldr(api_function_address, | |
| 5570 FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); | |
| 5571 | |
| 5572 // +3 is to skip prolog, return address and name handle. | 5548 // +3 is to skip prolog, return address and name handle. |
| 5573 MemOperand return_value_operand( | 5549 MemOperand return_value_operand( |
| 5574 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5550 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
| 5575 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5551 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5576 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5552 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5577 } | 5553 } |
| 5578 | 5554 |
| 5579 namespace { | 5555 namespace { |
| 5580 | 5556 |
| 5581 void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store, | 5557 void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store, |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5736 __ bind(&use_heap_number); | 5712 __ bind(&use_heap_number); |
| 5737 ReturnAllocatedHeapNumber(masm, d0, r1, r2, r3); | 5713 ReturnAllocatedHeapNumber(masm, d0, r1, r2, r3); |
| 5738 } | 5714 } |
| 5739 | 5715 |
| 5740 #undef __ | 5716 #undef __ |
| 5741 | 5717 |
| 5742 } // namespace internal | 5718 } // namespace internal |
| 5743 } // namespace v8 | 5719 } // namespace v8 |
| 5744 | 5720 |
| 5745 #endif // V8_TARGET_ARCH_ARM | 5721 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |