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