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

Side by Side Diff: src/builtins/arm/builtins-arm.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/arm64/macro-assembler-arm64.cc ('k') | src/builtins/arm64/builtins-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex), ne); 1010 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex), ne);
1011 1011
1012 // Check whether we should continue to use the interpreter. 1012 // Check whether we should continue to use the interpreter.
1013 Label switch_to_different_code_kind; 1013 Label switch_to_different_code_kind;
1014 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kCodeOffset)); 1014 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kCodeOffset));
1015 __ cmp(r0, Operand(masm->CodeObject())); // Self-reference to this code. 1015 __ cmp(r0, Operand(masm->CodeObject())); // Self-reference to this code.
1016 __ b(ne, &switch_to_different_code_kind); 1016 __ b(ne, &switch_to_different_code_kind);
1017 1017
1018 // Increment invocation count for the function. 1018 // Increment invocation count for the function.
1019 __ ldr(r2, FieldMemOperand(r1, JSFunction::kFeedbackVectorOffset)); 1019 __ ldr(r2, FieldMemOperand(r1, JSFunction::kFeedbackVectorOffset));
1020 __ ldr(r2, FieldMemOperand(r2, Cell::kValueOffset));
1020 __ ldr(r9, FieldMemOperand( 1021 __ ldr(r9, FieldMemOperand(
1021 r2, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + 1022 r2, TypeFeedbackVector::kInvocationCountIndex * kPointerSize +
1022 TypeFeedbackVector::kHeaderSize)); 1023 TypeFeedbackVector::kHeaderSize));
1023 __ add(r9, r9, Operand(Smi::FromInt(1))); 1024 __ add(r9, r9, Operand(Smi::FromInt(1)));
1024 __ str(r9, FieldMemOperand( 1025 __ str(r9, FieldMemOperand(
1025 r2, TypeFeedbackVector::kInvocationCountIndex * kPointerSize + 1026 r2, TypeFeedbackVector::kInvocationCountIndex * kPointerSize +
1026 TypeFeedbackVector::kHeaderSize)); 1027 TypeFeedbackVector::kHeaderSize));
1027 1028
1028 // Check function data field is actually a BytecodeArray object. 1029 // Check function data field is actually a BytecodeArray object.
1029 if (FLAG_debug_code) { 1030 if (FLAG_debug_code) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 // -- r1 : target function (preserved for callee) 1334 // -- r1 : target function (preserved for callee)
1334 // ----------------------------------- 1335 // -----------------------------------
1335 // First lookup code, maybe we don't need to compile! 1336 // First lookup code, maybe we don't need to compile!
1336 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1337 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1337 Label try_shared; 1338 Label try_shared;
1338 Label loop_top, loop_bottom; 1339 Label loop_top, loop_bottom;
1339 1340
1340 Register argument_count = r0; 1341 Register argument_count = r0;
1341 Register closure = r1; 1342 Register closure = r1;
1342 Register new_target = r3; 1343 Register new_target = r3;
1344 Register map = argument_count;
1345 Register index = r2;
1346
1347 // Do we have a valid feedback vector?
1348 __ ldr(index, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset));
1349 __ ldr(index, FieldMemOperand(index, Cell::kValueOffset));
1350 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex,
1351 &gotta_call_runtime_no_stack);
1352
1343 __ push(argument_count); 1353 __ push(argument_count);
1344 __ push(new_target); 1354 __ push(new_target);
1345 __ push(closure); 1355 __ push(closure);
1346 1356
1347 Register map = argument_count;
1348 Register index = r2;
1349 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1357 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1350 __ ldr(map, 1358 __ ldr(map,
1351 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1359 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1352 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1360 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1353 __ cmp(index, Operand(Smi::FromInt(2))); 1361 __ cmp(index, Operand(Smi::FromInt(2)));
1354 __ b(lt, &gotta_call_runtime); 1362 __ b(lt, &try_shared);
1355 1363
1356 // Find literals.
1357 // r3 : native context 1364 // r3 : native context
1358 // r2 : length / index 1365 // r2 : length / index
1359 // r0 : optimized code map 1366 // r0 : optimized code map
1360 // stack[0] : new target 1367 // stack[0] : new target
1361 // stack[4] : closure 1368 // stack[4] : closure
1362 Register native_context = r3; 1369 Register native_context = r3;
1363 __ ldr(native_context, NativeContextMemOperand()); 1370 __ ldr(native_context, NativeContextMemOperand());
1364 1371
1365 __ bind(&loop_top); 1372 __ bind(&loop_top);
1366 Register temp = r1; 1373 Register temp = r1;
1367 Register array_pointer = r5; 1374 Register array_pointer = r5;
1368 1375
1369 // Does the native context match? 1376 // Does the native context match?
1370 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index)); 1377 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index));
1371 __ ldr(temp, FieldMemOperand(array_pointer, 1378 __ ldr(temp, FieldMemOperand(array_pointer,
1372 SharedFunctionInfo::kOffsetToPreviousContext)); 1379 SharedFunctionInfo::kOffsetToPreviousContext));
1373 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1380 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1374 __ cmp(temp, native_context); 1381 __ cmp(temp, native_context);
1375 __ b(ne, &loop_bottom); 1382 __ b(ne, &loop_bottom);
1376 // Feedback vector available?
1377 __ ldr(temp, FieldMemOperand(array_pointer,
1378 SharedFunctionInfo::kOffsetToPreviousLiterals));
1379 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1380 __ JumpIfSmi(temp, &gotta_call_runtime);
1381
1382 // Save the feedback vector in the closure.
1383 __ ldr(r4, MemOperand(sp, 0));
1384 __ str(temp, FieldMemOperand(r4, JSFunction::kFeedbackVectorOffset));
1385 __ push(index);
1386 __ RecordWriteField(r4, JSFunction::kFeedbackVectorOffset, temp, index,
1387 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1388 OMIT_SMI_CHECK);
1389 __ pop(index);
1390 1383
1391 // Code available? 1384 // Code available?
1392 Register entry = r4; 1385 Register entry = r4;
1393 __ ldr(entry, 1386 __ ldr(entry,
1394 FieldMemOperand(array_pointer, 1387 FieldMemOperand(array_pointer,
1395 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1388 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1396 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1389 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1397 __ JumpIfSmi(entry, &try_shared); 1390 __ JumpIfSmi(entry, &try_shared);
1398 1391
1399 // Found literals and code. Get them into the closure and return. 1392 // Found code. Get it into the closure and return.
1400 __ pop(closure); 1393 __ pop(closure);
1401 // Store code entry in the closure. 1394 // Store code entry in the closure.
1402 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1395 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1403 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1396 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1404 __ RecordWriteCodeEntryField(closure, entry, r5); 1397 __ RecordWriteCodeEntryField(closure, entry, r5);
1405 1398
1406 // Link the closure into the optimized function list. 1399 // Link the closure into the optimized function list.
1407 // r4 : code entry 1400 // r4 : code entry
1408 // r3 : native context 1401 // r3 : native context
1409 // r1 : closure 1402 // r1 : closure
(...skipping 14 matching lines...) Expand all
1424 __ mov(closure, r5); 1417 __ mov(closure, r5);
1425 __ pop(new_target); 1418 __ pop(new_target);
1426 __ pop(argument_count); 1419 __ pop(argument_count);
1427 __ Jump(entry); 1420 __ Jump(entry);
1428 1421
1429 __ bind(&loop_bottom); 1422 __ bind(&loop_bottom);
1430 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1423 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1431 __ cmp(index, Operand(Smi::FromInt(1))); 1424 __ cmp(index, Operand(Smi::FromInt(1)));
1432 __ b(gt, &loop_top); 1425 __ b(gt, &loop_top);
1433 1426
1434 // We found neither literals nor code. 1427 // We found no code.
1435 __ jmp(&gotta_call_runtime);
1436
1437 __ bind(&try_shared); 1428 __ bind(&try_shared);
1438 __ pop(closure); 1429 __ pop(closure);
1439 __ pop(new_target); 1430 __ pop(new_target);
1440 __ pop(argument_count); 1431 __ pop(argument_count);
1441 __ ldr(entry, 1432 __ ldr(entry,
1442 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1433 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1443 // Is the shared function marked for tier up? 1434 // Is the shared function marked for tier up?
1444 __ ldrb(r5, FieldMemOperand(entry, 1435 __ ldrb(r5, FieldMemOperand(entry,
1445 SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1436 SharedFunctionInfo::kMarkedForTierUpByteOffset));
1446 __ tst(r5, Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); 1437 __ tst(r5, Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte));
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 __ bkpt(0); 3112 __ bkpt(0);
3122 } 3113 }
3123 } 3114 }
3124 3115
3125 #undef __ 3116 #undef __
3126 3117
3127 } // namespace internal 3118 } // namespace internal
3128 } // namespace v8 3119 } // namespace v8
3129 3120
3130 #endif // V8_TARGET_ARCH_ARM 3121 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/builtins/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698