Changeset 251886 in webkit for trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
- Timestamp:
- Oct 31, 2019, 3:32:52 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r251556 r251886 1 # Copyr sght (C) 2011-2019 Apple Inc. All rights reserved.1 # Copyright (C) 2011-2019 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 185 185 const MetadataOffsetTable16Offset = 0 186 186 const MetadataOffsetTable32Offset = constexpr UnlinkedMetadataTable::s_offset16TableSize 187 const NumberOfJSOpcodeIDs = constexpr numOpcodeIDs 187 188 188 189 # Some value representation constants. … … 313 314 end 314 315 315 macro dispatchOp(size, opcodeName)316 macro genericDispatchOp(dispatch, size, opcodeName) 316 317 macro dispatchNarrow() 317 318 dispatch(constexpr %opcodeName%_length) … … 328 329 size(dispatchNarrow, dispatchWide16, dispatchWide32, macro (dispatch) dispatch() end) 329 330 end 331 332 macro dispatchOp(size, opcodeName) 333 genericDispatchOp(dispatch, size, opcodeName) 334 end 335 330 336 331 337 macro getu(size, opcodeStruct, fieldName, dst) … … 364 370 end 365 371 366 macro jumpImpl( targetOffsetReg)372 macro jumpImpl(dispatchIndirect, targetOffsetReg) 367 373 btiz targetOffsetReg, .outOfLineJumpTarget 368 374 dispatchIndirect(targetOffsetReg) … … 376 382 prologue() 377 383 fn(narrow) 384 if ASSERT_ENABLED 385 break 386 break 387 end 378 388 379 389 # FIXME: We cannot enable wide16 bytecode in Windows CLoop. With MSVC, as CLoop::execute gets larger code … … 385 395 prologue() 386 396 fn(wide16) 397 if ASSERT_ENABLED 398 break 399 break 400 end 387 401 end 388 402 … … 390 404 prologue() 391 405 fn(wide32) 406 if ASSERT_ENABLED 407 break 408 break 409 end 392 410 end 393 411 … … 433 451 macro jump(fieldName) 434 452 get(fieldName, t0) 435 jumpImpl( t0)453 jumpImpl(dispatchIndirect, t0) 436 454 end 437 455 … … 558 576 559 577 macro assert(assertion) 578 if ASSERT_ENABLED 579 assertion(.ok) 580 crash() 581 .ok: 582 end 583 end 584 585 macro assert_with(assertion, crash) 560 586 if ASSERT_ENABLED 561 587 assertion(.ok) … … 782 808 end 783 809 810 macro copyCalleeSavesToEntryFrameCalleeSavesBuffer(entryFrame) 811 if ARM64 or ARM64E or X86_64 or X86_64_WIN or ARMv7 or MIPS 812 vmEntryRecord(entryFrame, entryFrame) 813 leap VMEntryRecord::calleeSaveRegistersBuffer[entryFrame], entryFrame 814 if ARM64 or ARM64E 815 storeq csr0, [entryFrame] 816 storeq csr1, 8[entryFrame] 817 storeq csr2, 16[entryFrame] 818 storeq csr3, 24[entryFrame] 819 storeq csr4, 32[entryFrame] 820 storeq csr5, 40[entryFrame] 821 storeq csr6, 48[entryFrame] 822 storeq csr7, 56[entryFrame] 823 storeq csr8, 64[entryFrame] 824 storeq csr9, 72[entryFrame] 825 stored csfr0, 80[entryFrame] 826 stored csfr1, 88[entryFrame] 827 stored csfr2, 96[entryFrame] 828 stored csfr3, 104[entryFrame] 829 stored csfr4, 112[entryFrame] 830 stored csfr5, 120[entryFrame] 831 stored csfr6, 128[entryFrame] 832 stored csfr7, 136[entryFrame] 833 elsif X86_64 834 storeq csr0, [entryFrame] 835 storeq csr1, 8[entryFrame] 836 storeq csr2, 16[entryFrame] 837 storeq csr3, 24[entryFrame] 838 storeq csr4, 32[entryFrame] 839 elsif X86_64_WIN 840 storeq csr0, [entryFrame] 841 storeq csr1, 8[entryFrame] 842 storeq csr2, 16[entryFrame] 843 storeq csr3, 24[entryFrame] 844 storeq csr4, 32[entryFrame] 845 storeq csr5, 40[entryFrame] 846 storeq csr6, 48[entryFrame] 847 elsif ARMv7 or MIPS 848 storep csr0, [entryFrame] 849 end 850 end 851 end 852 784 853 macro copyCalleeSavesToVMEntryFrameCalleeSavesBuffer(vm, temp) 785 854 if ARM64 or ARM64E or X86_64 or X86_64_WIN or ARMv7 or MIPS 786 855 loadp VM::topEntryFrame[vm], temp 787 vmEntryRecord(temp, temp) 788 leap VMEntryRecord::calleeSaveRegistersBuffer[temp], temp 789 if ARM64 or ARM64E 790 storeq csr0, [temp] 791 storeq csr1, 8[temp] 792 storeq csr2, 16[temp] 793 storeq csr3, 24[temp] 794 storeq csr4, 32[temp] 795 storeq csr5, 40[temp] 796 storeq csr6, 48[temp] 797 storeq csr7, 56[temp] 798 storeq csr8, 64[temp] 799 storeq csr9, 72[temp] 800 stored csfr0, 80[temp] 801 stored csfr1, 88[temp] 802 stored csfr2, 96[temp] 803 stored csfr3, 104[temp] 804 stored csfr4, 112[temp] 805 stored csfr5, 120[temp] 806 stored csfr6, 128[temp] 807 stored csfr7, 136[temp] 808 elsif X86_64 809 storeq csr0, [temp] 810 storeq csr1, 8[temp] 811 storeq csr2, 16[temp] 812 storeq csr3, 24[temp] 813 storeq csr4, 32[temp] 814 elsif X86_64_WIN 815 storeq csr0, [temp] 816 storeq csr1, 8[temp] 817 storeq csr2, 16[temp] 818 storeq csr3, 24[temp] 819 storeq csr4, 32[temp] 820 storeq csr5, 40[temp] 821 storeq csr6, 48[temp] 822 elsif ARMv7 or MIPS 823 storep csr0, [temp] 824 end 856 copyCalleeSavesToEntryFrameCalleeSavesBuffer(temp) 825 857 end 826 858 end … … 1156 1188 end 1157 1189 codeBlockGetter(t1) 1190 codeBlockSetter(t1) 1158 1191 if not (C_LOOP or C_LOOP_WIN) 1159 1192 baddis 5, CodeBlock::m_llintExecuteCounter + BaselineExecutionCounter::m_counter[t1], .continue … … 1185 1218 jmp r0, JSEntryPtrTag 1186 1219 .recover: 1187 codeBlockGetter(t1)1220 notFunctionCodeBlockGetter(t1) 1188 1221 .continue: 1189 1222 end 1190 1191 codeBlockSetter(t1)1192 1223 1193 1224 preserveCalleeSavesUsedByLLInt() … … 1230 1261 # Stack check slow path returned that the stack was ok. 1231 1262 # Since they were clobbered, need to get CodeBlock and new sp 1232 codeBlockGetter(t1)1263 notFunctionCodeBlockGetter(t1) 1233 1264 getFrameRegisterSizeForCodeBlock(t1, t0) 1234 1265 subp cfr, t0, t0 … … 1372 1403 crash() 1373 1404 else 1374 macro initPCRelative( pcBase)1405 macro initPCRelative(kind, pcBase) 1375 1406 if X86_64 or X86_64_WIN or X86 or X86_WIN 1376 call _ relativePCBase1377 _ relativePCBase:1407 call _%kind%_relativePCBase 1408 _%kind%_relativePCBase: 1378 1409 pop pcBase 1379 1410 elsif ARM64 or ARM64E 1380 1411 elsif ARMv7 1381 _ relativePCBase:1412 _%kind%_relativePCBase: 1382 1413 move pc, pcBase 1383 1414 subp 3, pcBase # Need to back up the PC and set the Thumb2 bit 1384 1415 elsif MIPS 1385 la _ relativePCBase, pcBase1416 la _%kind%_relativePCBase, pcBase 1386 1417 setcallreg pcBase # needed to set $t9 to the right value for the .cpload created by the label. 1387 _relativePCBase: 1388 end 1389 end 1390 1391 # The PC base is in t3, as this is what _llint_entry leaves behind through 1392 # initPCRelative(t3) 1393 macro setEntryAddress(index, label) 1394 setEntryAddressCommon(index, label, a0) 1395 end 1396 1397 macro setEntryAddressWide16(index, label) 1398 setEntryAddressCommon(index, label, a1) 1399 end 1400 1401 macro setEntryAddressWide32(index, label) 1402 setEntryAddressCommon(index, label, a2) 1403 end 1404 1405 macro setEntryAddressCommon(index, label, map) 1406 if X86_64 1407 leap (label - _relativePCBase)[t3], t4 1408 move index, t5 1409 storep t4, [map, t5, 8] 1410 elsif X86_64_WIN 1411 leap (label - _relativePCBase)[t3], t4 1412 move index, t0 1413 storep t4, [map, t0, 8] 1414 elsif X86 or X86_WIN 1415 leap (label - _relativePCBase)[t3], t4 1416 move index, t5 1417 storep t4, [map, t5, 4] 1418 elsif ARM64 or ARM64E 1419 pcrtoaddr label, t3 1420 move index, t4 1421 storep t3, [map, t4, PtrSize] 1422 elsif ARMv7 1423 mvlbl (label - _relativePCBase), t4 1424 addp t4, t3, t4 1425 move index, t5 1426 storep t4, [map, t5, 4] 1427 elsif MIPS 1428 la label, t4 1429 la _relativePCBase, t3 1430 subp t3, t4 1431 addp t4, t3, t4 1432 move index, t5 1433 storep t4, [map, t5, 4] 1434 end 1435 end 1436 1437 global _llint_entry 1418 _%kind%_relativePCBase: 1419 end 1420 end 1421 1422 # The PC base is in t3, as this is what _llint_entry leaves behind through 1423 # initPCRelative(t3) 1424 macro setEntryAddressCommon(kind, index, label, map) 1425 if X86_64 1426 leap (label - _%kind%_relativePCBase)[t3], t4 1427 move index, t5 1428 storep t4, [map, t5, 8] 1429 elsif X86_64_WIN 1430 leap (label - _%kind%_relativePCBase)[t3], t4 1431 move index, t0 1432 storep t4, [map, t0, 8] 1433 elsif X86 or X86_WIN 1434 leap (label - _%kind%_relativePCBase)[t3], t4 1435 move index, t5 1436 storep t4, [map, t5, 4] 1437 elsif ARM64 or ARM64E 1438 pcrtoaddr label, t3 1439 move index, t4 1440 storep t3, [map, t4, PtrSize] 1441 elsif ARMv7 1442 mvlbl (label - _%kind%_relativePCBase), t4 1443 addp t4, t3, t4 1444 move index, t5 1445 storep t4, [map, t5, 4] 1446 elsif MIPS 1447 la label, t4 1448 la _%kind%_relativePCBase, t3 1449 subp t3, t4 1450 addp t4, t3, t4 1451 move index, t5 1452 storep t4, [map, t5, 4] 1453 end 1454 end 1455 1456 1457 1458 macro includeEntriesAtOffset(kind, fn) 1459 macro setEntryAddress(index, label) 1460 setEntryAddressCommon(kind, index, label, a0) 1461 end 1462 1463 macro setEntryAddressWide16(index, label) 1464 setEntryAddressCommon(kind, index, label, a1) 1465 end 1466 1467 macro setEntryAddressWide32(index, label) 1468 setEntryAddressCommon(kind, index, label, a2) 1469 end 1470 1471 fn() 1472 end 1473 1474 1475 macro entry(kind, initialize) 1476 global _%kind%_entry 1477 _%kind%_entry: 1478 functionPrologue() 1479 pushCalleeSaves() 1480 if X86 or X86_WIN 1481 loadp 20[sp], a0 1482 loadp 24[sp], a1 1483 loadp 28[sp], a2 1484 end 1485 1486 initPCRelative(kind, t3) 1487 1488 # Include generated bytecode initialization file. 1489 includeEntriesAtOffset(kind, initialize) 1490 popCalleeSaves() 1491 functionEpilogue() 1492 ret 1493 end 1494 1438 1495 # Entry point for the llint to initialize. 1439 _llint_entry: 1440 functionPrologue() 1441 pushCalleeSaves() 1442 if X86 or X86_WIN 1443 loadp 20[sp], a0 1444 loadp 24[sp], a1 1445 loadp 28[sp], a2 1446 end 1447 1448 initPCRelative(t3) 1449 1450 # Include generated bytecode initialization file. 1496 entry(llint, macro() 1451 1497 include InitBytecodes 1452 1453 popCalleeSaves() 1454 functionEpilogue() 1455 ret 1456 end 1498 end) 1499 1500 end // not (C_LOOP or C_LOOP_WIN) 1457 1501 1458 1502 _llint_op_wide16: … … 1463 1507 1464 1508 macro noWide(label) 1465 _ llint_%label%_wide16:1509 _%label%_wide16: 1466 1510 crash() 1467 1511 1468 _ llint_%label%_wide32:1512 _%label%_wide32: 1469 1513 crash() 1470 1514 end 1471 1515 1472 noWide( op_wide16)1473 noWide( op_wide32)1474 noWide( op_enter)1516 noWide(llint_op_wide16) 1517 noWide(llint_op_wide32) 1518 noWide(llint_op_enter) 1475 1519 1476 1520 op(llint_program_prologue, macro () … … 1971 2015 end 1972 2016 end 2017 2018 if WEBASSEMBLY 2019 2020 entry(wasm, macro() 2021 include InitWasm 2022 end) 2023 2024 macro wasmScope() 2025 # Wrap the script in a macro since it overwrites some of the LLInt macros, 2026 # but we don't want to interfere with the LLInt opcodes 2027 include WebAssembly 2028 end 2029 wasmScope() 2030 2031 else 2032 2033 # These need to be defined even when WebAssembly is disabled 2034 op(wasm_function_prologue, macro () 2035 crash() 2036 end) 2037 2038 op(wasm_function_prologue_no_tls, macro () 2039 crash() 2040 end) 2041 2042 end
Note:
See TracChangeset
for help on using the changeset viewer.