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

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

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