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

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

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE. 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 // -- x1 : target function (preserved for callee) 1343 // -- x1 : target function (preserved for callee)
1344 // ----------------------------------- 1344 // -----------------------------------
1345 // First lookup code, maybe we don't need to compile! 1345 // First lookup code, maybe we don't need to compile!
1346 Label gotta_call_runtime; 1346 Label gotta_call_runtime;
1347 Label try_shared; 1347 Label try_shared;
1348 Label loop_top, loop_bottom; 1348 Label loop_top, loop_bottom;
1349 1349
1350 Register closure = x1; 1350 Register closure = x1;
1351 Register map = x13; 1351 Register map = x13;
1352 Register index = x2; 1352 Register index = x2;
1353
1354 // Do we have a valid feedback vector?
1355 __ Ldr(index, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset));
1356 __ Ldr(index, FieldMemOperand(index, Cell::kValueOffset));
1357 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
1358
1353 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1359 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1354 __ Ldr(map, 1360 __ Ldr(map,
1355 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1361 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1356 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset)); 1362 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset));
1357 __ Cmp(index, Operand(2)); 1363 __ Cmp(index, Operand(2));
1358 __ B(lt, &gotta_call_runtime); 1364 __ B(lt, &try_shared);
1359 1365
1360 // Find literals.
1361 // x3 : native context 1366 // x3 : native context
1362 // x2 : length / index 1367 // x2 : length / index
1363 // x13 : optimized code map 1368 // x13 : optimized code map
1364 // stack[0] : new target 1369 // stack[0] : new target
1365 // stack[4] : closure 1370 // stack[4] : closure
1366 Register native_context = x4; 1371 Register native_context = x4;
1367 __ Ldr(native_context, NativeContextMemOperand()); 1372 __ Ldr(native_context, NativeContextMemOperand());
1368 1373
1369 __ Bind(&loop_top); 1374 __ Bind(&loop_top);
1370 Register temp = x5; 1375 Register temp = x5;
1371 Register array_pointer = x6; 1376 Register array_pointer = x6;
1372 1377
1373 // Does the native context match? 1378 // Does the native context match?
1374 __ Add(array_pointer, map, Operand(index, LSL, kPointerSizeLog2)); 1379 __ Add(array_pointer, map, Operand(index, LSL, kPointerSizeLog2));
1375 __ Ldr(temp, FieldMemOperand(array_pointer, 1380 __ Ldr(temp, FieldMemOperand(array_pointer,
1376 SharedFunctionInfo::kOffsetToPreviousContext)); 1381 SharedFunctionInfo::kOffsetToPreviousContext));
1377 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1382 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1378 __ Cmp(temp, native_context); 1383 __ Cmp(temp, native_context);
1379 __ B(ne, &loop_bottom); 1384 __ B(ne, &loop_bottom);
1380 // Feedback vector available?
1381 __ Ldr(temp, FieldMemOperand(array_pointer,
1382 SharedFunctionInfo::kOffsetToPreviousLiterals));
1383 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1384 __ JumpIfSmi(temp, &gotta_call_runtime);
1385
1386 // Save the feedback vector in the closure.
1387 __ Str(temp, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset));
1388 __ RecordWriteField(closure, JSFunction::kFeedbackVectorOffset, temp, x7,
1389 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1390 OMIT_SMI_CHECK);
1391 1385
1392 // Code available? 1386 // Code available?
1393 Register entry = x7; 1387 Register entry = x7;
1394 __ Ldr(entry, 1388 __ Ldr(entry,
1395 FieldMemOperand(array_pointer, 1389 FieldMemOperand(array_pointer,
1396 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1390 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1397 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1391 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1398 __ JumpIfSmi(entry, &try_shared); 1392 __ JumpIfSmi(entry, &try_shared);
1399 1393
1400 // Found literals and code. Get them into the closure and return. 1394 // Found code. Get it into the closure and return.
1401 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1395 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1402 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1396 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1403 __ RecordWriteCodeEntryField(closure, entry, x5); 1397 __ RecordWriteCodeEntryField(closure, entry, x5);
1404 1398
1405 // Link the closure into the optimized function list. 1399 // Link the closure into the optimized function list.
1406 // x7 : code entry 1400 // x7 : code entry
1407 // x4 : native context 1401 // x4 : native context
1408 // x1 : closure 1402 // x1 : closure
1409 __ Ldr(x8, 1403 __ Ldr(x8,
1410 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1404 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1411 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); 1405 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
1412 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, x8, x13, 1406 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, x8, x13,
1413 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1407 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1414 OMIT_SMI_CHECK); 1408 OMIT_SMI_CHECK);
1415 const int function_list_offset = 1409 const int function_list_offset =
1416 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST); 1410 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST);
1417 __ Str(closure, 1411 __ Str(closure,
1418 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1412 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1419 __ Mov(x5, closure); 1413 __ Mov(x5, closure);
1420 __ RecordWriteContextSlot(native_context, function_list_offset, x5, x13, 1414 __ RecordWriteContextSlot(native_context, function_list_offset, x5, x13,
1421 kLRHasNotBeenSaved, kDontSaveFPRegs); 1415 kLRHasNotBeenSaved, kDontSaveFPRegs);
1422 __ Jump(entry); 1416 __ Jump(entry);
1423 1417
1424 __ Bind(&loop_bottom); 1418 __ Bind(&loop_bottom);
1425 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength)); 1419 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength));
1426 __ Cmp(index, Operand(1)); 1420 __ Cmp(index, Operand(1));
1427 __ B(gt, &loop_top); 1421 __ B(gt, &loop_top);
1428 1422
1429 // We found neither literals nor code. 1423 // We found no code.
1430 __ B(&gotta_call_runtime);
1431
1432 __ Bind(&try_shared); 1424 __ Bind(&try_shared);
1433 __ Ldr(entry, 1425 __ Ldr(entry,
1434 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1426 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1435 // Is the shared function marked for tier up? 1427 // Is the shared function marked for tier up?
1436 __ Ldrb(temp, FieldMemOperand( 1428 __ Ldrb(temp, FieldMemOperand(
1437 entry, SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1429 entry, SharedFunctionInfo::kMarkedForTierUpByteOffset));
1438 __ TestAndBranchIfAnySet( 1430 __ TestAndBranchIfAnySet(
1439 temp, 1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte, 1431 temp, 1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte,
1440 &gotta_call_runtime); 1432 &gotta_call_runtime);
1441 1433
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 __ Unreachable(); 3218 __ Unreachable();
3227 } 3219 }
3228 } 3220 }
3229 3221
3230 #undef __ 3222 #undef __
3231 3223
3232 } // namespace internal 3224 } // namespace internal
3233 } // namespace v8 3225 } // namespace v8
3234 3226
3235 #endif // V8_TARGET_ARCH_ARM 3227 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698