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

Side by Side Diff: src/mips/builtins-mips.cc

Issue 1688283003: [Interpreter] Implements calls through CallICStub in the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removes an unused label declaration. Created 4 years, 10 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/interpreter/interpreter-assembler.cc ('k') | src/mips/code-stubs-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/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 // Leave the frame (also dropping the register file). 941 // Leave the frame (also dropping the register file).
942 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 942 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
943 943
944 // Drop receiver + arguments and return. 944 // Drop receiver + arguments and return.
945 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, 945 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister,
946 BytecodeArray::kParameterSizeOffset)); 946 BytecodeArray::kParameterSizeOffset));
947 __ Addu(sp, sp, at); 947 __ Addu(sp, sp, at);
948 __ Jump(ra); 948 __ Jump(ra);
949 } 949 }
950 950
951 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index,
952 Register limit, Register scratch) {
953 Label loop_header, loop_check;
954 __ Branch(&loop_check);
955 __ bind(&loop_header);
956 __ lw(scratch, MemOperand(index));
957 __ Addu(index, index, Operand(-kPointerSize));
958 __ push(scratch);
959 __ bind(&loop_check);
960 __ Branch(&loop_header, gt, index, Operand(limit));
961 }
962
963 static void Generate_InterpreterComputeLastArgumentAddress(
964 MacroAssembler* masm, Register num_args, Register start_address,
965 Register output_reg) {
966 __ Addu(output_reg, num_args, Operand(1)); // Add one for receiver.
967 __ sll(output_reg, output_reg, kPointerSizeLog2);
968 __ Subu(output_reg, start_address, output_reg);
969 }
970
971 // static
972 void Builtins::Generate_InterpreterPushArgsAndCallICImpl(
973 MacroAssembler* masm, TailCallMode tail_call_mode) {
974 // ----------- S t a t e -------------
975 // -- a0 : the number of arguments (not including the receiver)
976 // -- t0 : the address of the first argument to be pushed. Subsequent
977 // arguments should be consecutive above this, in the same order as
978 // they are to be pushed onto the stack.
979 // -- a1 : the target to call (can be any Object).
980 // -- a3 : feedback vector slot id
981 // -- a2 : type feedback vector
982 // -----------------------------------
983
984 {
985 FrameScope scope(masm, StackFrame::INTERNAL);
986
987 // Computes the address of last argument in t1.
988 Generate_InterpreterComputeLastArgumentAddress(masm, a0, t0, t1);
989
990 // Push the arguments.
991 Generate_InterpreterPushArgs(masm, t0, t1, at);
992
993 // Call via the CallIC stub.
994 CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode,
995 true);
996 CallICStub stub(masm->isolate(), call_ic_state);
997 // TODO(mythria): This should be replaced by a TailCallStub, when we
998 // update the code to find the target IC from jump instructions.
999 __ CallStub(&stub);
1000 }
1001 __ Ret();
1002 }
951 1003
952 // static 1004 // static
953 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 1005 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
954 MacroAssembler* masm, TailCallMode tail_call_mode) { 1006 MacroAssembler* masm, TailCallMode tail_call_mode) {
955 // ----------- S t a t e ------------- 1007 // ----------- S t a t e -------------
956 // -- a0 : the number of arguments (not including the receiver) 1008 // -- a0 : the number of arguments (not including the receiver)
957 // -- a2 : the address of the first argument to be pushed. Subsequent 1009 // -- a2 : the address of the first argument to be pushed. Subsequent
958 // arguments should be consecutive above this, in the same order as 1010 // arguments should be consecutive above this, in the same order as
959 // they are to be pushed onto the stack. 1011 // they are to be pushed onto the stack.
960 // -- a1 : the target to call (can be any Object). 1012 // -- a1 : the target to call (can be any Object).
961 // ----------------------------------- 1013 // -----------------------------------
962 1014
963 // Find the address of the last argument. 1015 // Computes the address of last argument in a3.
964 __ Addu(a3, a0, Operand(1)); // Add one for receiver. 1016 Generate_InterpreterComputeLastArgumentAddress(masm, a0, a2, a3);
965 __ sll(a3, a3, kPointerSizeLog2);
966 __ Subu(a3, a2, Operand(a3));
967 1017
968 // Push the arguments. 1018 // Push the arguments.
969 Label loop_header, loop_check; 1019 Generate_InterpreterPushArgs(masm, a2, a3, at);
970 __ Branch(&loop_check);
971 __ bind(&loop_header);
972 __ lw(t0, MemOperand(a2));
973 __ Addu(a2, a2, Operand(-kPointerSize));
974 __ push(t0);
975 __ bind(&loop_check);
976 __ Branch(&loop_header, gt, a2, Operand(a3));
977 1020
978 // Call the target. 1021 // Call the target.
979 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 1022 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
980 tail_call_mode), 1023 tail_call_mode),
981 RelocInfo::CODE_TARGET); 1024 RelocInfo::CODE_TARGET);
982 } 1025 }
983 1026
984
985 // static 1027 // static
986 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { 1028 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
987 // ----------- S t a t e ------------- 1029 // ----------- S t a t e -------------
988 // -- a0 : argument count (not including receiver) 1030 // -- a0 : argument count (not including receiver)
989 // -- a3 : new target 1031 // -- a3 : new target
990 // -- a1 : constructor to call 1032 // -- a1 : constructor to call
991 // -- a2 : address of the first argument 1033 // -- a2 : address of the first argument
992 // ----------------------------------- 1034 // -----------------------------------
993 1035
994 // Find the address of the last argument. 1036 // Find the address of the last argument.
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 Comment cmnt(masm, "[ PrepareForTailCall"); 1991 Comment cmnt(masm, "[ PrepareForTailCall");
1950 1992
1951 // Prepare for tail call only if the debugger is not active. 1993 // Prepare for tail call only if the debugger is not active.
1952 Label done; 1994 Label done;
1953 ExternalReference debug_is_active = 1995 ExternalReference debug_is_active =
1954 ExternalReference::debug_is_active_address(masm->isolate()); 1996 ExternalReference::debug_is_active_address(masm->isolate());
1955 __ li(at, Operand(debug_is_active)); 1997 __ li(at, Operand(debug_is_active));
1956 __ lb(scratch1, MemOperand(at)); 1998 __ lb(scratch1, MemOperand(at));
1957 __ Branch(&done, ne, scratch1, Operand(zero_reg)); 1999 __ Branch(&done, ne, scratch1, Operand(zero_reg));
1958 2000
2001 // Drop possible internal frame pushed for calling CallICStub.
2002 // TODO(mythria): when we tail call the CallICStub, remove this.
2003 {
2004 Label no_internal_callic_frame;
2005 __ lw(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
2006 __ Branch(&no_internal_callic_frame, ne, scratch3,
2007 Operand(Smi::FromInt(StackFrame::INTERNAL)));
2008 __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2009 __ bind(&no_internal_callic_frame);
2010 }
2011
1959 // Drop possible interpreter handler/stub frame. 2012 // Drop possible interpreter handler/stub frame.
1960 { 2013 {
1961 Label no_interpreter_frame; 2014 Label no_interpreter_frame;
1962 __ lw(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); 2015 __ lw(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
1963 __ Branch(&no_interpreter_frame, ne, scratch3, 2016 __ Branch(&no_interpreter_frame, ne, scratch3,
1964 Operand(Smi::FromInt(StackFrame::STUB))); 2017 Operand(Smi::FromInt(StackFrame::STUB)));
1965 __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2018 __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1966 __ bind(&no_interpreter_frame); 2019 __ bind(&no_interpreter_frame);
1967 } 2020 }
1968 2021
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 } 2693 }
2641 } 2694 }
2642 2695
2643 2696
2644 #undef __ 2697 #undef __
2645 2698
2646 } // namespace internal 2699 } // namespace internal
2647 } // namespace v8 2700 } // namespace v8
2648 2701
2649 #endif // V8_TARGET_ARCH_MIPS 2702 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698