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

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

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE+liveedit fix. Created 3 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/builtins/mips/builtins-mips.cc ('k') | src/builtins/ppc/builtins-ppc.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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 __ bind(&bytecode_array_loaded); 1002 __ bind(&bytecode_array_loaded);
1003 1003
1004 // Check whether we should continue to use the interpreter. 1004 // Check whether we should continue to use the interpreter.
1005 Label switch_to_different_code_kind; 1005 Label switch_to_different_code_kind;
1006 __ ld(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset)); 1006 __ ld(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset));
1007 __ Branch(&switch_to_different_code_kind, ne, a0, 1007 __ Branch(&switch_to_different_code_kind, ne, a0,
1008 Operand(masm->CodeObject())); // Self-reference to this code. 1008 Operand(masm->CodeObject())); // Self-reference to this code.
1009 1009
1010 // Increment invocation count for the function. 1010 // Increment invocation count for the function.
1011 __ ld(a0, FieldMemOperand(a1, JSFunction::kFeedbackVectorOffset)); 1011 __ ld(a0, FieldMemOperand(a1, JSFunction::kFeedbackVectorOffset));
1012 __ ld(a0, FieldMemOperand(a0, Cell::kValueOffset));
1012 __ ld(a4, FieldMemOperand( 1013 __ ld(a4, FieldMemOperand(
1013 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + 1014 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize +
1014 TypeFeedbackVector::kHeaderSize)); 1015 TypeFeedbackVector::kHeaderSize));
1015 __ Daddu(a4, a4, Operand(Smi::FromInt(1))); 1016 __ Daddu(a4, a4, Operand(Smi::FromInt(1)));
1016 __ sd(a4, FieldMemOperand( 1017 __ sd(a4, FieldMemOperand(
1017 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + 1018 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize +
1018 TypeFeedbackVector::kHeaderSize)); 1019 TypeFeedbackVector::kHeaderSize));
1019 1020
1020 // Check function data field is actually a BytecodeArray object. 1021 // Check function data field is actually a BytecodeArray object.
1021 if (FLAG_debug_code) { 1022 if (FLAG_debug_code) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 // -- a1 : target function (preserved for callee) 1337 // -- a1 : target function (preserved for callee)
1337 // ----------------------------------- 1338 // -----------------------------------
1338 // First lookup code, maybe we don't need to compile! 1339 // First lookup code, maybe we don't need to compile!
1339 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1340 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1340 Label try_shared; 1341 Label try_shared;
1341 Label loop_top, loop_bottom; 1342 Label loop_top, loop_bottom;
1342 1343
1343 Register argument_count = a0; 1344 Register argument_count = a0;
1344 Register closure = a1; 1345 Register closure = a1;
1345 Register new_target = a3; 1346 Register new_target = a3;
1347 Register map = a0;
1348 Register index = a2;
1349
1350 // Do we have a valid feedback vector?
1351 __ ld(index, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset));
1352 __ ld(index, FieldMemOperand(index, Cell::kValueOffset));
1353 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex,
1354 &gotta_call_runtime_no_stack);
1355
1346 __ push(argument_count); 1356 __ push(argument_count);
1347 __ push(new_target); 1357 __ push(new_target);
1348 __ push(closure); 1358 __ push(closure);
1349 1359
1350 Register map = a0;
1351 Register index = a2;
1352 __ ld(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1360 __ ld(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1353 __ ld(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1361 __ ld(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1354 __ ld(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1362 __ ld(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1355 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); 1363 __ Branch(&try_shared, lt, index, Operand(Smi::FromInt(2)));
1356 1364
1357 // Find literals.
1358 // a3 : native context 1365 // a3 : native context
1359 // a2 : length / index 1366 // a2 : length / index
1360 // a0 : optimized code map 1367 // a0 : optimized code map
1361 // stack[0] : new target 1368 // stack[0] : new target
1362 // stack[4] : closure 1369 // stack[4] : closure
1363 Register native_context = a3; 1370 Register native_context = a3;
1364 __ ld(native_context, NativeContextMemOperand()); 1371 __ ld(native_context, NativeContextMemOperand());
1365 1372
1366 __ bind(&loop_top); 1373 __ bind(&loop_top);
1367 Register temp = a1; 1374 Register temp = a1;
1368 Register array_pointer = a5; 1375 Register array_pointer = a5;
1369 1376
1370 // Does the native context match? 1377 // Does the native context match?
1371 __ SmiScale(at, index, kPointerSizeLog2); 1378 __ SmiScale(at, index, kPointerSizeLog2);
1372 __ Daddu(array_pointer, map, Operand(at)); 1379 __ Daddu(array_pointer, map, Operand(at));
1373 __ ld(temp, FieldMemOperand(array_pointer, 1380 __ ld(temp, FieldMemOperand(array_pointer,
1374 SharedFunctionInfo::kOffsetToPreviousContext)); 1381 SharedFunctionInfo::kOffsetToPreviousContext));
1375 __ ld(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1382 __ ld(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1376 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); 1383 __ Branch(&loop_bottom, ne, temp, Operand(native_context));
1377 // Feedback vector available?
1378 __ ld(temp, FieldMemOperand(array_pointer,
1379 SharedFunctionInfo::kOffsetToPreviousLiterals));
1380 __ ld(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1381 __ JumpIfSmi(temp, &gotta_call_runtime);
1382
1383 // Save the feedback vector in the closure.
1384 __ ld(a4, MemOperand(sp, 0));
1385 __ sd(temp, FieldMemOperand(a4, JSFunction::kFeedbackVectorOffset));
1386 __ push(index);
1387 __ RecordWriteField(a4, JSFunction::kFeedbackVectorOffset, temp, index,
1388 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1389 OMIT_SMI_CHECK);
1390 __ pop(index);
1391 1384
1392 // Code available? 1385 // Code available?
1393 Register entry = a4; 1386 Register entry = a4;
1394 __ ld(entry, 1387 __ ld(entry,
1395 FieldMemOperand(array_pointer, 1388 FieldMemOperand(array_pointer,
1396 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1389 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1397 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1390 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1398 __ JumpIfSmi(entry, &try_shared); 1391 __ JumpIfSmi(entry, &try_shared);
1399 1392
1400 // Found literals and code. Get them into the closure and return. 1393 // Found code. Get it into the closure and return.
1401 __ pop(closure); 1394 __ pop(closure);
1402 // Store code entry in the closure. 1395 // Store code entry in the closure.
1403 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1396 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1404 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1397 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1405 __ RecordWriteCodeEntryField(closure, entry, a5); 1398 __ RecordWriteCodeEntryField(closure, entry, a5);
1406 1399
1407 // Link the closure into the optimized function list. 1400 // Link the closure into the optimized function list.
1408 // a4 : code entry 1401 // a4 : code entry
1409 // a3 : native context 1402 // a3 : native context
1410 // a1 : closure 1403 // a1 : closure
(...skipping 14 matching lines...) Expand all
1425 __ mov(closure, a5); 1418 __ mov(closure, a5);
1426 __ pop(new_target); 1419 __ pop(new_target);
1427 __ pop(argument_count); 1420 __ pop(argument_count);
1428 __ Jump(entry); 1421 __ Jump(entry);
1429 1422
1430 __ bind(&loop_bottom); 1423 __ bind(&loop_bottom);
1431 __ Dsubu(index, index, 1424 __ Dsubu(index, index,
1432 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1425 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1433 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); 1426 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1)));
1434 1427
1435 // We found neither literals nor code. 1428 // We found no code.
1436 __ jmp(&gotta_call_runtime);
1437
1438 __ bind(&try_shared); 1429 __ bind(&try_shared);
1439 __ pop(closure); 1430 __ pop(closure);
1440 __ pop(new_target); 1431 __ pop(new_target);
1441 __ pop(argument_count); 1432 __ pop(argument_count);
1442 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1433 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1443 // Is the shared function marked for tier up? 1434 // Is the shared function marked for tier up?
1444 __ lbu(a5, FieldMemOperand(entry, 1435 __ lbu(a5, FieldMemOperand(entry,
1445 SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1436 SharedFunctionInfo::kMarkedForTierUpByteOffset));
1446 __ And(a5, a5, 1437 __ And(a5, a5,
1447 Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); 1438 Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte));
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
3218 __ break_(0xCC); 3209 __ break_(0xCC);
3219 } 3210 }
3220 } 3211 }
3221 3212
3222 #undef __ 3213 #undef __
3223 3214
3224 } // namespace internal 3215 } // namespace internal
3225 } // namespace v8 3216 } // namespace v8
3226 3217
3227 #endif // V8_TARGET_ARCH_MIPS64 3218 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/builtins/mips/builtins-mips.cc ('k') | src/builtins/ppc/builtins-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698