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

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

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

Powered by Google App Engine
This is Rietveld 408576698