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

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

Issue 2620753003: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: GCSTRESS fix. 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 | « no previous file | 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 // -- r1 : target function (preserved for callee) 1330 // -- r1 : target function (preserved for callee)
1331 // ----------------------------------- 1331 // -----------------------------------
1332 // First lookup code, maybe we don't need to compile! 1332 // First lookup code, maybe we don't need to compile!
1333 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1333 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1334 Label try_shared; 1334 Label try_shared;
1335 Label loop_top, loop_bottom; 1335 Label loop_top, loop_bottom;
1336 1336
1337 Register argument_count = r0; 1337 Register argument_count = r0;
1338 Register closure = r1; 1338 Register closure = r1;
1339 Register new_target = r3; 1339 Register new_target = r3;
1340 Register map = argument_count;
1341 Register index = r2;
1342
1343 // Do we have a valid feedback vector?
1344 __ ldr(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1345 __ ldr(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset));
1346 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex,
1347 &gotta_call_runtime_no_stack);
1348
1340 __ push(argument_count); 1349 __ push(argument_count);
1341 __ push(new_target); 1350 __ push(new_target);
1342 __ push(closure); 1351 __ push(closure);
1343 1352
1344 Register map = argument_count;
1345 Register index = r2;
1346 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1353 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1347 __ ldr(map, 1354 __ ldr(map,
1348 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1355 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1349 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1356 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1350 __ cmp(index, Operand(Smi::FromInt(2))); 1357 __ cmp(index, Operand(Smi::FromInt(2)));
1351 __ b(lt, &gotta_call_runtime); 1358 __ b(lt, &gotta_call_runtime);
1352 1359
1353 // Find literals.
1354 // r3 : native context 1360 // r3 : native context
1355 // r2 : length / index 1361 // r2 : length / index
1356 // r0 : optimized code map 1362 // r0 : optimized code map
1357 // stack[0] : new target 1363 // stack[0] : new target
1358 // stack[4] : closure 1364 // stack[4] : closure
1359 Register native_context = r3; 1365 Register native_context = r3;
1360 __ ldr(native_context, NativeContextMemOperand()); 1366 __ ldr(native_context, NativeContextMemOperand());
1361 1367
1362 __ bind(&loop_top); 1368 __ bind(&loop_top);
1363 Register temp = r1; 1369 Register temp = r1;
1364 Register array_pointer = r5; 1370 Register array_pointer = r5;
1365 1371
1366 // Does the native context match? 1372 // Does the native context match?
1367 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index)); 1373 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index));
1368 __ ldr(temp, FieldMemOperand(array_pointer, 1374 __ ldr(temp, FieldMemOperand(array_pointer,
1369 SharedFunctionInfo::kOffsetToPreviousContext)); 1375 SharedFunctionInfo::kOffsetToPreviousContext));
1370 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1376 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1371 __ cmp(temp, native_context); 1377 __ cmp(temp, native_context);
1372 __ b(ne, &loop_bottom); 1378 __ b(ne, &loop_bottom);
1373 // Literals available?
1374 __ ldr(temp, FieldMemOperand(array_pointer,
1375 SharedFunctionInfo::kOffsetToPreviousLiterals));
1376 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1377 __ JumpIfSmi(temp, &gotta_call_runtime);
1378
1379 // Save the literals in the closure.
1380 __ ldr(r4, MemOperand(sp, 0));
1381 __ str(temp, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
1382 __ push(index);
1383 __ RecordWriteField(r4, JSFunction::kLiteralsOffset, temp, index,
1384 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1385 OMIT_SMI_CHECK);
1386 __ pop(index);
1387 1379
1388 // Code available? 1380 // Code available?
1389 Register entry = r4; 1381 Register entry = r4;
1390 __ ldr(entry, 1382 __ ldr(entry,
1391 FieldMemOperand(array_pointer, 1383 FieldMemOperand(array_pointer,
1392 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1384 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1393 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1385 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1394 __ JumpIfSmi(entry, &try_shared); 1386 __ JumpIfSmi(entry, &try_shared);
1395 1387
1396 // Found literals and code. Get them into the closure and return. 1388 // Found code. Get it into the closure and return.
1397 __ pop(closure); 1389 __ pop(closure);
1398 // Store code entry in the closure. 1390 // Store code entry in the closure.
1399 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1391 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1400 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1392 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1401 __ RecordWriteCodeEntryField(closure, entry, r5); 1393 __ RecordWriteCodeEntryField(closure, entry, r5);
1402 1394
1403 // Link the closure into the optimized function list. 1395 // Link the closure into the optimized function list.
1404 // r4 : code entry 1396 // r4 : code entry
1405 // r3 : native context 1397 // r3 : native context
1406 // r1 : closure 1398 // r1 : closure
(...skipping 14 matching lines...) Expand all
1421 __ mov(closure, r5); 1413 __ mov(closure, r5);
1422 __ pop(new_target); 1414 __ pop(new_target);
1423 __ pop(argument_count); 1415 __ pop(argument_count);
1424 __ Jump(entry); 1416 __ Jump(entry);
1425 1417
1426 __ bind(&loop_bottom); 1418 __ bind(&loop_bottom);
1427 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1419 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1428 __ cmp(index, Operand(Smi::FromInt(1))); 1420 __ cmp(index, Operand(Smi::FromInt(1)));
1429 __ b(gt, &loop_top); 1421 __ b(gt, &loop_top);
1430 1422
1431 // We found neither literals nor code. 1423 // We found no code.
1432 __ jmp(&gotta_call_runtime); 1424 __ jmp(&gotta_call_runtime);
1433 1425
1434 __ bind(&try_shared); 1426 __ bind(&try_shared);
1435 __ pop(closure); 1427 __ pop(closure);
1436 __ pop(new_target); 1428 __ pop(new_target);
1437 __ pop(argument_count); 1429 __ pop(argument_count);
1438 __ ldr(entry, 1430 __ ldr(entry,
1439 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1431 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1440 // Is the shared function marked for tier up? 1432 // Is the shared function marked for tier up?
1441 __ ldrb(r5, FieldMemOperand(entry, 1433 __ ldrb(r5, FieldMemOperand(entry,
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 __ bkpt(0); 2879 __ bkpt(0);
2888 } 2880 }
2889 } 2881 }
2890 2882
2891 #undef __ 2883 #undef __
2892 2884
2893 } // namespace internal 2885 } // namespace internal
2894 } // namespace v8 2886 } // namespace v8
2895 2887
2896 #endif // V8_TARGET_ARCH_ARM 2888 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/builtins/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698