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

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

Issue 2642933003: Revert of 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/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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 // -- r4 : target function (preserved for callee) 1356 // -- r4 : target function (preserved for callee)
1357 // ----------------------------------- 1357 // -----------------------------------
1358 // First lookup code, maybe we don't need to compile! 1358 // First lookup code, maybe we don't need to compile!
1359 Label gotta_call_runtime; 1359 Label gotta_call_runtime;
1360 Label try_shared; 1360 Label try_shared;
1361 Label loop_top, loop_bottom; 1361 Label loop_top, loop_bottom;
1362 1362
1363 Register closure = r4; 1363 Register closure = r4;
1364 Register map = r9; 1364 Register map = r9;
1365 Register index = r5; 1365 Register index = r5;
1366
1367 // Do we have a valid feedback vector?
1368 __ LoadP(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1369 __ LoadP(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset));
1370 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
1371
1366 __ LoadP(map, 1372 __ LoadP(map,
1367 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1373 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1368 __ LoadP(map, 1374 __ LoadP(map,
1369 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1375 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1370 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1376 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1371 __ CmpSmiLiteral(index, Smi::FromInt(2), r0); 1377 __ CmpSmiLiteral(index, Smi::FromInt(2), r0);
1372 __ blt(&gotta_call_runtime); 1378 __ blt(&gotta_call_runtime);
1373 1379
1374 // Find literals.
1375 // r10 : native context 1380 // r10 : native context
1376 // r5 : length / index 1381 // r5 : length / index
1377 // r9 : optimized code map 1382 // r9 : optimized code map
1378 // r6 : new target 1383 // r6 : new target
1379 // r4 : closure 1384 // r4 : closure
1380 Register native_context = r10; 1385 Register native_context = r10;
1381 __ LoadP(native_context, NativeContextMemOperand()); 1386 __ LoadP(native_context, NativeContextMemOperand());
1382 1387
1383 __ bind(&loop_top); 1388 __ bind(&loop_top);
1384 Register temp = r11; 1389 Register temp = r11;
1385 Register array_pointer = r8; 1390 Register array_pointer = r8;
1386 1391
1387 // Does the native context match? 1392 // Does the native context match?
1388 __ SmiToPtrArrayOffset(array_pointer, index); 1393 __ SmiToPtrArrayOffset(array_pointer, index);
1389 __ add(array_pointer, map, array_pointer); 1394 __ add(array_pointer, map, array_pointer);
1390 __ LoadP(temp, FieldMemOperand(array_pointer, 1395 __ LoadP(temp, FieldMemOperand(array_pointer,
1391 SharedFunctionInfo::kOffsetToPreviousContext)); 1396 SharedFunctionInfo::kOffsetToPreviousContext));
1392 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1397 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1393 __ cmp(temp, native_context); 1398 __ cmp(temp, native_context);
1394 __ bne(&loop_bottom); 1399 __ bne(&loop_bottom);
1395 // Literals available?
1396 __ LoadP(temp,
1397 FieldMemOperand(array_pointer,
1398 SharedFunctionInfo::kOffsetToPreviousLiterals));
1399 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1400 __ JumpIfSmi(temp, &gotta_call_runtime);
1401
1402 // Save the literals in the closure.
1403 __ StoreP(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset), r0);
1404 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, r7,
1405 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1406 OMIT_SMI_CHECK);
1407 1400
1408 // Code available? 1401 // Code available?
1409 Register entry = r7; 1402 Register entry = r7;
1410 __ LoadP(entry, 1403 __ LoadP(entry,
1411 FieldMemOperand(array_pointer, 1404 FieldMemOperand(array_pointer,
1412 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1405 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1413 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1406 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1414 __ JumpIfSmi(entry, &try_shared); 1407 __ JumpIfSmi(entry, &try_shared);
1415 1408
1416 // Found literals and code. Get them into the closure and return. 1409 // Found code. Get it into the closure and return.
1417 // Store code entry in the closure. 1410 // Store code entry in the closure.
1418 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1411 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1419 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); 1412 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0);
1420 __ RecordWriteCodeEntryField(closure, entry, r8); 1413 __ RecordWriteCodeEntryField(closure, entry, r8);
1421 1414
1422 // Link the closure into the optimized function list. 1415 // Link the closure into the optimized function list.
1423 // r7 : code entry 1416 // r7 : code entry
1424 // r10: native context 1417 // r10: native context
1425 // r4 : closure 1418 // r4 : closure
1426 __ LoadP( 1419 __ LoadP(
(...skipping 13 matching lines...) Expand all
1440 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp, 1433 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp,
1441 kLRHasNotBeenSaved, kDontSaveFPRegs); 1434 kLRHasNotBeenSaved, kDontSaveFPRegs);
1442 __ JumpToJSEntry(entry); 1435 __ JumpToJSEntry(entry);
1443 1436
1444 __ bind(&loop_bottom); 1437 __ bind(&loop_bottom);
1445 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength), 1438 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength),
1446 r0); 1439 r0);
1447 __ CmpSmiLiteral(index, Smi::FromInt(1), r0); 1440 __ CmpSmiLiteral(index, Smi::FromInt(1), r0);
1448 __ bgt(&loop_top); 1441 __ bgt(&loop_top);
1449 1442
1450 // We found neither literals nor code. 1443 // We found no code.
1451 __ b(&gotta_call_runtime); 1444 __ b(&gotta_call_runtime);
1452 1445
1453 __ bind(&try_shared); 1446 __ bind(&try_shared);
1454 __ LoadP(entry, 1447 __ LoadP(entry,
1455 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1448 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1456 // Is the shared function marked for tier up? 1449 // Is the shared function marked for tier up?
1457 __ lbz(r8, FieldMemOperand(entry, 1450 __ lbz(r8, FieldMemOperand(entry,
1458 SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1451 SharedFunctionInfo::kMarkedForTierUpByteOffset));
1459 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0); 1452 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0);
1460 __ bne(&gotta_call_runtime, cr0); 1453 __ bne(&gotta_call_runtime, cr0);
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 __ CallRuntime(Runtime::kThrowStackOverflow); 2967 __ CallRuntime(Runtime::kThrowStackOverflow);
2975 __ bkpt(0); 2968 __ bkpt(0);
2976 } 2969 }
2977 } 2970 }
2978 2971
2979 #undef __ 2972 #undef __
2980 } // namespace internal 2973 } // namespace internal
2981 } // namespace v8 2974 } // namespace v8
2982 2975
2983 #endif // V8_TARGET_ARCH_PPC 2976 #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