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