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

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

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE+liveedit fix. 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
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/builtins/s390/builtins-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 1027
1028 // Check whether we should continue to use the interpreter. 1028 // Check whether we should continue to use the interpreter.
1029 Label switch_to_different_code_kind; 1029 Label switch_to_different_code_kind;
1030 __ LoadP(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); 1030 __ LoadP(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset));
1031 __ mov(ip, Operand(masm->CodeObject())); // Self-reference to this code. 1031 __ mov(ip, Operand(masm->CodeObject())); // Self-reference to this code.
1032 __ cmp(r3, ip); 1032 __ cmp(r3, ip);
1033 __ bne(&switch_to_different_code_kind); 1033 __ bne(&switch_to_different_code_kind);
1034 1034
1035 // Increment invocation count for the function. 1035 // Increment invocation count for the function.
1036 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kFeedbackVectorOffset)); 1036 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kFeedbackVectorOffset));
1037 __ LoadP(r7, FieldMemOperand(r7, Cell::kValueOffset));
1037 __ LoadP(r8, FieldMemOperand(r7, TypeFeedbackVector::kInvocationCountIndex * 1038 __ LoadP(r8, FieldMemOperand(r7, TypeFeedbackVector::kInvocationCountIndex *
1038 kPointerSize + 1039 kPointerSize +
1039 TypeFeedbackVector::kHeaderSize)); 1040 TypeFeedbackVector::kHeaderSize));
1040 __ AddSmiLiteral(r8, r8, Smi::FromInt(1), r0); 1041 __ AddSmiLiteral(r8, r8, Smi::FromInt(1), r0);
1041 __ StoreP(r8, FieldMemOperand(r7, TypeFeedbackVector::kInvocationCountIndex * 1042 __ StoreP(r8, FieldMemOperand(r7, TypeFeedbackVector::kInvocationCountIndex *
1042 kPointerSize + 1043 kPointerSize +
1043 TypeFeedbackVector::kHeaderSize), 1044 TypeFeedbackVector::kHeaderSize),
1044 r0); 1045 r0);
1045 1046
1046 // Check function data field is actually a BytecodeArray object. 1047 // Check function data field is actually a BytecodeArray object.
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 // -- r4 : target function (preserved for callee) 1358 // -- r4 : target function (preserved for callee)
1358 // ----------------------------------- 1359 // -----------------------------------
1359 // First lookup code, maybe we don't need to compile! 1360 // First lookup code, maybe we don't need to compile!
1360 Label gotta_call_runtime; 1361 Label gotta_call_runtime;
1361 Label try_shared; 1362 Label try_shared;
1362 Label loop_top, loop_bottom; 1363 Label loop_top, loop_bottom;
1363 1364
1364 Register closure = r4; 1365 Register closure = r4;
1365 Register map = r9; 1366 Register map = r9;
1366 Register index = r5; 1367 Register index = r5;
1368
1369 // Do we have a valid feedback vector?
1370 __ LoadP(index, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset));
1371 __ LoadP(index, FieldMemOperand(index, Cell::kValueOffset));
1372 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
1373
1367 __ LoadP(map, 1374 __ LoadP(map,
1368 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1375 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1369 __ LoadP(map, 1376 __ LoadP(map,
1370 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1377 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1371 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1378 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1372 __ CmpSmiLiteral(index, Smi::FromInt(2), r0); 1379 __ CmpSmiLiteral(index, Smi::FromInt(2), r0);
1373 __ blt(&gotta_call_runtime); 1380 __ blt(&try_shared);
1374 1381
1375 // Find literals.
1376 // r10 : native context 1382 // r10 : native context
1377 // r5 : length / index 1383 // r5 : length / index
1378 // r9 : optimized code map 1384 // r9 : optimized code map
1379 // r6 : new target 1385 // r6 : new target
1380 // r4 : closure 1386 // r4 : closure
1381 Register native_context = r10; 1387 Register native_context = r10;
1382 __ LoadP(native_context, NativeContextMemOperand()); 1388 __ LoadP(native_context, NativeContextMemOperand());
1383 1389
1384 __ bind(&loop_top); 1390 __ bind(&loop_top);
1385 Register temp = r11; 1391 Register temp = r11;
1386 Register array_pointer = r8; 1392 Register array_pointer = r8;
1387 1393
1388 // Does the native context match? 1394 // Does the native context match?
1389 __ SmiToPtrArrayOffset(array_pointer, index); 1395 __ SmiToPtrArrayOffset(array_pointer, index);
1390 __ add(array_pointer, map, array_pointer); 1396 __ add(array_pointer, map, array_pointer);
1391 __ LoadP(temp, FieldMemOperand(array_pointer, 1397 __ LoadP(temp, FieldMemOperand(array_pointer,
1392 SharedFunctionInfo::kOffsetToPreviousContext)); 1398 SharedFunctionInfo::kOffsetToPreviousContext));
1393 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1399 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1394 __ cmp(temp, native_context); 1400 __ cmp(temp, native_context);
1395 __ bne(&loop_bottom); 1401 __ bne(&loop_bottom);
1396 // Feedback vector available?
1397 __ LoadP(temp,
1398 FieldMemOperand(array_pointer,
1399 SharedFunctionInfo::kOffsetToPreviousLiterals));
1400 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1401 __ JumpIfSmi(temp, &gotta_call_runtime);
1402
1403 // Save the feedback vector in the closure.
1404 __ StoreP(temp, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset),
1405 r0);
1406 __ RecordWriteField(closure, JSFunction::kFeedbackVectorOffset, temp, r7,
1407 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1408 OMIT_SMI_CHECK);
1409 1402
1410 // Code available? 1403 // Code available?
1411 Register entry = r7; 1404 Register entry = r7;
1412 __ LoadP(entry, 1405 __ LoadP(entry,
1413 FieldMemOperand(array_pointer, 1406 FieldMemOperand(array_pointer,
1414 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1407 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1415 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1408 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1416 __ JumpIfSmi(entry, &try_shared); 1409 __ JumpIfSmi(entry, &try_shared);
1417 1410
1418 // Found literals and code. Get them into the closure and return. 1411 // Found code. Get it into the closure and return.
1419 // Store code entry in the closure. 1412 // Store code entry in the closure.
1420 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1413 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1421 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); 1414 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0);
1422 __ RecordWriteCodeEntryField(closure, entry, r8); 1415 __ RecordWriteCodeEntryField(closure, entry, r8);
1423 1416
1424 // Link the closure into the optimized function list. 1417 // Link the closure into the optimized function list.
1425 // r7 : code entry 1418 // r7 : code entry
1426 // r10: native context 1419 // r10: native context
1427 // r4 : closure 1420 // r4 : closure
1428 __ LoadP( 1421 __ LoadP(
(...skipping 13 matching lines...) Expand all
1442 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp, 1435 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp,
1443 kLRHasNotBeenSaved, kDontSaveFPRegs); 1436 kLRHasNotBeenSaved, kDontSaveFPRegs);
1444 __ JumpToJSEntry(entry); 1437 __ JumpToJSEntry(entry);
1445 1438
1446 __ bind(&loop_bottom); 1439 __ bind(&loop_bottom);
1447 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength), 1440 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength),
1448 r0); 1441 r0);
1449 __ CmpSmiLiteral(index, Smi::FromInt(1), r0); 1442 __ CmpSmiLiteral(index, Smi::FromInt(1), r0);
1450 __ bgt(&loop_top); 1443 __ bgt(&loop_top);
1451 1444
1452 // We found neither literals nor code. 1445 // We found no code.
1453 __ b(&gotta_call_runtime); 1446 __ b(&gotta_call_runtime);
1454 1447
1455 __ bind(&try_shared); 1448 __ bind(&try_shared);
1456 __ LoadP(entry, 1449 __ LoadP(entry,
1457 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1450 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1458 // Is the shared function marked for tier up? 1451 // Is the shared function marked for tier up?
1459 __ lbz(r8, FieldMemOperand(entry, 1452 __ lbz(r8, FieldMemOperand(entry,
1460 SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1453 SharedFunctionInfo::kMarkedForTierUpByteOffset));
1461 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0); 1454 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0);
1462 __ bne(&gotta_call_runtime, cr0); 1455 __ bne(&gotta_call_runtime, cr0);
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
3205 __ CallRuntime(Runtime::kThrowStackOverflow); 3198 __ CallRuntime(Runtime::kThrowStackOverflow);
3206 __ bkpt(0); 3199 __ bkpt(0);
3207 } 3200 }
3208 } 3201 }
3209 3202
3210 #undef __ 3203 #undef __
3211 } // namespace internal 3204 } // namespace internal
3212 } // namespace v8 3205 } // namespace v8
3213 3206
3214 #endif // V8_TARGET_ARCH_PPC 3207 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698