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

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

Issue 2626863004: Revert of [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: Created 3 years, 11 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/arm/builtins-arm.cc ('k') | src/builtins/builtins-constructor.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 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 // -- x1 : target function (preserved for callee) 1340 // -- x1 : target function (preserved for callee)
1341 // ----------------------------------- 1341 // -----------------------------------
1342 // First lookup code, maybe we don't need to compile! 1342 // First lookup code, maybe we don't need to compile!
1343 Label gotta_call_runtime; 1343 Label gotta_call_runtime;
1344 Label try_shared; 1344 Label try_shared;
1345 Label loop_top, loop_bottom; 1345 Label loop_top, loop_bottom;
1346 1346
1347 Register closure = x1; 1347 Register closure = x1;
1348 Register map = x13; 1348 Register map = x13;
1349 Register index = x2; 1349 Register index = x2;
1350
1351 // Do we have a valid feedback vector?
1352 __ Ldr(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1353 __ Ldr(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset));
1354 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
1355
1356 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1350 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1357 __ Ldr(map, 1351 __ Ldr(map,
1358 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1352 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1359 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset)); 1353 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset));
1360 __ Cmp(index, Operand(2)); 1354 __ Cmp(index, Operand(2));
1361 __ B(lt, &gotta_call_runtime); 1355 __ B(lt, &gotta_call_runtime);
1362 1356
1357 // Find literals.
1363 // x3 : native context 1358 // x3 : native context
1364 // x2 : length / index 1359 // x2 : length / index
1365 // x13 : optimized code map 1360 // x13 : optimized code map
1366 // stack[0] : new target 1361 // stack[0] : new target
1367 // stack[4] : closure 1362 // stack[4] : closure
1368 Register native_context = x4; 1363 Register native_context = x4;
1369 __ Ldr(native_context, NativeContextMemOperand()); 1364 __ Ldr(native_context, NativeContextMemOperand());
1370 1365
1371 __ Bind(&loop_top); 1366 __ Bind(&loop_top);
1372 Register temp = x5; 1367 Register temp = x5;
1373 Register array_pointer = x6; 1368 Register array_pointer = x6;
1374 1369
1375 // Does the native context match? 1370 // Does the native context match?
1376 __ Add(array_pointer, map, Operand(index, LSL, kPointerSizeLog2)); 1371 __ Add(array_pointer, map, Operand(index, LSL, kPointerSizeLog2));
1377 __ Ldr(temp, FieldMemOperand(array_pointer, 1372 __ Ldr(temp, FieldMemOperand(array_pointer,
1378 SharedFunctionInfo::kOffsetToPreviousContext)); 1373 SharedFunctionInfo::kOffsetToPreviousContext));
1379 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1374 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1380 __ Cmp(temp, native_context); 1375 __ Cmp(temp, native_context);
1381 __ B(ne, &loop_bottom); 1376 __ B(ne, &loop_bottom);
1377 // Literals available?
1378 __ Ldr(temp, FieldMemOperand(array_pointer,
1379 SharedFunctionInfo::kOffsetToPreviousLiterals));
1380 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1381 __ JumpIfSmi(temp, &gotta_call_runtime);
1382
1383 // Save the literals in the closure.
1384 __ Str(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1385 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7,
1386 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1387 OMIT_SMI_CHECK);
1382 1388
1383 // Code available? 1389 // Code available?
1384 Register entry = x7; 1390 Register entry = x7;
1385 __ Ldr(entry, 1391 __ Ldr(entry,
1386 FieldMemOperand(array_pointer, 1392 FieldMemOperand(array_pointer,
1387 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1393 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1388 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1394 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1389 __ JumpIfSmi(entry, &try_shared); 1395 __ JumpIfSmi(entry, &try_shared);
1390 1396
1391 // Found code. Get it into the closure and return. 1397 // Found literals and code. Get them into the closure and return.
1392 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1398 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1393 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1399 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1394 __ RecordWriteCodeEntryField(closure, entry, x5); 1400 __ RecordWriteCodeEntryField(closure, entry, x5);
1395 1401
1396 // Link the closure into the optimized function list. 1402 // Link the closure into the optimized function list.
1397 // x7 : code entry 1403 // x7 : code entry
1398 // x4 : native context 1404 // x4 : native context
1399 // x1 : closure 1405 // x1 : closure
1400 __ Ldr(x8, 1406 __ Ldr(x8,
1401 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1407 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1402 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); 1408 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
1403 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, x8, x13, 1409 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, x8, x13,
1404 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1410 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1405 OMIT_SMI_CHECK); 1411 OMIT_SMI_CHECK);
1406 const int function_list_offset = 1412 const int function_list_offset =
1407 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST); 1413 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST);
1408 __ Str(closure, 1414 __ Str(closure,
1409 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); 1415 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1410 __ Mov(x5, closure); 1416 __ Mov(x5, closure);
1411 __ RecordWriteContextSlot(native_context, function_list_offset, x5, x13, 1417 __ RecordWriteContextSlot(native_context, function_list_offset, x5, x13,
1412 kLRHasNotBeenSaved, kDontSaveFPRegs); 1418 kLRHasNotBeenSaved, kDontSaveFPRegs);
1413 __ Jump(entry); 1419 __ Jump(entry);
1414 1420
1415 __ Bind(&loop_bottom); 1421 __ Bind(&loop_bottom);
1416 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength)); 1422 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength));
1417 __ Cmp(index, Operand(1)); 1423 __ Cmp(index, Operand(1));
1418 __ B(gt, &loop_top); 1424 __ B(gt, &loop_top);
1419 1425
1420 // We found no code. 1426 // We found neither literals nor code.
1421 __ B(&gotta_call_runtime); 1427 __ B(&gotta_call_runtime);
1422 1428
1423 __ Bind(&try_shared); 1429 __ Bind(&try_shared);
1424 __ Ldr(entry, 1430 __ Ldr(entry,
1425 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1431 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1426 // Is the shared function marked for tier up? 1432 // Is the shared function marked for tier up?
1427 __ Ldrb(temp, FieldMemOperand( 1433 __ Ldrb(temp, FieldMemOperand(
1428 entry, SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1434 entry, SharedFunctionInfo::kMarkedForTierUpByteOffset));
1429 __ TestAndBranchIfAnySet( 1435 __ TestAndBranchIfAnySet(
1430 temp, 1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte, 1436 temp, 1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte,
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 __ Unreachable(); 2998 __ Unreachable();
2993 } 2999 }
2994 } 3000 }
2995 3001
2996 #undef __ 3002 #undef __
2997 3003
2998 } // namespace internal 3004 } // namespace internal
2999 } // namespace v8 3005 } // namespace v8
3000 3006
3001 #endif // V8_TARGET_ARCH_ARM 3007 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins-constructor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698