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