Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 1892533004: Change calling convention of CallApiGetterStub to accept the AccessorInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Importing mips patch from 1896963002 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // ----------- S t a t e ------------- 5519 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
5520 // -- sp[0] : name 5520 // name below the exit frame to make GC aware of them.
5521 // -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ 5521 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
5522 // -- ... 5522 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
5523 // -- r2 : api_function_address 5523 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
5524 // ----------------------------------- 5524 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
5525 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
5526 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
5527 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
5528 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
5525 5529
5526 Register api_function_address = ApiGetterDescriptor::function_address(); 5530 Register receiver = ApiGetterDescriptor::ReceiverRegister();
5527 DCHECK(api_function_address.is(r2)); 5531 Register holder = ApiGetterDescriptor::HolderRegister();
5532 Register callback = ApiGetterDescriptor::CallbackRegister();
5533 Register scratch = r4;
5534 DCHECK(!AreAliased(receiver, holder, callback, scratch));
5528 5535
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);
5529 // v8::PropertyCallbackInfo::args_ array and name handle. 5549 // v8::PropertyCallbackInfo::args_ array and name handle.
5530 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5550 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5531 5551
5532 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. 5552 // Load address of v8::PropertyAccessorInfo::args_ array and name handle.
5533 __ mov(r0, sp); // r0 = Handle<Name> 5553 __ mov(r0, sp); // r0 = Handle<Name>
5534 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = v8::PCI::args_ 5554 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = v8::PCI::args_
5535 5555
5536 const int kApiStackSpace = 1; 5556 const int kApiStackSpace = 1;
5537 FrameScope frame_scope(masm, StackFrame::MANUAL); 5557 FrameScope frame_scope(masm, StackFrame::MANUAL);
5538 __ EnterExitFrame(false, kApiStackSpace); 5558 __ EnterExitFrame(false, kApiStackSpace);
5539 5559
5540 // Create v8::PropertyCallbackInfo object on the stack and initialize 5560 // Create v8::PropertyCallbackInfo object on the stack and initialize
5541 // it's args_ field. 5561 // it's args_ field.
5542 __ str(r1, MemOperand(sp, 1 * kPointerSize)); 5562 __ str(r1, MemOperand(sp, 1 * kPointerSize));
5543 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = v8::PropertyCallbackInfo& 5563 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = v8::PropertyCallbackInfo&
5544 5564
5545 ExternalReference thunk_ref = 5565 ExternalReference thunk_ref =
5546 ExternalReference::invoke_accessor_getter_callback(isolate()); 5566 ExternalReference::invoke_accessor_getter_callback(isolate());
5547 5567
5568 __ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset));
5569 __ ldr(api_function_address,
5570 FieldMemOperand(scratch, Foreign::kForeignAddressOffset));
5571
5548 // +3 is to skip prolog, return address and name handle. 5572 // +3 is to skip prolog, return address and name handle.
5549 MemOperand return_value_operand( 5573 MemOperand return_value_operand(
5550 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 5574 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
5551 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5575 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5552 kStackUnwindSpace, NULL, return_value_operand, NULL); 5576 kStackUnwindSpace, NULL, return_value_operand, NULL);
5553 } 5577 }
5554 5578
5555 namespace { 5579 namespace {
5556 5580
5557 void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store, 5581 void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
5712 __ bind(&use_heap_number); 5736 __ bind(&use_heap_number);
5713 ReturnAllocatedHeapNumber(masm, d0, r1, r2, r3); 5737 ReturnAllocatedHeapNumber(masm, d0, r1, r2, r3);
5714 } 5738 }
5715 5739
5716 #undef __ 5740 #undef __
5717 5741
5718 } // namespace internal 5742 } // namespace internal
5719 } // namespace v8 5743 } // namespace v8
5720 5744
5721 #endif // V8_TARGET_ARCH_ARM 5745 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698