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