OLD | NEW |
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 Loading... |
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 | |
1372 __ LoadP(map, | 1366 __ LoadP(map, |
1373 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1367 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1374 __ LoadP(map, | 1368 __ LoadP(map, |
1375 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | 1369 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
1376 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset)); | 1370 __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset)); |
1377 __ CmpSmiLiteral(index, Smi::FromInt(2), r0); | 1371 __ CmpSmiLiteral(index, Smi::FromInt(2), r0); |
1378 __ blt(&gotta_call_runtime); | 1372 __ blt(&gotta_call_runtime); |
1379 | 1373 |
| 1374 // Find literals. |
1380 // r10 : native context | 1375 // r10 : native context |
1381 // r5 : length / index | 1376 // r5 : length / index |
1382 // r9 : optimized code map | 1377 // r9 : optimized code map |
1383 // r6 : new target | 1378 // r6 : new target |
1384 // r4 : closure | 1379 // r4 : closure |
1385 Register native_context = r10; | 1380 Register native_context = r10; |
1386 __ LoadP(native_context, NativeContextMemOperand()); | 1381 __ LoadP(native_context, NativeContextMemOperand()); |
1387 | 1382 |
1388 __ bind(&loop_top); | 1383 __ bind(&loop_top); |
1389 Register temp = r11; | 1384 Register temp = r11; |
1390 Register array_pointer = r8; | 1385 Register array_pointer = r8; |
1391 | 1386 |
1392 // Does the native context match? | 1387 // Does the native context match? |
1393 __ SmiToPtrArrayOffset(array_pointer, index); | 1388 __ SmiToPtrArrayOffset(array_pointer, index); |
1394 __ add(array_pointer, map, array_pointer); | 1389 __ add(array_pointer, map, array_pointer); |
1395 __ LoadP(temp, FieldMemOperand(array_pointer, | 1390 __ LoadP(temp, FieldMemOperand(array_pointer, |
1396 SharedFunctionInfo::kOffsetToPreviousContext)); | 1391 SharedFunctionInfo::kOffsetToPreviousContext)); |
1397 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | 1392 __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
1398 __ cmp(temp, native_context); | 1393 __ cmp(temp, native_context); |
1399 __ bne(&loop_bottom); | 1394 __ 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); |
1400 | 1407 |
1401 // Code available? | 1408 // Code available? |
1402 Register entry = r7; | 1409 Register entry = r7; |
1403 __ LoadP(entry, | 1410 __ LoadP(entry, |
1404 FieldMemOperand(array_pointer, | 1411 FieldMemOperand(array_pointer, |
1405 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1412 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
1406 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1413 __ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
1407 __ JumpIfSmi(entry, &try_shared); | 1414 __ JumpIfSmi(entry, &try_shared); |
1408 | 1415 |
1409 // Found code. Get it into the closure and return. | 1416 // Found literals and code. Get them into the closure and return. |
1410 // Store code entry in the closure. | 1417 // Store code entry in the closure. |
1411 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1418 __ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1412 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); | 1419 __ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0); |
1413 __ RecordWriteCodeEntryField(closure, entry, r8); | 1420 __ RecordWriteCodeEntryField(closure, entry, r8); |
1414 | 1421 |
1415 // Link the closure into the optimized function list. | 1422 // Link the closure into the optimized function list. |
1416 // r7 : code entry | 1423 // r7 : code entry |
1417 // r10: native context | 1424 // r10: native context |
1418 // r4 : closure | 1425 // r4 : closure |
1419 __ LoadP( | 1426 __ LoadP( |
(...skipping 13 matching lines...) Expand all Loading... |
1433 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp, | 1440 __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp, |
1434 kLRHasNotBeenSaved, kDontSaveFPRegs); | 1441 kLRHasNotBeenSaved, kDontSaveFPRegs); |
1435 __ JumpToJSEntry(entry); | 1442 __ JumpToJSEntry(entry); |
1436 | 1443 |
1437 __ bind(&loop_bottom); | 1444 __ bind(&loop_bottom); |
1438 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength), | 1445 __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength), |
1439 r0); | 1446 r0); |
1440 __ CmpSmiLiteral(index, Smi::FromInt(1), r0); | 1447 __ CmpSmiLiteral(index, Smi::FromInt(1), r0); |
1441 __ bgt(&loop_top); | 1448 __ bgt(&loop_top); |
1442 | 1449 |
1443 // We found no code. | 1450 // We found neither literals nor code. |
1444 __ b(&gotta_call_runtime); | 1451 __ b(&gotta_call_runtime); |
1445 | 1452 |
1446 __ bind(&try_shared); | 1453 __ bind(&try_shared); |
1447 __ LoadP(entry, | 1454 __ LoadP(entry, |
1448 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1455 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1449 // Is the shared function marked for tier up? | 1456 // Is the shared function marked for tier up? |
1450 __ lbz(r8, FieldMemOperand(entry, | 1457 __ lbz(r8, FieldMemOperand(entry, |
1451 SharedFunctionInfo::kMarkedForTierUpByteOffset)); | 1458 SharedFunctionInfo::kMarkedForTierUpByteOffset)); |
1452 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0); | 1459 __ TestBit(r8, SharedFunctionInfo::kMarkedForTierUpBitWithinByte, r0); |
1453 __ bne(&gotta_call_runtime, cr0); | 1460 __ bne(&gotta_call_runtime, cr0); |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3106 __ CallRuntime(Runtime::kThrowStackOverflow); | 3113 __ CallRuntime(Runtime::kThrowStackOverflow); |
3107 __ bkpt(0); | 3114 __ bkpt(0); |
3108 } | 3115 } |
3109 } | 3116 } |
3110 | 3117 |
3111 #undef __ | 3118 #undef __ |
3112 } // namespace internal | 3119 } // namespace internal |
3113 } // namespace v8 | 3120 } // namespace v8 |
3114 | 3121 |
3115 #endif // V8_TARGET_ARCH_PPC | 3122 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |