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

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

Issue 1775933005: Revert of Rework CallApi*Stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/mips/interface-descriptors-mips.cc ('k') | src/mips64/interface-descriptors-mips64.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 5600 matching lines...) Expand 10 before | Expand all | Expand 10 after
5611 __ mov(s0, v0); 5611 __ mov(s0, v0);
5612 __ mov(a0, v0); 5612 __ mov(a0, v0);
5613 __ PrepareCallCFunction(1, s1); 5613 __ PrepareCallCFunction(1, s1);
5614 __ li(a0, Operand(ExternalReference::isolate_address(isolate))); 5614 __ li(a0, Operand(ExternalReference::isolate_address(isolate)));
5615 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), 5615 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate),
5616 1); 5616 1);
5617 __ mov(v0, s0); 5617 __ mov(v0, s0);
5618 __ jmp(&leave_exit_frame); 5618 __ jmp(&leave_exit_frame);
5619 } 5619 }
5620 5620
5621 void CallApiCallbackStub::Generate(MacroAssembler* masm) { 5621 static void CallApiFunctionStubHelper(MacroAssembler* masm,
5622 const ParameterCount& argc,
5623 bool return_first_arg,
5624 bool call_data_undefined, bool is_lazy) {
5622 // ----------- S t a t e ------------- 5625 // ----------- S t a t e -------------
5623 // -- a0 : callee 5626 // -- a0 : callee
5624 // -- a4 : call_data 5627 // -- a4 : call_data
5625 // -- a2 : holder 5628 // -- a2 : holder
5626 // -- a1 : api_function_address 5629 // -- a1 : api_function_address
5630 // -- a3 : number of arguments if argc is a register
5627 // -- cp : context 5631 // -- cp : context
5628 // -- 5632 // --
5629 // -- sp[0] : last argument 5633 // -- sp[0] : last argument
5630 // -- ... 5634 // -- ...
5631 // -- sp[(argc - 1)* 8] : first argument 5635 // -- sp[(argc - 1)* 8] : first argument
5632 // -- sp[argc * 8] : receiver 5636 // -- sp[argc * 8] : receiver
5633 // ----------------------------------- 5637 // -----------------------------------
5634 5638
5635 Register callee = a0; 5639 Register callee = a0;
5636 Register call_data = a4; 5640 Register call_data = a4;
5637 Register holder = a2; 5641 Register holder = a2;
5638 Register api_function_address = a1; 5642 Register api_function_address = a1;
5639 Register context = cp; 5643 Register context = cp;
5640 5644
5641 typedef FunctionCallbackArguments FCA; 5645 typedef FunctionCallbackArguments FCA;
5642 5646
5643 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5647 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5644 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5648 STATIC_ASSERT(FCA::kCalleeIndex == 5);
5645 STATIC_ASSERT(FCA::kDataIndex == 4); 5649 STATIC_ASSERT(FCA::kDataIndex == 4);
5646 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 5650 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
5647 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 5651 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
5648 STATIC_ASSERT(FCA::kIsolateIndex == 1); 5652 STATIC_ASSERT(FCA::kIsolateIndex == 1);
5649 STATIC_ASSERT(FCA::kHolderIndex == 0); 5653 STATIC_ASSERT(FCA::kHolderIndex == 0);
5650 STATIC_ASSERT(FCA::kArgsLength == 7); 5654 STATIC_ASSERT(FCA::kArgsLength == 7);
5651 5655
5656 DCHECK(argc.is_immediate() || a3.is(argc.reg()));
5657
5652 // Save context, callee and call data. 5658 // Save context, callee and call data.
5653 __ Push(context, callee, call_data); 5659 __ Push(context, callee, call_data);
5654 if (!is_lazy()) { 5660 if (!is_lazy) {
5655 // Load context from callee. 5661 // Load context from callee.
5656 __ ld(context, FieldMemOperand(callee, JSFunction::kContextOffset)); 5662 __ ld(context, FieldMemOperand(callee, JSFunction::kContextOffset));
5657 } 5663 }
5658 5664
5659 Register scratch = call_data; 5665 Register scratch = call_data;
5660 if (!call_data_undefined()) { 5666 if (!call_data_undefined) {
5661 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 5667 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
5662 } 5668 }
5663 // Push return value and default return value. 5669 // Push return value and default return value.
5664 __ Push(scratch, scratch); 5670 __ Push(scratch, scratch);
5665 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 5671 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
5666 // Push isolate and holder. 5672 // Push isolate and holder.
5667 __ Push(scratch, holder); 5673 __ Push(scratch, holder);
5668 5674
5669 // Prepare arguments. 5675 // Prepare arguments.
5670 __ mov(scratch, sp); 5676 __ mov(scratch, sp);
5671 5677
5672 // Allocate the v8::Arguments structure in the arguments' space since 5678 // Allocate the v8::Arguments structure in the arguments' space since
5673 // it's not controlled by GC. 5679 // it's not controlled by GC.
5674 const int kApiStackSpace = 4; 5680 const int kApiStackSpace = 4;
5675 5681
5676 FrameScope frame_scope(masm, StackFrame::MANUAL); 5682 FrameScope frame_scope(masm, StackFrame::MANUAL);
5677 __ EnterExitFrame(false, kApiStackSpace); 5683 __ EnterExitFrame(false, kApiStackSpace);
5678 5684
5679 DCHECK(!api_function_address.is(a0) && !scratch.is(a0)); 5685 DCHECK(!api_function_address.is(a0) && !scratch.is(a0));
5680 // a0 = FunctionCallbackInfo& 5686 // a0 = FunctionCallbackInfo&
5681 // Arguments is after the return address. 5687 // Arguments is after the return address.
5682 __ Daddu(a0, sp, Operand(1 * kPointerSize)); 5688 __ Daddu(a0, sp, Operand(1 * kPointerSize));
5683 // FunctionCallbackInfo::implicit_args_ 5689 // FunctionCallbackInfo::implicit_args_
5684 __ sd(scratch, MemOperand(a0, 0 * kPointerSize)); 5690 __ sd(scratch, MemOperand(a0, 0 * kPointerSize));
5685 // FunctionCallbackInfo::values_ 5691 if (argc.is_immediate()) {
5686 __ Daddu(at, scratch, 5692 // FunctionCallbackInfo::values_
5687 Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); 5693 __ Daddu(at, scratch,
5688 __ sd(at, MemOperand(a0, 1 * kPointerSize)); 5694 Operand((FCA::kArgsLength - 1 + argc.immediate()) * kPointerSize));
5689 // FunctionCallbackInfo::length_ = argc 5695 __ sd(at, MemOperand(a0, 1 * kPointerSize));
5690 // Stored as int field, 32-bit integers within struct on stack always left 5696 // FunctionCallbackInfo::length_ = argc
5691 // justified by n64 ABI. 5697 // Stored as int field, 32-bit integers within struct on stack always left
5692 __ li(at, Operand(argc())); 5698 // justified by n64 ABI.
5693 __ sw(at, MemOperand(a0, 2 * kPointerSize)); 5699 __ li(at, Operand(argc.immediate()));
5694 // FunctionCallbackInfo::is_construct_call_ = 0 5700 __ sw(at, MemOperand(a0, 2 * kPointerSize));
5695 __ sw(zero_reg, MemOperand(a0, 2 * kPointerSize + kIntSize)); 5701 // FunctionCallbackInfo::is_construct_call_ = 0
5702 __ sw(zero_reg, MemOperand(a0, 2 * kPointerSize + kIntSize));
5703 } else {
5704 // FunctionCallbackInfo::values_
5705 __ dsll(at, argc.reg(), kPointerSizeLog2);
5706 __ Daddu(at, at, scratch);
5707 __ Daddu(at, at, Operand((FCA::kArgsLength - 1) * kPointerSize));
5708 __ sd(at, MemOperand(a0, 1 * kPointerSize));
5709 // FunctionCallbackInfo::length_ = argc
5710 // Stored as int field, 32-bit integers within struct on stack always left
5711 // justified by n64 ABI.
5712 __ sw(argc.reg(), MemOperand(a0, 2 * kPointerSize));
5713 // FunctionCallbackInfo::is_construct_call_
5714 __ Daddu(argc.reg(), argc.reg(), Operand(FCA::kArgsLength + 1));
5715 __ dsll(at, argc.reg(), kPointerSizeLog2);
5716 __ sw(at, MemOperand(a0, 2 * kPointerSize + kIntSize));
5717 }
5696 5718
5697 ExternalReference thunk_ref = 5719 ExternalReference thunk_ref =
5698 ExternalReference::invoke_function_callback(masm->isolate()); 5720 ExternalReference::invoke_function_callback(masm->isolate());
5699 5721
5700 AllowExternalCallThatCantCauseGC scope(masm); 5722 AllowExternalCallThatCantCauseGC scope(masm);
5701 MemOperand context_restore_operand( 5723 MemOperand context_restore_operand(
5702 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5724 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5703 // Stores return the first js argument. 5725 // Stores return the first js argument.
5704 int return_value_offset = 0; 5726 int return_value_offset = 0;
5705 if (is_store()) { 5727 if (return_first_arg) {
5706 return_value_offset = 2 + FCA::kArgsLength; 5728 return_value_offset = 2 + FCA::kArgsLength;
5707 } else { 5729 } else {
5708 return_value_offset = 2 + FCA::kReturnValueOffset; 5730 return_value_offset = 2 + FCA::kReturnValueOffset;
5709 } 5731 }
5710 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 5732 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
5711 int stack_space = 0; 5733 int stack_space = 0;
5712 int32_t stack_space_offset = 4 * kPointerSize; 5734 int32_t stack_space_offset = 4 * kPointerSize;
5713 stack_space = argc() + FCA::kArgsLength + 1; 5735 if (argc.is_immediate()) {
5714 stack_space_offset = kInvalidStackOffset; 5736 stack_space = argc.immediate() + FCA::kArgsLength + 1;
5737 stack_space_offset = kInvalidStackOffset;
5738 }
5715 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 5739 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
5716 stack_space_offset, return_value_operand, 5740 stack_space_offset, return_value_operand,
5717 &context_restore_operand); 5741 &context_restore_operand);
5718 } 5742 }
5719 5743
5720 5744
5745 void CallApiFunctionStub::Generate(MacroAssembler* masm) {
5746 bool call_data_undefined = this->call_data_undefined();
5747 CallApiFunctionStubHelper(masm, ParameterCount(a3), false,
5748 call_data_undefined, false);
5749 }
5750
5751
5752 void CallApiAccessorStub::Generate(MacroAssembler* masm) {
5753 bool is_store = this->is_store();
5754 int argc = this->argc();
5755 bool call_data_undefined = this->call_data_undefined();
5756 bool is_lazy = this->is_lazy();
5757 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store,
5758 call_data_undefined, is_lazy);
5759 }
5760
5761
5721 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5762 void CallApiGetterStub::Generate(MacroAssembler* masm) {
5722 // ----------- S t a t e ------------- 5763 // ----------- S t a t e -------------
5723 // -- sp[0] : name 5764 // -- sp[0] : name
5724 // -- sp[8 .. (8 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ 5765 // -- sp[8 .. (8 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_
5725 // -- ... 5766 // -- ...
5726 // -- a2 : api_function_address 5767 // -- a2 : api_function_address
5727 // ----------------------------------- 5768 // -----------------------------------
5728 5769
5729 Register api_function_address = ApiGetterDescriptor::function_address(); 5770 Register api_function_address = ApiGetterDescriptor::function_address();
5730 DCHECK(api_function_address.is(a2)); 5771 DCHECK(api_function_address.is(a2));
(...skipping 26 matching lines...) Expand all
5757 return_value_operand, NULL); 5798 return_value_operand, NULL);
5758 } 5799 }
5759 5800
5760 5801
5761 #undef __ 5802 #undef __
5762 5803
5763 } // namespace internal 5804 } // namespace internal
5764 } // namespace v8 5805 } // namespace v8
5765 5806
5766 #endif // V8_TARGET_ARCH_MIPS64 5807 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips64/interface-descriptors-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698