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

Side by Side Diff: src/mips/code-stubs-mips.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/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 5672 matching lines...) Expand 10 before | Expand all | Expand 10 after
5683 int32_t stack_space_offset = 4 * kPointerSize; 5683 int32_t stack_space_offset = 4 * kPointerSize;
5684 stack_space = argc() + FCA::kArgsLength + 1; 5684 stack_space = argc() + FCA::kArgsLength + 1;
5685 stack_space_offset = kInvalidStackOffset; 5685 stack_space_offset = kInvalidStackOffset;
5686 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 5686 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
5687 stack_space_offset, return_value_operand, 5687 stack_space_offset, return_value_operand,
5688 &context_restore_operand); 5688 &context_restore_operand);
5689 } 5689 }
5690 5690
5691 5691
5692 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5692 void CallApiGetterStub::Generate(MacroAssembler* masm) {
5693 // ----------- S t a t e ------------- 5693 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
5694 // -- sp[0] : name 5694 // name below the exit frame to make GC aware of them.
5695 // -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ 5695 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
5696 // -- ... 5696 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
5697 // -- a2 : api_function_address 5697 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
5698 // ----------------------------------- 5698 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
5699 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
5700 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
5701 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
5702 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
5699 5703
5700 Register api_function_address = ApiGetterDescriptor::function_address(); 5704 Register receiver = ApiGetterDescriptor::ReceiverRegister();
5701 DCHECK(api_function_address.is(a2)); 5705 Register holder = ApiGetterDescriptor::HolderRegister();
5706 Register callback = ApiGetterDescriptor::CallbackRegister();
5707 Register scratch = t0;
5708 Register scratch2 = t1;
5709 Register scratch3 = t2;
5710 DCHECK(!AreAliased(receiver, holder, callback, scratch, scratch2, scratch3));
5702 5711
5712 Register api_function_address = a2;
5713
5714 __ Push(receiver);
5715 // Push data from AccessorInfo.
5716 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
5717 __ li(scratch2, Operand(ExternalReference::isolate_address(isolate())));
5718 __ lw(scratch3, FieldMemOperand(callback, AccessorInfo::kDataOffset));
5719 __ Push(scratch3, scratch, scratch, scratch2, holder);
5720 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false
5721 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset));
5722 __ push(scratch);
5703 // v8::PropertyCallbackInfo::args_ array and name handle. 5723 // v8::PropertyCallbackInfo::args_ array and name handle.
5704 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5724 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5705 5725
5706 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. 5726 // Load address of v8::PropertyAccessorInfo::args_ array and name handle.
5707 __ mov(a0, sp); // a0 = Handle<Name> 5727 __ mov(a0, sp); // a0 = Handle<Name>
5708 __ Addu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_ 5728 __ Addu(a1, a0, Operand(1 * kPointerSize)); // a1 = v8::PCI::args_
5709 5729
5710 const int kApiStackSpace = 1; 5730 const int kApiStackSpace = 1;
5711 FrameScope frame_scope(masm, StackFrame::MANUAL); 5731 FrameScope frame_scope(masm, StackFrame::MANUAL);
5712 __ EnterExitFrame(false, kApiStackSpace); 5732 __ EnterExitFrame(false, kApiStackSpace);
5713 5733
5714 // Create v8::PropertyCallbackInfo object on the stack and initialize 5734 // Create v8::PropertyCallbackInfo object on the stack and initialize
5715 // it's args_ field. 5735 // it's args_ field.
5716 __ sw(a1, MemOperand(sp, 1 * kPointerSize)); 5736 __ sw(a1, MemOperand(sp, 1 * kPointerSize));
5717 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = v8::PropertyCallbackInfo& 5737 __ Addu(a1, sp, Operand(1 * kPointerSize)); // a1 = v8::PropertyCallbackInfo&
5718 5738
5719 ExternalReference thunk_ref = 5739 ExternalReference thunk_ref =
5720 ExternalReference::invoke_accessor_getter_callback(isolate()); 5740 ExternalReference::invoke_accessor_getter_callback(isolate());
5721 5741
5742 __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset));
5743 __ lw(api_function_address,
5744 FieldMemOperand(scratch, Foreign::kForeignAddressOffset));
5745
5722 // +3 is to skip prolog, return address and name handle. 5746 // +3 is to skip prolog, return address and name handle.
5723 MemOperand return_value_operand( 5747 MemOperand return_value_operand(
5724 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 5748 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
5725 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5749 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5726 kStackUnwindSpace, kInvalidStackOffset, 5750 kStackUnwindSpace, kInvalidStackOffset,
5727 return_value_operand, NULL); 5751 return_value_operand, NULL);
5728 } 5752 }
5729 5753
5730 void AtomicsLoadStub::Generate(MacroAssembler* masm) { 5754 void AtomicsLoadStub::Generate(MacroAssembler* masm) {
5731 // TODO(binji) 5755 // TODO(binji)
5732 } 5756 }
5733 5757
5734 #undef __ 5758 #undef __
5735 5759
5736 } // namespace internal 5760 } // namespace internal
5737 } // namespace v8 5761 } // namespace v8
5738 5762
5739 #endif // V8_TARGET_ARCH_MIPS 5763 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698