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

Side by Side Diff: src/mips64/builtins-mips64.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/mips/interface-descriptors-mips.cc ('k') | src/mips64/code-stubs-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/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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 // Leave the frame (also dropping the register file). 1057 // Leave the frame (also dropping the register file).
1058 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 1058 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1059 1059
1060 // Drop receiver + arguments and return. 1060 // Drop receiver + arguments and return.
1061 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, 1061 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister,
1062 BytecodeArray::kParameterSizeOffset)); 1062 BytecodeArray::kParameterSizeOffset));
1063 __ Daddu(sp, sp, at); 1063 __ Daddu(sp, sp, at);
1064 __ Jump(ra); 1064 __ Jump(ra);
1065 } 1065 }
1066 1066
1067 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index,
1068 Register limit, Register scratch) {
1069 Label loop_header, loop_check;
1070 __ Branch(&loop_check);
1071 __ bind(&loop_header);
1072 __ ld(scratch, MemOperand(index));
1073 __ Daddu(index, index, Operand(-kPointerSize));
1074 __ push(scratch);
1075 __ bind(&loop_check);
1076 __ Branch(&loop_header, gt, index, Operand(limit));
1077 }
1078
1079 static void Generate_InterpreterComputeLastArgumentAddress(
1080 MacroAssembler* masm, Register num_args, Register start_address,
1081 Register output_reg) {
1082 __ Daddu(output_reg, num_args, Operand(1)); // Add one for receiver.
1083 __ dsll(output_reg, output_reg, kPointerSizeLog2);
1084 __ Dsubu(output_reg, start_address, output_reg);
1085 }
1086
1087 // static
1088 void Builtins::Generate_InterpreterPushArgsAndCallICImpl(
1089 MacroAssembler* masm, TailCallMode tail_call_mode) {
1090 // ----------- S t a t e -------------
1091 // -- a0 : the number of arguments (not including the receiver)
1092 // -- a4 : the address of the first argument to be pushed. Subsequent
1093 // arguments should be consecutive above this, in the same order as
1094 // they are to be pushed onto the stack.
1095 // -- a1 : the target to call (can be any Object).
1096 // -- a3 : feedback vector slot id
1097 // -- a2 : type feedback vector
1098 // -----------------------------------
1099
1100 {
1101 FrameScope scope(masm, StackFrame::INTERNAL);
1102
1103 // Computes the address of last argument in a5.
1104 Generate_InterpreterComputeLastArgumentAddress(masm, a0, a4, a5);
1105
1106 // Push the arguments.
1107 Generate_InterpreterPushArgs(masm, a4, a5, at);
1108
1109 // Call via the CallIC stub.
1110 CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode,
1111 true);
1112 CallICStub stub(masm->isolate(), call_ic_state);
1113 // TODO(mythria): This should be replaced by a TailCallStub, when we
1114 // update the code to find the target IC from jump instructions.
1115 __ CallStub(&stub);
1116 }
1117 __ Ret();
1118 }
1067 1119
1068 // static 1120 // static
1069 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 1121 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
1070 MacroAssembler* masm, TailCallMode tail_call_mode) { 1122 MacroAssembler* masm, TailCallMode tail_call_mode) {
1071 // ----------- S t a t e ------------- 1123 // ----------- S t a t e -------------
1072 // -- a0 : the number of arguments (not including the receiver) 1124 // -- a0 : the number of arguments (not including the receiver)
1073 // -- a2 : the address of the first argument to be pushed. Subsequent 1125 // -- a2 : the address of the first argument to be pushed. Subsequent
1074 // arguments should be consecutive above this, in the same order as 1126 // arguments should be consecutive above this, in the same order as
1075 // they are to be pushed onto the stack. 1127 // they are to be pushed onto the stack.
1076 // -- a1 : the target to call (can be any Object). 1128 // -- a1 : the target to call (can be any Object).
1077 // ----------------------------------- 1129 // -----------------------------------
1078 1130
1079 // Find the address of the last argument. 1131 // Computes the address of last argument in a3.
1080 __ Daddu(a3, a0, Operand(1)); // Add one for receiver. 1132 Generate_InterpreterComputeLastArgumentAddress(masm, a0, a2, a3);
1081 __ dsll(a3, a3, kPointerSizeLog2);
1082 __ Dsubu(a3, a2, Operand(a3));
1083 1133
1084 // Push the arguments. 1134 // Push the arguments.
1085 Label loop_header, loop_check; 1135 Generate_InterpreterPushArgs(masm, a2, a3, at);
1086 __ Branch(&loop_check);
1087 __ bind(&loop_header);
1088 __ ld(t0, MemOperand(a2));
1089 __ Daddu(a2, a2, Operand(-kPointerSize));
1090 __ push(t0);
1091 __ bind(&loop_check);
1092 __ Branch(&loop_header, gt, a2, Operand(a3));
1093 1136
1094 // Call the target. 1137 // Call the target.
1095 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 1138 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
1096 tail_call_mode), 1139 tail_call_mode),
1097 RelocInfo::CODE_TARGET); 1140 RelocInfo::CODE_TARGET);
1098 } 1141 }
1099 1142
1100 1143
1101 // static 1144 // static
1102 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { 1145 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 Comment cmnt(masm, "[ PrepareForTailCall"); 2111 Comment cmnt(masm, "[ PrepareForTailCall");
2069 2112
2070 // Prepare for tail call only if the debugger is not active. 2113 // Prepare for tail call only if the debugger is not active.
2071 Label done; 2114 Label done;
2072 ExternalReference debug_is_active = 2115 ExternalReference debug_is_active =
2073 ExternalReference::debug_is_active_address(masm->isolate()); 2116 ExternalReference::debug_is_active_address(masm->isolate());
2074 __ li(at, Operand(debug_is_active)); 2117 __ li(at, Operand(debug_is_active));
2075 __ lb(scratch1, MemOperand(at)); 2118 __ lb(scratch1, MemOperand(at));
2076 __ Branch(&done, ne, scratch1, Operand(zero_reg)); 2119 __ Branch(&done, ne, scratch1, Operand(zero_reg));
2077 2120
2121 // Drop possible internal frame pushed for calling CallICStub.
2122 // TODO(mythria): when we tail call the CallICStub, remove this.
2123 {
2124 Label no_internal_callic_frame;
2125 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
2126 __ Branch(&no_internal_callic_frame, ne, scratch3,
2127 Operand(Smi::FromInt(StackFrame::INTERNAL)));
2128 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2129 __ bind(&no_internal_callic_frame);
2130 }
2131
2078 // Drop possible interpreter handler/stub frame. 2132 // Drop possible interpreter handler/stub frame.
2079 { 2133 {
2080 Label no_interpreter_frame; 2134 Label no_interpreter_frame;
2081 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); 2135 __ ld(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset));
2082 __ Branch(&no_interpreter_frame, ne, scratch3, 2136 __ Branch(&no_interpreter_frame, ne, scratch3,
2083 Operand(Smi::FromInt(StackFrame::STUB))); 2137 Operand(Smi::FromInt(StackFrame::STUB)));
2084 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2138 __ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2085 __ bind(&no_interpreter_frame); 2139 __ bind(&no_interpreter_frame);
2086 } 2140 }
2087 2141
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 } 2812 }
2759 } 2813 }
2760 2814
2761 2815
2762 #undef __ 2816 #undef __
2763 2817
2764 } // namespace internal 2818 } // namespace internal
2765 } // namespace v8 2819 } // namespace v8
2766 2820
2767 #endif // V8_TARGET_ARCH_MIPS64 2821 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698