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

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

Issue 2319913004: PPC/s390: [Interpreter] Collect allocation site feedback in call bytecode handler. (Closed)
Patch Set: 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 | « no previous file | src/builtins/s390/builtins-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 // Push function as argument and compile for baseline. 1180 // Push function as argument and compile for baseline.
1181 __ push(r4); 1181 __ push(r4);
1182 __ CallRuntime(Runtime::kCompileBaseline); 1182 __ CallRuntime(Runtime::kCompileBaseline);
1183 1183
1184 // Restore return value. 1184 // Restore return value.
1185 __ pop(r3); 1185 __ pop(r3);
1186 } 1186 }
1187 __ blr(); 1187 __ blr();
1188 } 1188 }
1189 1189
1190 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, 1190 static void Generate_InterpreterPushArgs(MacroAssembler* masm,
1191 Register num_args, Register index,
1191 Register count, Register scratch) { 1192 Register count, Register scratch) {
1193 // TODO(mythria): Add a stack check before pushing arguments.
1192 Label loop; 1194 Label loop;
1193 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU 1195 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU
1194 __ mtctr(count); 1196 __ mtctr(count);
1195 __ bind(&loop); 1197 __ bind(&loop);
1196 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); 1198 __ LoadPU(scratch, MemOperand(index, -kPointerSize));
1197 __ push(scratch); 1199 __ push(scratch);
1198 __ bdnz(&loop); 1200 __ bdnz(&loop);
1199 } 1201 }
1200 1202
1201 // static 1203 // static
1202 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 1204 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
1203 MacroAssembler* masm, TailCallMode tail_call_mode, 1205 MacroAssembler* masm, TailCallMode tail_call_mode,
1204 CallableType function_type) { 1206 CallableType function_type) {
1205 // ----------- S t a t e ------------- 1207 // ----------- S t a t e -------------
1206 // -- r3 : the number of arguments (not including the receiver) 1208 // -- r3 : the number of arguments (not including the receiver)
1207 // -- r5 : the address of the first argument to be pushed. Subsequent 1209 // -- r5 : the address of the first argument to be pushed. Subsequent
1208 // arguments should be consecutive above this, in the same order as 1210 // arguments should be consecutive above this, in the same order as
1209 // they are to be pushed onto the stack. 1211 // they are to be pushed onto the stack.
1210 // -- r4 : the target to call (can be any Object). 1212 // -- r4 : the target to call (can be any Object).
1211 // ----------------------------------- 1213 // -----------------------------------
1212 1214
1213 // Calculate number of arguments (add one for receiver). 1215 // Calculate number of arguments (add one for receiver).
1214 __ addi(r6, r3, Operand(1)); 1216 __ addi(r6, r3, Operand(1));
1215 1217
1216 // TODO(mythria): Add a stack check before pushing arguments. 1218 // TODO(mythria): Add a stack check before pushing arguments.
1217 // Push the arguments. 1219 // Push the arguments. r5, r6, r7 will be modified.
1218 Generate_InterpreterPushArgs(masm, r5, r6, r7); 1220 Generate_InterpreterPushArgs(masm, r6, r5, r6, r7);
1219 1221
1220 // Call the target. 1222 // Call the target.
1221 if (function_type == CallableType::kJSFunction) { 1223 if (function_type == CallableType::kJSFunction) {
1222 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, 1224 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny,
1223 tail_call_mode), 1225 tail_call_mode),
1224 RelocInfo::CODE_TARGET); 1226 RelocInfo::CODE_TARGET);
1225 } else { 1227 } else {
1226 DCHECK_EQ(function_type, CallableType::kAny); 1228 DCHECK_EQ(function_type, CallableType::kAny);
1227 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 1229 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
1228 tail_call_mode), 1230 tail_call_mode),
(...skipping 13 matching lines...) Expand all
1242 // ----------------------------------- 1244 // -----------------------------------
1243 1245
1244 // Push a slot for the receiver to be constructed. 1246 // Push a slot for the receiver to be constructed.
1245 __ li(r0, Operand::Zero()); 1247 __ li(r0, Operand::Zero());
1246 __ push(r0); 1248 __ push(r0);
1247 1249
1248 // Push the arguments (skip if none). 1250 // Push the arguments (skip if none).
1249 Label skip; 1251 Label skip;
1250 __ cmpi(r3, Operand::Zero()); 1252 __ cmpi(r3, Operand::Zero());
1251 __ beq(&skip); 1253 __ beq(&skip);
1252 Generate_InterpreterPushArgs(masm, r7, r3, r8); 1254 // Push the arguments. r8, r7, r9 will be modified.
1255 Generate_InterpreterPushArgs(masm, r3, r7, r3, r8);
1253 __ bind(&skip); 1256 __ bind(&skip);
1254 1257
1255 __ AssertUndefinedOrAllocationSite(r5, r8); 1258 __ AssertUndefinedOrAllocationSite(r5, r8);
1256 if (construct_type == CallableType::kJSFunction) { 1259 if (construct_type == CallableType::kJSFunction) {
1257 __ AssertFunction(r4); 1260 __ AssertFunction(r4);
1258 1261
1259 // Tail call to the function-specific construct stub (still in the caller 1262 // Tail call to the function-specific construct stub (still in the caller
1260 // context at this point). 1263 // context at this point).
1261 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 1264 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1262 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); 1265 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset));
1263 // Jump to the construct function. 1266 // Jump to the construct function.
1264 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); 1267 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag));
1265 __ Jump(ip); 1268 __ Jump(ip);
1266 1269
1267 } else { 1270 } else {
1268 DCHECK_EQ(construct_type, CallableType::kAny); 1271 DCHECK_EQ(construct_type, CallableType::kAny);
1269 // Call the constructor with r3, r4, and r6 unmodified. 1272 // Call the constructor with r3, r4, and r6 unmodified.
1270 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 1273 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
1271 } 1274 }
1272 } 1275 }
1273 1276
1277 // static
1278 void Builtins::Generate_InterpreterPushArgsAndConstructArray(
1279 MacroAssembler* masm) {
1280 // ----------- S t a t e -------------
1281 // -- r3 : argument count (not including receiver)
1282 // -- r4 : target to call verified to be Array function
1283 // -- r5 : allocation site feedback if available, undefined otherwise.
1284 // -- r6 : address of the first argument
1285 // -----------------------------------
1286
1287 __ addi(r7, r3, Operand(1)); // Add one for receiver.
1288
1289 // TODO(mythria): Add a stack check before pushing arguments.
1290 // Push the arguments. r6, r8, r3 will be modified.
1291 Generate_InterpreterPushArgs(masm, r7, r6, r7, r8);
1292
1293 // Array constructor expects constructor in r6. It is same as r4 here.
1294 __ mr(r6, r4);
1295
1296 ArrayConstructorStub stub(masm->isolate());
1297 __ TailCallStub(&stub);
1298 }
1299
1274 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { 1300 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
1275 // Set the return address to the correct point in the interpreter entry 1301 // Set the return address to the correct point in the interpreter entry
1276 // trampoline. 1302 // trampoline.
1277 Smi* interpreter_entry_return_pc_offset( 1303 Smi* interpreter_entry_return_pc_offset(
1278 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); 1304 masm->isolate()->heap()->interpreter_entry_return_pc_offset());
1279 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); 1305 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0));
1280 __ Move(r5, masm->isolate()->builtins()->InterpreterEntryTrampoline()); 1306 __ Move(r5, masm->isolate()->builtins()->InterpreterEntryTrampoline());
1281 __ addi(r0, r5, Operand(interpreter_entry_return_pc_offset->value() + 1307 __ addi(r0, r5, Operand(interpreter_entry_return_pc_offset->value() +
1282 Code::kHeaderSize - kHeapObjectTag)); 1308 Code::kHeaderSize - kHeapObjectTag));
1283 __ mtlr(r0); 1309 __ mtlr(r0);
(...skipping 1751 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 __ CallRuntime(Runtime::kThrowStackOverflow); 3061 __ CallRuntime(Runtime::kThrowStackOverflow);
3036 __ bkpt(0); 3062 __ bkpt(0);
3037 } 3063 }
3038 } 3064 }
3039 3065
3040 #undef __ 3066 #undef __
3041 } // namespace internal 3067 } // namespace internal
3042 } // namespace v8 3068 } // namespace v8
3043 3069
3044 #endif // V8_TARGET_ARCH_PPC 3070 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698