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

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

Issue 2307903002: [Interpreter] Collect allocation site feedback in call bytecode handler. (Closed)
Patch Set: Fixed a bug in mips implementation. Created 4 years, 3 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/builtins/mips/builtins-mips.cc ('k') | src/builtins/x64/builtins-x64.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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 // Push function as argument and compile for baseline. 1145 // Push function as argument and compile for baseline.
1146 __ push(a1); 1146 __ push(a1);
1147 __ CallRuntime(Runtime::kCompileBaseline); 1147 __ CallRuntime(Runtime::kCompileBaseline);
1148 1148
1149 // Restore return value. 1149 // Restore return value.
1150 __ pop(v0); 1150 __ pop(v0);
1151 } 1151 }
1152 __ Jump(ra); 1152 __ Jump(ra);
1153 } 1153 }
1154 1154
1155 static void Generate_InterpreterPushArgs(MacroAssembler* masm,
1156 Register num_args, Register index,
1157 Register last_addr, Register scratch) {
1158 // Find the address of the last argument.
1159 __ mov(last_addr, num_args);
1160 __ dsll(last_addr, last_addr, kPointerSizeLog2);
1161 __ Dsubu(last_addr, index, Operand(last_addr));
1162
1163 // Push the arguments.
1164 Label loop_header, loop_check;
1165 __ Branch(&loop_check);
1166 __ bind(&loop_header);
1167 __ ld(scratch, MemOperand(index));
1168 __ Daddu(index, index, Operand(-kPointerSize));
1169 __ push(scratch);
1170 __ bind(&loop_check);
1171 __ Branch(&loop_header, gt, index, Operand(last_addr));
1172 }
1173
1155 // static 1174 // static
1156 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 1175 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
1157 MacroAssembler* masm, TailCallMode tail_call_mode, 1176 MacroAssembler* masm, TailCallMode tail_call_mode,
1158 CallableType function_type) { 1177 CallableType function_type) {
1159 // ----------- S t a t e ------------- 1178 // ----------- S t a t e -------------
1160 // -- a0 : the number of arguments (not including the receiver) 1179 // -- a0 : the number of arguments (not including the receiver)
1161 // -- a2 : the address of the first argument to be pushed. Subsequent 1180 // -- a2 : the address of the first argument to be pushed. Subsequent
1162 // arguments should be consecutive above this, in the same order as 1181 // arguments should be consecutive above this, in the same order as
1163 // they are to be pushed onto the stack. 1182 // they are to be pushed onto the stack.
1164 // -- a1 : the target to call (can be any Object). 1183 // -- a1 : the target to call (can be any Object).
1165 // ----------------------------------- 1184 // -----------------------------------
1166 1185
1167 // Find the address of the last argument.
1168 __ Daddu(a3, a0, Operand(1)); // Add one for receiver. 1186 __ Daddu(a3, a0, Operand(1)); // Add one for receiver.
1169 __ dsll(a3, a3, kPointerSizeLog2);
1170 __ Dsubu(a3, a2, Operand(a3));
1171 1187
1172 // Push the arguments. 1188 // This function modifies a2, t0 and a4.
1173 Label loop_header, loop_check; 1189 Generate_InterpreterPushArgs(masm, a3, a2, a4, t0);
1174 __ Branch(&loop_check);
1175 __ bind(&loop_header);
1176 __ ld(t0, MemOperand(a2));
1177 __ Daddu(a2, a2, Operand(-kPointerSize));
1178 __ push(t0);
1179 __ bind(&loop_check);
1180 __ Branch(&loop_header, gt, a2, Operand(a3));
1181 1190
1182 // Call the target. 1191 // Call the target.
1183 if (function_type == CallableType::kJSFunction) { 1192 if (function_type == CallableType::kJSFunction) {
1184 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, 1193 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny,
1185 tail_call_mode), 1194 tail_call_mode),
1186 RelocInfo::CODE_TARGET); 1195 RelocInfo::CODE_TARGET);
1187 } else { 1196 } else {
1188 DCHECK_EQ(function_type, CallableType::kAny); 1197 DCHECK_EQ(function_type, CallableType::kAny);
1189 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 1198 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
1190 tail_call_mode), 1199 tail_call_mode),
1191 RelocInfo::CODE_TARGET); 1200 RelocInfo::CODE_TARGET);
1192 } 1201 }
1193 } 1202 }
1194 1203
1195 // static 1204 // static
1196 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( 1205 void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
1197 MacroAssembler* masm, CallableType construct_type) { 1206 MacroAssembler* masm, CallableType construct_type) {
1198 // ----------- S t a t e ------------- 1207 // ----------- S t a t e -------------
1199 // -- a0 : argument count (not including receiver) 1208 // -- a0 : argument count (not including receiver)
1200 // -- a3 : new target 1209 // -- a3 : new target
1201 // -- a1 : constructor to call 1210 // -- a1 : constructor to call
1202 // -- a2 : allocation site feedback if available, undefined otherwise. 1211 // -- a2 : allocation site feedback if available, undefined otherwise.
1203 // -- a4 : address of the first argument 1212 // -- a4 : address of the first argument
1204 // ----------------------------------- 1213 // -----------------------------------
1205 1214
1206 // Find the address of the last argument.
1207 __ dsll(t0, a0, kPointerSizeLog2);
1208 __ Dsubu(t0, a4, Operand(t0));
1209
1210 // Push a slot for the receiver. 1215 // Push a slot for the receiver.
1211 __ push(zero_reg); 1216 __ push(zero_reg);
1212 1217
1213 // Push the arguments. 1218 // This function modifies t0, a4 and a5.
1214 Label loop_header, loop_check; 1219 Generate_InterpreterPushArgs(masm, a0, a4, a5, t0);
1215 __ Branch(&loop_check);
1216 __ bind(&loop_header);
1217 __ ld(t1, MemOperand(a4));
1218 __ Daddu(a4, a4, Operand(-kPointerSize));
1219 __ push(t1);
1220 __ bind(&loop_check);
1221 __ Branch(&loop_header, gt, a4, Operand(t0));
1222 1220
1223 __ AssertUndefinedOrAllocationSite(a2, t0); 1221 __ AssertUndefinedOrAllocationSite(a2, t0);
1224 if (construct_type == CallableType::kJSFunction) { 1222 if (construct_type == CallableType::kJSFunction) {
1225 __ AssertFunction(a1); 1223 __ AssertFunction(a1);
1226 1224
1227 // Tail call to the function-specific construct stub (still in the caller 1225 // Tail call to the function-specific construct stub (still in the caller
1228 // context at this point). 1226 // context at this point).
1229 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1227 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1230 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); 1228 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset));
1231 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); 1229 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag));
1232 __ Jump(at); 1230 __ Jump(at);
1233 } else { 1231 } else {
1234 DCHECK_EQ(construct_type, CallableType::kAny); 1232 DCHECK_EQ(construct_type, CallableType::kAny);
1235 // Call the constructor with a0, a1, and a3 unmodified. 1233 // Call the constructor with a0, a1, and a3 unmodified.
1236 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 1234 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
1237 } 1235 }
1238 } 1236 }
1239 1237
1238 // static
1239 void Builtins::Generate_InterpreterPushArgsAndConstructArray(
1240 MacroAssembler* masm) {
1241 // ----------- S t a t e -------------
1242 // -- a0 : the number of arguments (not including the receiver)
1243 // -- a1 : the target to call checked to be Array function.
1244 // -- a2 : allocation site feedback.
1245 // -- a3 : the address of the first argument to be pushed. Subsequent
1246 // arguments should be consecutive above this, in the same order as
1247 // they are to be pushed onto the stack.
1248 // -----------------------------------
1249
1250 __ Daddu(a4, a0, Operand(1)); // Add one for receiver.
1251
1252 // This function modifies a3, a5 and a6.
1253 Generate_InterpreterPushArgs(masm, a4, a3, a5, a6);
1254
1255 // ArrayConstructor stub expects constructor in a3. Set it here.
1256 __ mov(a3, a1);
1257
1258 ArrayConstructorStub stub(masm->isolate());
1259 __ TailCallStub(&stub);
1260 }
1261
1240 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { 1262 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
1241 // Set the return address to the correct point in the interpreter entry 1263 // Set the return address to the correct point in the interpreter entry
1242 // trampoline. 1264 // trampoline.
1243 Smi* interpreter_entry_return_pc_offset( 1265 Smi* interpreter_entry_return_pc_offset(
1244 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); 1266 masm->isolate()->heap()->interpreter_entry_return_pc_offset());
1245 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); 1267 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0));
1246 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); 1268 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline()));
1247 __ Daddu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + 1269 __ Daddu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() +
1248 Code::kHeaderSize - kHeapObjectTag)); 1270 Code::kHeaderSize - kHeapObjectTag));
1249 1271
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 __ break_(0xCC); 3047 __ break_(0xCC);
3026 } 3048 }
3027 } 3049 }
3028 3050
3029 #undef __ 3051 #undef __
3030 3052
3031 } // namespace internal 3053 } // namespace internal
3032 } // namespace v8 3054 } // namespace v8
3033 3055
3034 #endif // V8_TARGET_ARCH_MIPS64 3056 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/builtins/mips/builtins-mips.cc ('k') | src/builtins/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698