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

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

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE. 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
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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 // -- r4 : target function (preserved for callee) 1357 // -- r4 : target function (preserved for callee)
1358 // ----------------------------------- 1358 // -----------------------------------
1359 // First lookup code, maybe we don't need to compile! 1359 // First lookup code, maybe we don't need to compile!
1360 Label gotta_call_runtime; 1360 Label gotta_call_runtime;
1361 Label try_shared; 1361 Label try_shared;
1362 Label loop_top, loop_bottom; 1362 Label loop_top, loop_bottom;
1363 1363
1364 Register closure = r4; 1364 Register closure = r4;
1365 Register map = r9; 1365 Register map = r9;
1366 Register index = r5; 1366 Register index = r5;
1367
1368 // Do we have a valid feedback vector?
1369 __ LoadP(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1370 __ LoadP(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset));
1371 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
1372
1367 __ LoadP(map, 1373 __ LoadP(map,
1368 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1374 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1369 __ LoadP(map, 1375 __ LoadP(map,
1370 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1376 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1371 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1377 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1372 __ CmpSmiLiteral(index, Smi::FromInt(2), r0); 1378 __ CmpSmiLiteral(index, Smi::FromInt(2), r0);
1373 __ blt(&gotta_call_runtime); 1379 __ blt(&gotta_call_runtime);
1374 1380
1375 // Find literals.
1376 // r10 : native context 1381 // r10 : native context
1377 // r5 : length / index 1382 // r5 : length / index
1378 // r9 : optimized code map 1383 // r9 : optimized code map
1379 // r6 : new target 1384 // r6 : new target
1380 // r4 : closure 1385 // r4 : closure
1381 Register native_context = r10; 1386 Register native_context = r10;
1382 __ LoadP(native_context, NativeContextMemOperand()); 1387 __ LoadP(native_context, NativeContextMemOperand());
1383 1388
1384 __ bind(&loop_top); 1389 __ bind(&loop_top);
1385 Register temp = r11; 1390 Register temp = r11;
1386 Register array_pointer = r8; 1391 Register array_pointer = r8;
1387 1392
1388 // Does the native context match? 1393 // Does the native context match?
1389 __ SmiToPtrArrayOffset(array_pointer, index); 1394 __ SmiToPtrArrayOffset(array_pointer, index);
1390 __ add(array_pointer, map, array_pointer); 1395 __ add(array_pointer, map, array_pointer);
1391 __ LoadP(temp, FieldMemOperand(array_pointer, 1396 __ LoadP(temp, FieldMemOperand(array_pointer,
1392 SharedFunctionInfo::kOffsetToPreviousContext)); 1397 SharedFunctionInfo::kOffsetToPreviousContext));
1393 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1398 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1394 __ cmp(temp, native_context); 1399 __ cmp(temp, native_context);
1395 __ bne(&loop_bottom); 1400 __ 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 1401
1410 // Code available? 1402 // Code available?
1411 Register entry = r7; 1403 Register entry = r7;
1412 __ LoadP(entry, 1404 __ LoadP(entry,
1413 FieldMemOperand(array_pointer, 1405 FieldMemOperand(array_pointer,
1414 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1406 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1415 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1407 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1416 __ JumpIfSmi(entry, &try_shared); 1408 __ JumpIfSmi(entry, &try_shared);
1417 1409
1418 // Found literals and code. Get them into the closure and return. 1410 // Found code. Get it into the closure and return.
1419 // Store code entry in the closure. 1411 // Store code entry in the closure.
1420 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1412 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1421 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); 1413 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0);
1422 __ RecordWriteCodeEntryField(closure, entry, r8); 1414 __ RecordWriteCodeEntryField(closure, entry, r8);
1423 1415
1424 // Link the closure into the optimized function list. 1416 // Link the closure into the optimized function list.
1425 // r7 : code entry 1417 // r7 : code entry
1426 // r10: native context 1418 // r10: native context
1427 // r4 : closure 1419 // r4 : closure
1428 __ LoadP( 1420 __ LoadP(
(...skipping 13 matching lines...) Expand all
1442 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp, 1434 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp,
1443 kLRHasNotBeenSaved, kDontSaveFPRegs); 1435 kLRHasNotBeenSaved, kDontSaveFPRegs);
1444 __ JumpToJSEntry(entry); 1436 __ JumpToJSEntry(entry);
1445 1437
1446 __ bind(&loop_bottom); 1438 __ bind(&loop_bottom);
1447 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength), 1439 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength),
1448 r0); 1440 r0);
1449 __ CmpSmiLiteral(index, Smi::FromInt(1), r0); 1441 __ CmpSmiLiteral(index, Smi::FromInt(1), r0);
1450 __ bgt(&loop_top); 1442 __ bgt(&loop_top);
1451 1443
1452 // We found neither literals nor code. 1444 // We found no code.
1453 __ b(&gotta_call_runtime); 1445 __ b(&gotta_call_runtime);
1454 1446
1455 __ bind(&try_shared); 1447 __ bind(&try_shared);
1456 __ LoadP(entry, 1448 __ LoadP(entry,
1457 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1449 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1458 // Is the shared function marked for tier up? 1450 // Is the shared function marked for tier up?
1459 __ lbz(r8, FieldMemOperand(entry, 1451 __ lbz(r8, FieldMemOperand(entry,
1460 SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1452 SharedFunctionInfo::kMarkedForTierUpByteOffset));
1461 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0); 1453 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0);
1462 __ bne(&gotta_call_runtime, cr0); 1454 __ bne(&gotta_call_runtime, cr0);
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
3205 __ CallRuntime(Runtime::kThrowStackOverflow); 3197 __ CallRuntime(Runtime::kThrowStackOverflow);
3206 __ bkpt(0); 3198 __ bkpt(0);
3207 } 3199 }
3208 } 3200 }
3209 3201
3210 #undef __ 3202 #undef __
3211 } // namespace internal 3203 } // namespace internal
3212 } // namespace v8 3204 } // namespace v8
3213 3205
3214 #endif // V8_TARGET_ARCH_PPC 3206 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698