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

Side by Side Diff: src/builtins/mips/builtins-mips.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/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 __ bind(&bytecode_array_loaded); 1011 __ bind(&bytecode_array_loaded);
1012 1012
1013 // Check whether we should continue to use the interpreter. 1013 // Check whether we should continue to use the interpreter.
1014 Label switch_to_different_code_kind; 1014 Label switch_to_different_code_kind;
1015 __ lw(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset)); 1015 __ lw(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset));
1016 __ Branch(&switch_to_different_code_kind, ne, a0, 1016 __ Branch(&switch_to_different_code_kind, ne, a0,
1017 Operand(masm->CodeObject())); // Self-reference to this code. 1017 Operand(masm->CodeObject())); // Self-reference to this code.
1018 1018
1019 // Increment invocation count for the function. 1019 // Increment invocation count for the function.
1020 __ lw(a0, FieldMemOperand(a1, JSFunction::kFeedbackVectorOffset)); 1020 __ lw(a0, FieldMemOperand(a1, JSFunction::kFeedbackVectorOffset));
1021 __ lw(a0, FieldMemOperand(a0, Cell::kValueOffset));
1021 __ lw(t0, FieldMemOperand( 1022 __ lw(t0, FieldMemOperand(
1022 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + 1023 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize +
1023 TypeFeedbackVector::kHeaderSize)); 1024 TypeFeedbackVector::kHeaderSize));
1024 __ Addu(t0, t0, Operand(Smi::FromInt(1))); 1025 __ Addu(t0, t0, Operand(Smi::FromInt(1)));
1025 __ sw(t0, FieldMemOperand( 1026 __ sw(t0, FieldMemOperand(
1026 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + 1027 a0, TypeFeedbackVector::kInvocationCountIndex * kPointerSize +
1027 TypeFeedbackVector::kHeaderSize)); 1028 TypeFeedbackVector::kHeaderSize));
1028 1029
1029 // Check function data field is actually a BytecodeArray object. 1030 // Check function data field is actually a BytecodeArray object.
1030 if (FLAG_debug_code) { 1031 if (FLAG_debug_code) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 // -- a1 : target function (preserved for callee) 1346 // -- a1 : target function (preserved for callee)
1346 // ----------------------------------- 1347 // -----------------------------------
1347 // First lookup code, maybe we don't need to compile! 1348 // First lookup code, maybe we don't need to compile!
1348 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1349 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1349 Label try_shared; 1350 Label try_shared;
1350 Label loop_top, loop_bottom; 1351 Label loop_top, loop_bottom;
1351 1352
1352 Register argument_count = a0; 1353 Register argument_count = a0;
1353 Register closure = a1; 1354 Register closure = a1;
1354 Register new_target = a3; 1355 Register new_target = a3;
1356 Register map = a0;
1357 Register index = a2;
1358
1359 // Do we have a valid feedback vector?
1360 __ lw(index, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset));
1361 __ lw(index, FieldMemOperand(index, Cell::kValueOffset));
1362 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex,
1363 &gotta_call_runtime_no_stack);
1364
1355 __ push(argument_count); 1365 __ push(argument_count);
1356 __ push(new_target); 1366 __ push(new_target);
1357 __ push(closure); 1367 __ push(closure);
1358 1368
1359 Register map = a0;
1360 Register index = a2;
1361 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1369 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1362 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1370 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1363 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1371 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1364 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); 1372 __ Branch(&try_shared, lt, index, Operand(Smi::FromInt(2)));
1365 1373
1366 // Find literals.
1367 // a3 : native context 1374 // a3 : native context
1368 // a2 : length / index 1375 // a2 : length / index
1369 // a0 : optimized code map 1376 // a0 : optimized code map
1370 // stack[0] : new target 1377 // stack[0] : new target
1371 // stack[4] : closure 1378 // stack[4] : closure
1372 Register native_context = a3; 1379 Register native_context = a3;
1373 __ lw(native_context, NativeContextMemOperand()); 1380 __ lw(native_context, NativeContextMemOperand());
1374 1381
1375 __ bind(&loop_top); 1382 __ bind(&loop_top);
1376 Register temp = a1; 1383 Register temp = a1;
1377 Register array_pointer = t1; 1384 Register array_pointer = t1;
1378 1385
1379 // Does the native context match? 1386 // Does the native context match?
1380 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize); 1387 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize);
1381 __ Addu(array_pointer, map, Operand(at)); 1388 __ Addu(array_pointer, map, Operand(at));
1382 __ lw(temp, FieldMemOperand(array_pointer, 1389 __ lw(temp, FieldMemOperand(array_pointer,
1383 SharedFunctionInfo::kOffsetToPreviousContext)); 1390 SharedFunctionInfo::kOffsetToPreviousContext));
1384 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1391 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1385 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); 1392 __ Branch(&loop_bottom, ne, temp, Operand(native_context));
1386 // Feedback vector available?
1387 __ lw(temp, FieldMemOperand(array_pointer,
1388 SharedFunctionInfo::kOffsetToPreviousLiterals));
1389 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1390 __ JumpIfSmi(temp, &gotta_call_runtime);
1391
1392 // Save the feedback vector in the closure.
1393 __ lw(t0, MemOperand(sp, 0));
1394 __ sw(temp, FieldMemOperand(t0, JSFunction::kFeedbackVectorOffset));
1395 __ push(index);
1396 __ RecordWriteField(t0, JSFunction::kFeedbackVectorOffset, temp, index,
1397 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1398 OMIT_SMI_CHECK);
1399 __ pop(index);
1400 1393
1401 // Code available? 1394 // Code available?
1402 Register entry = t0; 1395 Register entry = t0;
1403 __ lw(entry, 1396 __ lw(entry,
1404 FieldMemOperand(array_pointer, 1397 FieldMemOperand(array_pointer,
1405 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1398 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1406 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1399 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1407 __ JumpIfSmi(entry, &try_shared); 1400 __ JumpIfSmi(entry, &try_shared);
1408 1401
1409 // Found literals and code. Get them into the closure and return. 1402 // Found code. Get it into the closure and return.
1410 __ pop(closure); 1403 __ pop(closure);
1411 // Store code entry in the closure. 1404 // Store code entry in the closure.
1412 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1405 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1413 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1406 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1414 __ RecordWriteCodeEntryField(closure, entry, t1); 1407 __ RecordWriteCodeEntryField(closure, entry, t1);
1415 1408
1416 // Link the closure into the optimized function list. 1409 // Link the closure into the optimized function list.
1417 // t0 : code entry 1410 // t0 : code entry
1418 // a3 : native context 1411 // a3 : native context
1419 // a1 : closure 1412 // a1 : closure
(...skipping 14 matching lines...) Expand all
1434 __ mov(closure, t1); 1427 __ mov(closure, t1);
1435 __ pop(new_target); 1428 __ pop(new_target);
1436 __ pop(argument_count); 1429 __ pop(argument_count);
1437 __ Jump(entry); 1430 __ Jump(entry);
1438 1431
1439 __ bind(&loop_bottom); 1432 __ bind(&loop_bottom);
1440 __ Subu(index, index, 1433 __ Subu(index, index,
1441 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1434 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1442 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); 1435 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1)));
1443 1436
1444 // We found neither literals nor code. 1437 // We found no code.
1445 __ jmp(&gotta_call_runtime);
1446
1447 __ bind(&try_shared); 1438 __ bind(&try_shared);
1448 __ pop(closure); 1439 __ pop(closure);
1449 __ pop(new_target); 1440 __ pop(new_target);
1450 __ pop(argument_count); 1441 __ pop(argument_count);
1451 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1442 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1452 // Is the shared function marked for tier up? 1443 // Is the shared function marked for tier up?
1453 __ lbu(t1, FieldMemOperand(entry, 1444 __ lbu(t1, FieldMemOperand(entry,
1454 SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1445 SharedFunctionInfo::kMarkedForTierUpByteOffset));
1455 __ And(t1, t1, 1446 __ And(t1, t1,
1456 Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); 1447 Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte));
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 __ break_(0xCC); 3185 __ break_(0xCC);
3195 } 3186 }
3196 } 3187 }
3197 3188
3198 #undef __ 3189 #undef __
3199 3190
3200 } // namespace internal 3191 } // namespace internal
3201 } // namespace v8 3192 } // namespace v8
3202 3193
3203 #endif // V8_TARGET_ARCH_MIPS 3194 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698