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