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

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

Issue 2307903002: [Interpreter] Collect allocation site feedback in call bytecode handler. (Closed)
Patch Set: corrected few comments. 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
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 scratch) {
1158 Register last_addr = num_args;
1159 // Find the address of the last argument.
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, a3 and a4.
1173 Label loop_header, loop_check; 1189 Generate_InterpreterPushArgs(masm, a3, a2, a4);
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 // Generate_InterpreterPushArgs modified num_args, so move it to a different
1214 Label loop_header, loop_check; 1219 // register.
1215 __ Branch(&loop_check); 1220 __ mov(t0, a0);
1216 __ bind(&loop_header); 1221
1217 __ ld(t1, MemOperand(a4)); 1222 // This function modifies t0, a4 and a5.
1218 __ Daddu(a4, a4, Operand(-kPointerSize)); 1223 Generate_InterpreterPushArgs(masm, t0, a4, a5);
1219 __ push(t1);
1220 __ bind(&loop_check);
1221 __ Branch(&loop_header, gt, a4, Operand(t0));
1222 1224
1223 __ AssertUndefinedOrAllocationSite(a2, t0); 1225 __ AssertUndefinedOrAllocationSite(a2, t0);
1224 if (construct_type == CallableType::kJSFunction) { 1226 if (construct_type == CallableType::kJSFunction) {
1225 __ AssertFunction(a1); 1227 __ AssertFunction(a1);
1226 1228
1227 // Tail call to the function-specific construct stub (still in the caller 1229 // Tail call to the function-specific construct stub (still in the caller
1228 // context at this point). 1230 // context at this point).
1229 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1231 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1230 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); 1232 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset));
1231 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); 1233 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag));
1232 __ Jump(at); 1234 __ Jump(at);
1233 } else { 1235 } else {
1234 DCHECK_EQ(construct_type, CallableType::kAny); 1236 DCHECK_EQ(construct_type, CallableType::kAny);
1235 // Call the constructor with a0, a1, and a3 unmodified. 1237 // Call the constructor with a0, a1, and a3 unmodified.
1236 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 1238 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
1237 } 1239 }
1238 } 1240 }
1239 1241
1242 // static
1243 void Builtins::Generate_InterpreterPushArgsAndConstructArray(
1244 MacroAssembler* masm) {
1245 // ----------- S t a t e -------------
1246 // -- a0 : the number of arguments (not including the receiver)
1247 // -- a1 : the target to call checked to be Array function.
1248 // -- a2 : allocation site feedback.
1249 // -- a3 : the address of the first argument to be pushed. Subsequent
1250 // arguments should be consecutive above this, in the same order as
1251 // they are to be pushed onto the stack.
1252 // -----------------------------------
1253
1254 __ Daddu(a4, a0, Operand(1)); // Add one for receiver.
1255
1256 // This function modifies a3, a4 and t0.
1257 Generate_InterpreterPushArgs(masm, a4, a3, t0);
1258
1259 // ArrayConstructor stub expects constructor in a3. Set it here.
1260 __ mov(a3, a1);
1261
1262 ArrayConstructorStub stub(masm->isolate());
1263 __ TailCallStub(&stub);
1264 }
1265
1240 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { 1266 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
1241 // Set the return address to the correct point in the interpreter entry 1267 // Set the return address to the correct point in the interpreter entry
1242 // trampoline. 1268 // trampoline.
1243 Smi* interpreter_entry_return_pc_offset( 1269 Smi* interpreter_entry_return_pc_offset(
1244 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); 1270 masm->isolate()->heap()->interpreter_entry_return_pc_offset());
1245 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); 1271 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0));
1246 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); 1272 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline()));
1247 __ Daddu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + 1273 __ Daddu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() +
1248 Code::kHeaderSize - kHeapObjectTag)); 1274 Code::kHeaderSize - kHeapObjectTag));
1249 1275
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 __ break_(0xCC); 3051 __ break_(0xCC);
3026 } 3052 }
3027 } 3053 }
3028 3054
3029 #undef __ 3055 #undef __
3030 3056
3031 } // namespace internal 3057 } // namespace internal
3032 } // namespace v8 3058 } // namespace v8
3033 3059
3034 #endif // V8_TARGET_ARCH_MIPS64 3060 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698