From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- js/src/jit-test/tests/Set/bug1729269.js | 2 - js/src/jit-test/tests/arguments/1883837.js | 10 ++ js/src/jit-test/tests/arguments/argumentsNaming.js | 3 + js/src/jit-test/tests/arrays/from-async-oom.js | 2 - js/src/jit-test/tests/asm.js/bug1219954.js | 2 +- js/src/jit-test/tests/asm.js/bug1385428.js | 2 - js/src/jit-test/tests/asm.js/bug1421565.js | 2 +- .../oom-helper-thread-plus-validation-error.js | 2 - js/src/jit-test/tests/asm.js/oom-helper-thread.js | 2 +- js/src/jit-test/tests/asm.js/testBug1255954.js | 2 +- js/src/jit-test/tests/atomics/basic-tests.js | 20 +++ js/src/jit-test/tests/auto-regress/bug1263558.js | 2 +- js/src/jit-test/tests/auto-regress/bug1263865.js | 2 - js/src/jit-test/tests/auto-regress/bug1263879.js | 2 - js/src/jit-test/tests/auto-regress/bug1264823.js | 2 - js/src/jit-test/tests/auto-regress/bug1268034.js | 2 - js/src/jit-test/tests/auto-regress/bug1269074.js | 2 +- js/src/jit-test/tests/auto-regress/bug1375446.js | 2 +- js/src/jit-test/tests/auto-regress/bug1462341.js | 2 +- js/src/jit-test/tests/auto-regress/bug1466626-1.js | 2 - js/src/jit-test/tests/auto-regress/bug1466626-2.js | 2 - js/src/jit-test/tests/auto-regress/bug1466626-3.js | 2 - js/src/jit-test/tests/auto-regress/bug1466626-4.js | 2 - js/src/jit-test/tests/auto-regress/bug1562102.js | 2 +- js/src/jit-test/tests/auto-regress/bug1652148.js | 2 - js/src/jit-test/tests/auto-regress/bug1652153.js | 2 - js/src/jit-test/tests/auto-regress/bug1670378.js | 2 +- js/src/jit-test/tests/auto-regress/bug1791401.js | 2 - js/src/jit-test/tests/auto-regress/bug1798883.js | 4 +- js/src/jit-test/tests/auto-regress/bug1879688.js | 2 - js/src/jit-test/tests/baseline/bug1209585.js | 2 +- js/src/jit-test/tests/baseline/bug1344334.js | 2 - js/src/jit-test/tests/baseline/bug1491337.js | 2 - js/src/jit-test/tests/baseline/bug1491350.js | 2 - js/src/jit-test/tests/basic/bug-1198090.js | 2 +- js/src/jit-test/tests/basic/bug-1271507.js | 2 +- js/src/jit-test/tests/basic/bug-1665583.js | 2 - js/src/jit-test/tests/basic/bug1207863.js | 2 +- js/src/jit-test/tests/basic/bug1219128-1.js | 2 - js/src/jit-test/tests/basic/bug1219128-2.js | 2 - js/src/jit-test/tests/basic/bug1219128-3.js | 2 - js/src/jit-test/tests/basic/bug1219128-4.js | 2 - js/src/jit-test/tests/basic/bug1219128-5.js | 2 - js/src/jit-test/tests/basic/bug1219128-6.js | 2 - js/src/jit-test/tests/basic/bug1219128-7.js | 2 +- js/src/jit-test/tests/basic/bug1219128-8.js | 2 - js/src/jit-test/tests/basic/bug1234414.js | 2 - js/src/jit-test/tests/basic/bug1240502.js | 1 - js/src/jit-test/tests/basic/bug1263868.js | 1 - js/src/jit-test/tests/basic/bug1264954.js | 1 - js/src/jit-test/tests/basic/bug1265693.js | 1 - js/src/jit-test/tests/basic/bug1278839.js | 1 - js/src/jit-test/tests/basic/bug1296249.js | 2 +- js/src/jit-test/tests/basic/bug1300904.js | 1 - js/src/jit-test/tests/basic/bug1316557.js | 1 + js/src/jit-test/tests/basic/bug1344265.js | 2 +- js/src/jit-test/tests/basic/bug1348407.js | 1 - js/src/jit-test/tests/basic/bug1411294.js | 1 - js/src/jit-test/tests/basic/bug1447996.js | 2 - js/src/jit-test/tests/basic/bug1459258.js | 1 - js/src/jit-test/tests/basic/bug1493627.js | 1 - js/src/jit-test/tests/basic/bug1516406.js | 1 - js/src/jit-test/tests/basic/bug1532265.js | 2 +- js/src/jit-test/tests/basic/bug1548759-1.js | 1 - js/src/jit-test/tests/basic/bug1548759-2.js | 1 - js/src/jit-test/tests/basic/bug1574725.js | 2 +- js/src/jit-test/tests/basic/bug1644839-2.js | 1 - js/src/jit-test/tests/basic/bug1644839.js | 1 - js/src/jit-test/tests/basic/bug1666856.js | 2 - js/src/jit-test/tests/basic/bug1877586.js | 2 +- js/src/jit-test/tests/basic/bug1883828.js | 5 + js/src/jit-test/tests/basic/bug1884706.js | 5 + js/src/jit-test/tests/basic/date-getLocale-oom.js | 2 - .../tests/basic/date-late-weekday-warning.js | 34 ----- .../tests/basic/dictionary-add-prop-oom.js | 1 - js/src/jit-test/tests/basic/dumpValue.js | 4 +- js/src/jit-test/tests/basic/inflate-oom.js | 1 - .../basic/property-error-message-fix-disabled.js | 2 +- .../tests/basic/property-error-message-fix.js | 2 +- ...g-substring-latin1rope-with-twobyte-children.js | 12 ++ js/src/jit-test/tests/basic/testBug756919.js | 1 - js/src/jit-test/tests/basic/testDetach.js | 23 +++ .../jit-test/tests/basic/testNativeArgsRooting.js | 1 - js/src/jit-test/tests/basic/testNeutering.js | 23 --- js/src/jit-test/tests/bug1636306.js | 2 +- js/src/jit-test/tests/bug1681258.js | 2 +- js/src/jit-test/tests/bug1787730.js | 2 +- .../tests/bug1878098-serialization-log-oom.js | 8 ++ .../resizable-dataview-bytelength-with-sab.js | 29 ++++ .../dataview/resizable-dataview-bytelength.js | 43 ++++++ .../dataview/resizable-dataview-byteoffset-sab.js | 43 ++++++ .../dataview/resizable-dataview-byteoffset.js | 67 +++++++++ .../resizable-dataview-get-elem-with-sab.js | 48 +++++++ .../tests/dataview/resizable-dataview-get-elem.js | 48 +++++++ .../resizable-dataview-set-elem-with-sab.js | 47 ++++++ .../tests/dataview/resizable-dataview-set-elem.js | 47 ++++++ .../tests/debug/Debugger-findScripts-26.js | 1 - .../tests/debug/Memory-drainAllocationsLog-18.js | 2 - .../jit-test/tests/debug/Memory-takeCensus-06.js | 26 ++++ .../tests/debug/Object-getPromiseReactions-07.js | 14 ++ .../tests/debug/Object-isSameNativeWithJitInfo.js | 32 +++++ js/src/jit-test/tests/debug/breakpoint-oom-01.js | 2 +- js/src/jit-test/tests/debug/bug-1238610.js | 2 +- js/src/jit-test/tests/debug/bug-1248162.js | 2 +- js/src/jit-test/tests/debug/bug-1260725.js | 2 - js/src/jit-test/tests/debug/bug-1565275.js | 2 - js/src/jit-test/tests/debug/bug-1576862-2.js | 1 - js/src/jit-test/tests/debug/bug-1584195.js | 1 - js/src/jit-test/tests/debug/bug1216261.js | 2 +- js/src/jit-test/tests/debug/bug1219905.js | 2 +- js/src/jit-test/tests/debug/bug1240546.js | 2 +- js/src/jit-test/tests/debug/bug1240803.js | 2 +- js/src/jit-test/tests/debug/bug1242111.js | 2 +- js/src/jit-test/tests/debug/bug1245862.js | 2 +- js/src/jit-test/tests/debug/bug1251919.js | 2 - js/src/jit-test/tests/debug/bug1254123.js | 2 - js/src/jit-test/tests/debug/bug1254190.js | 2 +- js/src/jit-test/tests/debug/bug1254578.js | 2 - js/src/jit-test/tests/debug/bug1264961.js | 2 +- js/src/jit-test/tests/debug/bug1272908.js | 2 +- js/src/jit-test/tests/debug/bug1370905.js | 2 +- js/src/jit-test/tests/debug/bug1404710.js | 1 - js/src/jit-test/tests/debug/bug1434391.js | 2 - js/src/jit-test/tests/debug/bug1647309.js | 2 - js/src/jit-test/tests/debug/bug1878511.js | 1 - js/src/jit-test/tests/debug/job-queue-04.js | 1 - js/src/jit-test/tests/debug/wasm-14.js | 2 +- js/src/jit-test/tests/debug/wasm-15.js | 2 +- js/src/jit-test/tests/fields/private-proxy-oom.js | 3 +- js/src/jit-test/tests/fuses/with.js | 9 ++ js/src/jit-test/tests/gc/bug-1108007.js | 2 +- js/src/jit-test/tests/gc/bug-1155455.js | 2 +- js/src/jit-test/tests/gc/bug-1161968.js | 2 - js/src/jit-test/tests/gc/bug-1165966.js | 2 +- js/src/jit-test/tests/gc/bug-1171909.js | 2 - js/src/jit-test/tests/gc/bug-1175755.js | 2 +- js/src/jit-test/tests/gc/bug-1191576.js | 2 +- js/src/jit-test/tests/gc/bug-1206677.js | 2 +- js/src/jit-test/tests/gc/bug-1208994.js | 2 - js/src/jit-test/tests/gc/bug-1209001.js | 2 - js/src/jit-test/tests/gc/bug-1210607.js | 2 +- js/src/jit-test/tests/gc/bug-1214006.js | 2 +- js/src/jit-test/tests/gc/bug-1214781.js | 2 +- js/src/jit-test/tests/gc/bug-1214846.js | 2 +- js/src/jit-test/tests/gc/bug-1215363-1.js | 2 - js/src/jit-test/tests/gc/bug-1215363-2.js | 2 - js/src/jit-test/tests/gc/bug-1215363-3.js | 2 - js/src/jit-test/tests/gc/bug-1216607.js | 2 - js/src/jit-test/tests/gc/bug-1221359.js | 2 - js/src/jit-test/tests/gc/bug-1221747.js | 2 +- js/src/jit-test/tests/gc/bug-1223021.js | 2 - js/src/jit-test/tests/gc/bug-1224710.js | 2 - js/src/jit-test/tests/gc/bug-1226896.js | 2 +- js/src/jit-test/tests/gc/bug-1231386.js | 2 +- js/src/jit-test/tests/gc/bug-1232386.js | 2 +- js/src/jit-test/tests/gc/bug-1234410.js | 2 - js/src/jit-test/tests/gc/bug-1236473.js | 2 - js/src/jit-test/tests/gc/bug-1238555.js | 2 - js/src/jit-test/tests/gc/bug-1238575-2.js | 2 - js/src/jit-test/tests/gc/bug-1238575.js | 2 +- js/src/jit-test/tests/gc/bug-1238582.js | 2 - js/src/jit-test/tests/gc/bug-1240503.js | 2 - js/src/jit-test/tests/gc/bug-1240527.js | 2 +- js/src/jit-test/tests/gc/bug-1241731.js | 2 - js/src/jit-test/tests/gc/bug-1242812.js | 2 - js/src/jit-test/tests/gc/bug-1245520.js | 2 - js/src/jit-test/tests/gc/bug-1252329.js | 2 +- js/src/jit-test/tests/gc/bug-1253124.js | 2 - js/src/jit-test/tests/gc/bug-1259306.js | 2 - js/src/jit-test/tests/gc/bug-1261329.js | 2 +- js/src/jit-test/tests/gc/bug-1263862.js | 2 - js/src/jit-test/tests/gc/bug-1263871.js | 2 - js/src/jit-test/tests/gc/bug-1263884.js | 2 - js/src/jit-test/tests/gc/bug-1271110.js | 2 - js/src/jit-test/tests/gc/bug-1280588.js | 2 - js/src/jit-test/tests/gc/bug-1282986.js | 2 - js/src/jit-test/tests/gc/bug-1287399.js | 2 +- js/src/jit-test/tests/gc/bug-1287869.js | 2 - js/src/jit-test/tests/gc/bug-1292564.js | 2 +- js/src/jit-test/tests/gc/bug-1298356.js | 2 - js/src/jit-test/tests/gc/bug-1303015.js | 2 +- js/src/jit-test/tests/gc/bug-1305220.js | 2 +- js/src/jit-test/tests/gc/bug-1310589.js | 2 - js/src/jit-test/tests/gc/bug-1315946.js | 2 - js/src/jit-test/tests/gc/bug-1325551.js | 2 - js/src/jit-test/tests/gc/bug-1340010.js | 2 +- js/src/jit-test/tests/gc/bug-1384047.js | 3 +- js/src/jit-test/tests/gc/bug-1401141.js | 2 +- js/src/jit-test/tests/gc/bug-1411302.js | 2 - js/src/jit-test/tests/gc/bug-1435295.js | 2 +- js/src/jit-test/tests/gc/bug-1449887.js | 2 - js/src/jit-test/tests/gc/bug-1456536.js | 2 - js/src/jit-test/tests/gc/bug-1462337.js | 2 - js/src/jit-test/tests/gc/bug-1472734.js | 2 +- js/src/jit-test/tests/gc/bug-1490042.js | 2 +- js/src/jit-test/tests/gc/bug-1530643.js | 2 +- js/src/jit-test/tests/gc/bug-1556155.js | 1 - js/src/jit-test/tests/gc/bug-1568119.js | 2 - js/src/jit-test/tests/gc/bug-1574877.js | 2 - js/src/jit-test/tests/gc/bug-1648901.js | 2 - js/src/jit-test/tests/gc/bug-1654186.js | 2 +- js/src/jit-test/tests/gc/bug-1657554.js | 1 - js/src/jit-test/tests/gc/bug-1660293.js | 2 - js/src/jit-test/tests/gc/bug-1689039.js | 2 - js/src/jit-test/tests/gc/bug-1692221.js | 2 +- js/src/jit-test/tests/gc/bug-1791975.js | 2 - js/src/jit-test/tests/gc/bug-1802478.js | 2 - js/src/jit-test/tests/gc/bug-1804629.js | 2 +- js/src/jit-test/tests/gc/bug-1865597.js | 2 - js/src/jit-test/tests/gc/bug-1870925.js | 14 ++ js/src/jit-test/tests/gc/bug-1871186.js | 2 +- js/src/jit-test/tests/gc/bug-1877406.js | 2 +- js/src/jit-test/tests/gc/bug-1880870.js | 6 + js/src/jit-test/tests/gc/bug-1881417.js | 12 ++ js/src/jit-test/tests/gc/bug-1884746.js | 7 + js/src/jit-test/tests/gc/bug-978802.js | 2 - js/src/jit-test/tests/gc/bug1246607.js | 2 +- js/src/jit-test/tests/gc/bug1326343-gcstats.js | 2 - js/src/jit-test/tests/gc/bug1337324.js | 1 - js/src/jit-test/tests/gc/bug1471949.js | 2 +- js/src/jit-test/tests/gc/bug1704451.js | 2 - .../jit-test/tests/gc/finalizationRegistry-oom1.js | 2 - .../jit-test/tests/gc/finalizationRegistry-oom2.js | 1 - .../jit-test/tests/gc/finalizationRegistry-oom3.js | 1 - .../jit-test/tests/gc/finalizationRegistry-oom4.js | 1 - js/src/jit-test/tests/gc/gcparam.js | 7 +- js/src/jit-test/tests/gc/incremental-compacting.js | 2 - js/src/jit-test/tests/gc/oomInArrayProtoTest.js | 2 - js/src/jit-test/tests/gc/oomInByteSize.js | 2 - js/src/jit-test/tests/gc/oomInDebugger.js | 2 - js/src/jit-test/tests/gc/oomInDtoa.js | 2 - .../tests/gc/oomInExceptionHandlerBailout.js | 1 - js/src/jit-test/tests/gc/oomInFindPath.js | 2 - js/src/jit-test/tests/gc/oomInFormatStackDump.js | 2 - .../tests/gc/oomInGetJumpLabelForBranch.js | 2 - js/src/jit-test/tests/gc/oomInNewGlobal.js | 2 - js/src/jit-test/tests/gc/oomInOffTheadCompile.js | 2 +- js/src/jit-test/tests/gc/oomInOffTheadCompile2.js | 2 +- js/src/jit-test/tests/gc/oomInOffTheadCompile3.js | 2 +- js/src/jit-test/tests/gc/oomInParseAsmJS.js | 2 - js/src/jit-test/tests/gc/oomInParseFunction.js | 2 - js/src/jit-test/tests/gc/oomInRegExp.js | 2 - js/src/jit-test/tests/gc/oomInRegExp2.js | 2 - js/src/jit-test/tests/gc/oomInWeakMap.js | 2 - js/src/jit-test/tests/generators/bug1501722.js | 2 - .../tests/ion/array-push-multiple-frozen.js | 2 +- .../tests/ion/array-push-multiple-with-funapply.js | 2 +- js/src/jit-test/tests/ion/array-push-multiple.js | 2 +- js/src/jit-test/tests/ion/bailout-oom-01.js | 2 +- js/src/jit-test/tests/ion/bug1207413.js | 2 - js/src/jit-test/tests/ion/bug1216157.js | 2 +- js/src/jit-test/tests/ion/bug1233331.js | 2 - js/src/jit-test/tests/ion/bug1240521.js | 2 +- js/src/jit-test/tests/ion/bug1269756.js | 2 - js/src/jit-test/tests/ion/bug1284491.js | 2 - js/src/jit-test/tests/ion/bug1394505.js | 2 +- js/src/jit-test/tests/ion/bug1479394.js | 1 - js/src/jit-test/tests/ion/bug1492574.js | 2 - js/src/jit-test/tests/ion/bug1568397.js | 2 +- js/src/jit-test/tests/ion/bug1877357.js | 17 +++ js/src/jit-test/tests/ion/bug1877709.js | 22 +++ .../jit-test/tests/ion/dce-with-rinstructions.js | 22 +++ .../jit-test/tests/ion/scalar-replacement-oom.js | 2 - js/src/jit-test/tests/modules/bug-1219044.js | 2 - js/src/jit-test/tests/modules/bug-1402535.js | 2 - js/src/jit-test/tests/modules/bug-1402649.js | 2 - js/src/jit-test/tests/modules/bug-1420420-3.js | 2 - js/src/jit-test/tests/modules/bug-1435327.js | 2 - js/src/jit-test/tests/modules/bug-1771090.js | 2 +- js/src/jit-test/tests/modules/bug-1802479.js | 2 - js/src/jit-test/tests/modules/bug1670236.js | 1 - js/src/jit-test/tests/modules/bug1685992.js | 4 +- js/src/jit-test/tests/modules/bug1846247.js | 2 +- .../jit-test/tests/modules/dynamic-import-oom.js | 2 +- js/src/jit-test/tests/modules/eval-module-oom.js | 2 - js/src/jit-test/tests/modules/import-meta-oom.js | 2 +- js/src/jit-test/tests/modules/offthread-oom.js | 2 +- js/src/jit-test/tests/parser/bug-1263355-44.js | 2 - js/src/jit-test/tests/parser/bug-1324773-2.js | 2 - js/src/jit-test/tests/parser/bug-1324773.js | 2 - js/src/jit-test/tests/parser/bug-1433014.js | 2 +- js/src/jit-test/tests/parser/bug-1576865-1.js | 1 - js/src/jit-test/tests/parser/bug-1576865-2.js | 1 - js/src/jit-test/tests/parser/bug-1662260.js | 2 - js/src/jit-test/tests/parser/bug-1764737.js | 2 +- js/src/jit-test/tests/parser/bug1461034.js | 1 - js/src/jit-test/tests/parser/bug1547655.js | 2 +- js/src/jit-test/tests/parser/bug1661454.js | 2 - js/src/jit-test/tests/parser/bug1764715.js | 1 - js/src/jit-test/tests/parser/bug1835785.js | 2 +- js/src/jit-test/tests/parser/compile-script.js | 2 - .../tests/parser/off_thread_compile_oom.js | 2 +- js/src/jit-test/tests/parser/warning-oom.js | 2 - js/src/jit-test/tests/profiler/bug1211962.js | 2 +- js/src/jit-test/tests/profiler/bug1231925.js | 2 - js/src/jit-test/tests/profiler/bug1242840.js | 2 - js/src/jit-test/tests/profiler/bug1563889.js | 1 - .../tests/promise/unhandled-rejections-oom.js | 2 +- js/src/jit-test/tests/regexp/CheckRegExpSyntax.js | 2 - js/src/jit-test/tests/regexp/bug-1845715.js | 1 - js/src/jit-test/tests/regexp/bug1640475.js | 2 - js/src/jit-test/tests/regexp/bug1640479.js | 2 - js/src/jit-test/tests/regexp/bug1794317.js | 2 - .../tests/saved-stacks/bug-1445973-quick.js | 2 +- .../tests/saved-stacks/oom-in-save-stack-02.js | 2 +- .../tests/saved-stacks/oom-in-save-stack.js | 2 - js/src/jit-test/tests/self-hosting/oom-delazify.js | 2 +- js/src/jit-test/tests/self-hosting/oom-toplevel.js | 2 +- .../tests/self-test/oom-test-bug1497906.js | 2 +- ...y-barrier-bytelength-with-non-growable-write.js | 102 +++++++++++++ .../growable-sab-memory-barrier-bytelength.js | 67 +++++++++ ...-dataview-bytelength-with-non-growable-write.js | 103 ++++++++++++++ ...wable-sab-memory-barrier-dataview-bytelength.js | 68 +++++++++ ...ypedarray-bytelength-with-non-growable-write.js | 103 ++++++++++++++ ...ble-sab-memory-barrier-typedarray-bytelength.js | 67 +++++++++ ...er-typedarray-length-with-non-growable-write.js | 103 ++++++++++++++ ...rowable-sab-memory-barrier-typedarray-length.js | 67 +++++++++ js/src/jit-test/tests/stream/bug-1513266.js | 2 +- js/src/jit-test/tests/stream/bug-1515816.js | 2 +- .../construct-with-growable-sharedarraybuffer.js | 81 +++++++++++ .../construct-with-resizable-arraybuffer.js | 102 +++++++++++++ .../jit-test/tests/typedarray/ensure-non-inline.js | 12 ++ .../growable-sharedarraybuffer-bytelength.js | 14 ++ .../tests/typedarray/indexed-integer-exotics.js | 8 +- .../oom-allocating-arraybuffer-contents.js | 2 - .../oom-allocating-copying-same-buffer-contents.js | 2 - .../typedarray/resizable-arraybuffer-bytelength.js | 20 +++ .../resizable-buffer-inlined-data-moved.js | 53 +++++++ .../resizable-typedarray-bytelength-with-sab.js | 29 ++++ .../typedarray/resizable-typedarray-bytelength.js | 41 ++++++ .../resizable-typedarray-byteoffset-sab.js | 43 ++++++ .../typedarray/resizable-typedarray-byteoffset.js | 57 ++++++++ .../resizable-typedarray-get-elem-with-sab.js | 49 +++++++ .../typedarray/resizable-typedarray-get-elem.js | 49 +++++++ .../resizable-typedarray-has-elem-with-sab.js | 36 +++++ .../typedarray/resizable-typedarray-has-elem.js | 36 +++++ .../resizable-typedarray-intrinsic-byteOffset.js | 73 ++++++++++ ...izable-typedarray-intrinsic-typedArrayLength.js | 75 ++++++++++ ...-intrinsic-typedArrayLengthZeroOnOutOfBounds.js | 75 ++++++++++ .../resizable-typedarray-length-with-sab.js | 29 ++++ .../typedarray/resizable-typedarray-length.js | 41 ++++++ .../resizable-typedarray-set-elem-with-sab.js | 54 +++++++ .../typedarray/resizable-typedarray-set-elem.js | 54 +++++++ js/src/jit-test/tests/warp/bug1665303.js | 2 +- js/src/jit-test/tests/warp/bug1667685.js | 2 +- js/src/jit-test/tests/warp/bug1668197.js | 1 - js/src/jit-test/tests/warp/bug1871089.js | 13 ++ js/src/jit-test/tests/warp/trial-inline-gc-4.js | 42 ++++++ js/src/jit-test/tests/wasm/binary.js | 8 +- js/src/jit-test/tests/wasm/bug1858423.js | 2 +- .../builtin-modules/integer-gemm/directives.txt | 2 +- .../tests/wasm/builtin-modules/js-string/basic.js | 158 ++++++++++++++------- .../wasm/builtin-modules/js-string/directives.txt | 2 +- .../tests/wasm/builtin-modules/oom-test.js | 2 - .../tests/wasm/directiveless/bug1877358.js | 2 +- js/src/jit-test/tests/wasm/directives.txt | 2 +- .../jit-test/tests/wasm/exceptions/bug-1751699.js | 2 - .../jit-test/tests/wasm/exceptions/bug-1788213.js | 2 - .../jit-test/tests/wasm/exceptions/bug-1791361.js | 2 - .../jit-test/tests/wasm/exceptions/directives.txt | 2 +- .../tests/wasm/exceptions/oom-construct-message.js | 2 - .../wasm/exceptions/oom-create-exception-data.js | 2 - .../jit-test/tests/wasm/exceptions/unreachable.js | 2 +- js/src/jit-test/tests/wasm/exnref/bug1883865.js | 25 ++++ js/src/jit-test/tests/wasm/exnref/directives.txt | 2 +- js/src/jit-test/tests/wasm/extended-const/basic.js | 2 - .../tests/wasm/extended-const/directives.txt | 2 +- .../jit-test/tests/wasm/extended-const/disabled.js | 22 --- .../tests/wasm/extended-const/pathological.js | 2 - js/src/jit-test/tests/wasm/features.js | 24 +--- .../tests/wasm/function-references/as-non-null.js | 2 +- .../tests/wasm/function-references/binary.js | 2 +- .../tests/wasm/function-references/br-non-null.js | 2 +- .../tests/wasm/function-references/br-null.js | 2 +- .../tests/wasm/function-references/call_ref.js | 2 +- .../tests/wasm/function-references/directives.txt | 2 +- .../tests/wasm/function-references/disabled.js | 4 +- .../tests/wasm/function-references/nnl-test.js | 2 +- .../wasm/function-references/non-nullable-table.js | 38 +++-- .../tests/wasm/function-references/non-nullable.js | 2 +- .../wasm/function-references/reftype-parse.js | 32 +---- js/src/jit-test/tests/wasm/gc/arrays.js | 143 +++++++++++++++++++ js/src/jit-test/tests/wasm/gc/binary.js | 16 ++- js/src/jit-test/tests/wasm/gc/bug-1843295.js | 2 +- js/src/jit-test/tests/wasm/gc/bug-1845436.js | 2 +- js/src/jit-test/tests/wasm/gc/bug-1854007.js | 2 +- js/src/jit-test/tests/wasm/gc/bug-1879096.js | 65 +++++++++ .../tests/wasm/gc/call-indirect-subtyping.js | 2 +- js/src/jit-test/tests/wasm/gc/directives.txt | 2 +- js/src/jit-test/tests/wasm/gc/disabled.js | 2 +- js/src/jit-test/tests/wasm/gc/ion-and-baseline.js | 2 +- js/src/jit-test/tests/wasm/gc/limits.js | 69 --------- .../tests/wasm/gc/limits/array-new-fixed.js | 9 ++ js/src/jit-test/tests/wasm/gc/limits/load-mod.js | 5 + .../jit-test/tests/wasm/gc/limits/rec-groups-1.js | 6 + .../jit-test/tests/wasm/gc/limits/rec-groups-2.js | 6 + .../jit-test/tests/wasm/gc/limits/struct-fields.js | 11 ++ .../tests/wasm/gc/limits/subtyping-depth.js | 13 ++ js/src/jit-test/tests/wasm/gc/limits/types-1.js | 6 + js/src/jit-test/tests/wasm/gc/limits/types-2.js | 6 + js/src/jit-test/tests/wasm/gc/limits/types-3.js | 6 + js/src/jit-test/tests/wasm/gc/limits/types-4.js | 6 + js/src/jit-test/tests/wasm/gc/ref.js | 2 +- js/src/jit-test/tests/wasm/gc/regress-1754701.js | 2 +- js/src/jit-test/tests/wasm/gc/regress-1884767.js | 13 ++ js/src/jit-test/tests/wasm/gc/structs.js | 40 ------ js/src/jit-test/tests/wasm/globals.js | 117 ++++++++------- js/src/jit-test/tests/wasm/import-export.js | 7 +- .../tests/wasm/memory-control/directives.txt | 2 +- .../tests/wasm/memory-control/memory-discard.js | 2 +- js/src/jit-test/tests/wasm/memory64/directives.txt | 2 +- .../tests/wasm/multi-memory/directives.txt | 2 +- .../jit-test/tests/wasm/multi-value/directives.txt | 2 +- js/src/jit-test/tests/wasm/oom/breakpoints.js | 2 - js/src/jit-test/tests/wasm/oom/exports.js | 2 - js/src/jit-test/tests/wasm/oom/jsapi-prototype.js | 2 - .../jit-test/tests/wasm/ref-types/directives.txt | 2 +- js/src/jit-test/tests/wasm/regress/bug1708124.js | 1 - js/src/jit-test/tests/wasm/regress/bug1839065.js | 2 +- js/src/jit-test/tests/wasm/regress/bug1839142.js | 2 +- js/src/jit-test/tests/wasm/regress/bug1856733.js | 2 +- js/src/jit-test/tests/wasm/regress/bug1857829.js | 2 +- js/src/jit-test/tests/wasm/regress/bug1858982.js | 2 +- js/src/jit-test/tests/wasm/regress/bug1878673.js | 13 ++ js/src/jit-test/tests/wasm/regress/bug1880770.js | 20 +++ js/src/jit-test/tests/wasm/regress/oom-eval.js | 2 +- js/src/jit-test/tests/wasm/regress/oom-init.js | 2 +- .../tests/wasm/regress/oom-masm-baseline.js | 2 +- .../tests/wasm/regress/oom-wasm-streaming.js | 2 - .../wasm/regress/oom-wasmtexttobinary-block.js | 2 - .../oom-wrong-argument-number-for-import-call.js | 2 - js/src/jit-test/tests/wasm/simd/directives.txt | 2 +- js/src/jit-test/tests/wasm/simd/experimental.js | 36 ++--- .../wasm/spec/exception-handling/directives.txt | 2 +- .../tests/wasm/spec/extended-const/directives.txt | 2 +- .../wasm/spec/function-references/directives.txt | 2 +- .../function-references/return_call_ref.wast.js | 2 +- js/src/jit-test/tests/wasm/spec/gc/directives.txt | 2 +- .../tests/wasm/spec/memory64/directives.txt | 2 +- .../tests/wasm/spec/memory64/memory64.wast.js | 24 ++-- .../tests/wasm/spec/multi-memory/directives.txt | 2 +- .../wasm/spec/multi-memory/harness/harness.js | 9 ++ .../wasm/spec/multi-memory/memory_trap1.wast.js | 36 +++-- .../tests/wasm/spec/relaxed-simd/directives.txt | 2 +- .../jit-test/tests/wasm/spec/spec/directives.txt | 2 +- .../jit-test/tests/wasm/spec/spec/global.wast.js | 2 +- .../jit-test/tests/wasm/spec/spec/memory.wast.js | 18 +-- .../tests/wasm/spec/tail-call/directives.txt | 2 +- .../jit-test/tests/wasm/tail-calls/bug1862473.js | 2 +- .../jit-test/tests/wasm/tail-calls/bug1865044.js | 2 +- .../jit-test/tests/wasm/tail-calls/bug1871605.js | 2 +- .../jit-test/tests/wasm/tail-calls/bug1871606.js | 2 +- .../jit-test/tests/wasm/tail-calls/bug1871951.js | 2 +- .../jit-test/tests/wasm/tail-calls/directives.txt | 2 +- .../jit-test/tests/wasm/tail-calls/exceptions.js | 2 - js/src/jit-test/tests/wasm/tail-calls/gc.js | 2 +- js/src/jit-test/tests/wasm/tail-calls/litmus3.js | 2 +- js/src/jit-test/tests/wasm/tail-calls/litmus4.js | 2 +- js/src/jit-test/tests/wasm/tail-calls/litmus8.js | 2 +- js/src/jit-test/tests/wasm/tail-calls/litmus9.js | 2 +- .../tests/wasm/tail-calls/return_call_ref.js | 2 +- js/src/jit-test/tests/wasm/testing/directives.txt | 1 + .../tests/wasm/testing/global-lossless-invoke.js | 13 ++ js/src/jit-test/tests/xdr/bug1390856.js | 2 +- js/src/jit-test/tests/xdr/bug1427860.js | 2 +- js/src/jit-test/tests/xdr/incremental-oom.js | 2 - js/src/jit-test/tests/xdr/module-oom.js | 2 - js/src/jit-test/tests/xdr/stencil-oom.js | 2 - 468 files changed, 3239 insertions(+), 962 deletions(-) create mode 100644 js/src/jit-test/tests/arguments/1883837.js create mode 100644 js/src/jit-test/tests/arguments/argumentsNaming.js create mode 100644 js/src/jit-test/tests/basic/bug1316557.js create mode 100644 js/src/jit-test/tests/basic/bug1883828.js create mode 100644 js/src/jit-test/tests/basic/bug1884706.js delete mode 100644 js/src/jit-test/tests/basic/date-late-weekday-warning.js create mode 100644 js/src/jit-test/tests/basic/string-substring-latin1rope-with-twobyte-children.js create mode 100644 js/src/jit-test/tests/basic/testDetach.js delete mode 100644 js/src/jit-test/tests/basic/testNeutering.js create mode 100644 js/src/jit-test/tests/bug1878098-serialization-log-oom.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-bytelength-with-sab.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-bytelength.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-byteoffset-sab.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-byteoffset.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-get-elem-with-sab.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-get-elem.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-set-elem-with-sab.js create mode 100644 js/src/jit-test/tests/dataview/resizable-dataview-set-elem.js create mode 100644 js/src/jit-test/tests/debug/Object-getPromiseReactions-07.js create mode 100644 js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js create mode 100644 js/src/jit-test/tests/fuses/with.js create mode 100644 js/src/jit-test/tests/gc/bug-1870925.js create mode 100644 js/src/jit-test/tests/gc/bug-1880870.js create mode 100644 js/src/jit-test/tests/gc/bug-1881417.js create mode 100644 js/src/jit-test/tests/gc/bug-1884746.js create mode 100644 js/src/jit-test/tests/ion/bug1877357.js create mode 100644 js/src/jit-test/tests/ion/bug1877709.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength-with-non-growable-write.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength-with-non-growable-write.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength-with-non-growable-write.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length-with-non-growable-write.js create mode 100644 js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length.js create mode 100644 js/src/jit-test/tests/typedarray/construct-with-growable-sharedarraybuffer.js create mode 100644 js/src/jit-test/tests/typedarray/construct-with-resizable-arraybuffer.js create mode 100644 js/src/jit-test/tests/typedarray/growable-sharedarraybuffer-bytelength.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-arraybuffer-bytelength.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-buffer-inlined-data-moved.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength-with-sab.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset-sab.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem-with-sab.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem-with-sab.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-byteOffset.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLength.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLengthZeroOnOutOfBounds.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-length-with-sab.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-length.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem-with-sab.js create mode 100644 js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem.js create mode 100644 js/src/jit-test/tests/warp/bug1871089.js create mode 100644 js/src/jit-test/tests/warp/trial-inline-gc-4.js create mode 100644 js/src/jit-test/tests/wasm/exnref/bug1883865.js delete mode 100644 js/src/jit-test/tests/wasm/extended-const/disabled.js create mode 100644 js/src/jit-test/tests/wasm/gc/bug-1879096.js delete mode 100644 js/src/jit-test/tests/wasm/gc/limits.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/array-new-fixed.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/load-mod.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/rec-groups-1.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/rec-groups-2.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/struct-fields.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/subtyping-depth.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/types-1.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/types-2.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/types-3.js create mode 100644 js/src/jit-test/tests/wasm/gc/limits/types-4.js create mode 100644 js/src/jit-test/tests/wasm/gc/regress-1884767.js create mode 100644 js/src/jit-test/tests/wasm/regress/bug1878673.js create mode 100644 js/src/jit-test/tests/wasm/regress/bug1880770.js create mode 100644 js/src/jit-test/tests/wasm/testing/directives.txt create mode 100644 js/src/jit-test/tests/wasm/testing/global-lossless-invoke.js (limited to 'js/src/jit-test/tests') diff --git a/js/src/jit-test/tests/Set/bug1729269.js b/js/src/jit-test/tests/Set/bug1729269.js index e97f6d2a12..61a7c0e535 100644 --- a/js/src/jit-test/tests/Set/bug1729269.js +++ b/js/src/jit-test/tests/Set/bug1729269.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var patchSet = new Set(); function checkSet(str) { diff --git a/js/src/jit-test/tests/arguments/1883837.js b/js/src/jit-test/tests/arguments/1883837.js new file mode 100644 index 0000000000..3fb7ac7944 --- /dev/null +++ b/js/src/jit-test/tests/arguments/1883837.js @@ -0,0 +1,10 @@ +let threw = false; +try { + ({ + a: arguments.length + } = 0); +} catch (error) { + assertEq(error instanceof ReferenceError, true); + threw = true; +} +assertEq(threw, true); diff --git a/js/src/jit-test/tests/arguments/argumentsNaming.js b/js/src/jit-test/tests/arguments/argumentsNaming.js new file mode 100644 index 0000000000..7532172873 --- /dev/null +++ b/js/src/jit-test/tests/arguments/argumentsNaming.js @@ -0,0 +1,3 @@ +let arguments = {} +arguments.length = () => { }; +assertEq(arguments.length.name, ""); diff --git a/js/src/jit-test/tests/arrays/from-async-oom.js b/js/src/jit-test/tests/arrays/from-async-oom.js index a68fd33299..5d7ada400f 100644 --- a/js/src/jit-test/tests/arrays/from-async-oom.js +++ b/js/src/jit-test/tests/arrays/from-async-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // Basic Smoke Test async function* asyncGen(n) { for (let i = 0; i < n; i++) { diff --git a/js/src/jit-test/tests/asm.js/bug1219954.js b/js/src/jit-test/tests/asm.js/bug1219954.js index 305369a936..c8553dde74 100644 --- a/js/src/jit-test/tests/asm.js/bug1219954.js +++ b/js/src/jit-test/tests/asm.js/bug1219954.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow "use strict"; let g = (function() { diff --git a/js/src/jit-test/tests/asm.js/bug1385428.js b/js/src/jit-test/tests/asm.js/bug1385428.js index c586ec8f3e..2044b52b96 100644 --- a/js/src/jit-test/tests/asm.js/bug1385428.js +++ b/js/src/jit-test/tests/asm.js/bug1385428.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - loadFile(` try { Array.prototype.splice.call({ get length() { diff --git a/js/src/jit-test/tests/asm.js/bug1421565.js b/js/src/jit-test/tests/asm.js/bug1421565.js index 04ab718305..54719e87f7 100644 --- a/js/src/jit-test/tests/asm.js/bug1421565.js +++ b/js/src/jit-test/tests/asm.js/bug1421565.js @@ -1,4 +1,4 @@ -// |jit-test| --ion-offthread-compile=off; skip-if: !isAsmJSCompilationAvailable() || !('oomTest' in this) +// |jit-test| --ion-offthread-compile=off; skip-if: !isAsmJSCompilationAvailable() load(libdir + "asm.js"); diff --git a/js/src/jit-test/tests/asm.js/oom-helper-thread-plus-validation-error.js b/js/src/jit-test/tests/asm.js/oom-helper-thread-plus-validation-error.js index 2d80e98d3c..71744c40be 100644 --- a/js/src/jit-test/tests/asm.js/oom-helper-thread-plus-validation-error.js +++ b/js/src/jit-test/tests/asm.js/oom-helper-thread-plus-validation-error.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this) - oomAfterAllocations(10, 2); evaluate(`function mod(stdlib, ffi, heap) { "use asm"; diff --git a/js/src/jit-test/tests/asm.js/oom-helper-thread.js b/js/src/jit-test/tests/asm.js/oom-helper-thread.js index 18165c01b3..6e7bfc7fd5 100644 --- a/js/src/jit-test/tests/asm.js/oom-helper-thread.js +++ b/js/src/jit-test/tests/asm.js/oom-helper-thread.js @@ -1,4 +1,4 @@ -// |jit-test| exitstatus: 3; skip-if: !('oomAfterAllocations' in this) +// |jit-test| exitstatus: 3 oomAfterAllocations(50, 2); eval("(function() {'use asm'; function f() { return +pow(.0, .0) })") diff --git a/js/src/jit-test/tests/asm.js/testBug1255954.js b/js/src/jit-test/tests/asm.js/testBug1255954.js index 004136bc18..2e1d38de12 100644 --- a/js/src/jit-test/tests/asm.js/testBug1255954.js +++ b/js/src/jit-test/tests/asm.js/testBug1255954.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow const USE_ASM = '"use asm";'; function asmCompile() { diff --git a/js/src/jit-test/tests/atomics/basic-tests.js b/js/src/jit-test/tests/atomics/basic-tests.js index 3712dd1b6f..97dc2a37af 100644 --- a/js/src/jit-test/tests/atomics/basic-tests.js +++ b/js/src/jit-test/tests/atomics/basic-tests.js @@ -1,3 +1,5 @@ +// |jit-test| --enable-arraybuffer-resizable + // Basic functional tests for the Atomics primitives. // // These do not test atomicity, just that calling and coercions and @@ -562,3 +564,21 @@ function runTests(SharedOrUnsharedArrayBuffer) { runTests(SharedArrayBuffer); runTests(ArrayBuffer); + +if (ArrayBuffer.prototype.resize) { + class ResizableArrayBuffer { + constructor(byteLength = 0) { + return new ArrayBuffer(byteLength, {maxByteLength: byteLength}); + } + } + runTests(ResizableArrayBuffer); +} + +if (SharedArrayBuffer.prototype.grow) { + class GrowableSharedArrayBuffer { + constructor(byteLength = 0) { + return new SharedArrayBuffer(byteLength, {maxByteLength: byteLength}); + } + } + runTests(GrowableSharedArrayBuffer); +} diff --git a/js/src/jit-test/tests/auto-regress/bug1263558.js b/js/src/jit-test/tests/auto-regress/bug1263558.js index 41705977ac..5a4d2df2dd 100644 --- a/js/src/jit-test/tests/auto-regress/bug1263558.js +++ b/js/src/jit-test/tests/auto-regress/bug1263558.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) +// |jit-test| skip-if: !hasFunction.oomTest evalcx(` eval('\ diff --git a/js/src/jit-test/tests/auto-regress/bug1263865.js b/js/src/jit-test/tests/auto-regress/bug1263865.js index e5b11769d9..4ce38d0dd9 100644 --- a/js/src/jit-test/tests/auto-regress/bug1263865.js +++ b/js/src/jit-test/tests/auto-regress/bug1263865.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - loadFile(""); loadFile(""); loadFile("Array.prototype.splice.call(1)"); diff --git a/js/src/jit-test/tests/auto-regress/bug1263879.js b/js/src/jit-test/tests/auto-regress/bug1263879.js index 1baba2dd3e..c2553b3124 100644 --- a/js/src/jit-test/tests/auto-regress/bug1263879.js +++ b/js/src/jit-test/tests/auto-regress/bug1263879.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var lines = ` diff --git a/js/src/jit-test/tests/auto-regress/bug1264823.js b/js/src/jit-test/tests/auto-regress/bug1264823.js index afac37c3c6..5005296dc7 100644 --- a/js/src/jit-test/tests/auto-regress/bug1264823.js +++ b/js/src/jit-test/tests/auto-regress/bug1264823.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - loadFile(""); loadFile(""); loadFile(` function lalala() {} diff --git a/js/src/jit-test/tests/auto-regress/bug1268034.js b/js/src/jit-test/tests/auto-regress/bug1268034.js index 43f2a661fd..f48cbd0278 100644 --- a/js/src/jit-test/tests/auto-regress/bug1268034.js +++ b/js/src/jit-test/tests/auto-regress/bug1268034.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { offThreadCompileToStencil(""); }); diff --git a/js/src/jit-test/tests/auto-regress/bug1269074.js b/js/src/jit-test/tests/auto-regress/bug1269074.js index 6e2cc33035..74d5fde822 100644 --- a/js/src/jit-test/tests/auto-regress/bug1269074.js +++ b/js/src/jit-test/tests/auto-regress/bug1269074.js @@ -1,3 +1,3 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom; skip-if: !hasFunction.oomTest evalcx('oomTest(function() { Array(...""); })', newGlobal()); diff --git a/js/src/jit-test/tests/auto-regress/bug1375446.js b/js/src/jit-test/tests/auto-regress/bug1375446.js index ef8ae4c640..b48475a96b 100644 --- a/js/src/jit-test/tests/auto-regress/bug1375446.js +++ b/js/src/jit-test/tests/auto-regress/bug1375446.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom loadFile(` disassemble(function() { diff --git a/js/src/jit-test/tests/auto-regress/bug1462341.js b/js/src/jit-test/tests/auto-regress/bug1462341.js index 37c4f2129c..3f77b43ba0 100644 --- a/js/src/jit-test/tests/auto-regress/bug1462341.js +++ b/js/src/jit-test/tests/auto-regress/bug1462341.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom loadFile(` switch (0) { diff --git a/js/src/jit-test/tests/auto-regress/bug1466626-1.js b/js/src/jit-test/tests/auto-regress/bug1466626-1.js index f82c4de48e..8815fafc66 100644 --- a/js/src/jit-test/tests/auto-regress/bug1466626-1.js +++ b/js/src/jit-test/tests/auto-regress/bug1466626-1.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { for (var i = 0; i < 10; ++i) { Promise.resolve().then(); diff --git a/js/src/jit-test/tests/auto-regress/bug1466626-2.js b/js/src/jit-test/tests/auto-regress/bug1466626-2.js index 056ea075e2..9c1ce593a8 100644 --- a/js/src/jit-test/tests/auto-regress/bug1466626-2.js +++ b/js/src/jit-test/tests/auto-regress/bug1466626-2.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var globals = []; for (var i = 0; i < 24; ++i) { var g = newGlobal(); diff --git a/js/src/jit-test/tests/auto-regress/bug1466626-3.js b/js/src/jit-test/tests/auto-regress/bug1466626-3.js index bffecfce73..2907e8ce2f 100644 --- a/js/src/jit-test/tests/auto-regress/bug1466626-3.js +++ b/js/src/jit-test/tests/auto-regress/bug1466626-3.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var g = newGlobal(); var i = 0; diff --git a/js/src/jit-test/tests/auto-regress/bug1466626-4.js b/js/src/jit-test/tests/auto-regress/bug1466626-4.js index aa02a3ba08..8efc52727c 100644 --- a/js/src/jit-test/tests/auto-regress/bug1466626-4.js +++ b/js/src/jit-test/tests/auto-regress/bug1466626-4.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var source = "{"; for (var i = 0; i < 120; ++i) source += `function f${i}(){}` diff --git a/js/src/jit-test/tests/auto-regress/bug1562102.js b/js/src/jit-test/tests/auto-regress/bug1562102.js index 78f5ef9010..5efb6fce13 100644 --- a/js/src/jit-test/tests/auto-regress/bug1562102.js +++ b/js/src/jit-test/tests/auto-regress/bug1562102.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; allow-unhandlable-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom; allow-unhandlable-oom oomTest( function() { evaluate(` diff --git a/js/src/jit-test/tests/auto-regress/bug1652148.js b/js/src/jit-test/tests/auto-regress/bug1652148.js index 232957edb6..51a026b92f 100644 --- a/js/src/jit-test/tests/auto-regress/bug1652148.js +++ b/js/src/jit-test/tests/auto-regress/bug1652148.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { new AggregateError([]); }); diff --git a/js/src/jit-test/tests/auto-regress/bug1652153.js b/js/src/jit-test/tests/auto-regress/bug1652153.js index 875949c7ea..0eb4c52f3e 100644 --- a/js/src/jit-test/tests/auto-regress/bug1652153.js +++ b/js/src/jit-test/tests/auto-regress/bug1652153.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - x = "x"; lFile(x); diff --git a/js/src/jit-test/tests/auto-regress/bug1670378.js b/js/src/jit-test/tests/auto-regress/bug1670378.js index da3c1e93dd..ddda1f9710 100644 --- a/js/src/jit-test/tests/auto-regress/bug1670378.js +++ b/js/src/jit-test/tests/auto-regress/bug1670378.js @@ -1,4 +1,4 @@ -// |jit-test| allow-unhandlable-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-unhandlable-oom const otherGlobalNewCompartment = newGlobal({newCompartment: true}); diff --git a/js/src/jit-test/tests/auto-regress/bug1791401.js b/js/src/jit-test/tests/auto-regress/bug1791401.js index 6b3a7a5dbd..27cf95b0c0 100644 --- a/js/src/jit-test/tests/auto-regress/bug1791401.js +++ b/js/src/jit-test/tests/auto-regress/bug1791401.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { var f = Function(` // Don't actually enter the loop. This still causes the original bug and diff --git a/js/src/jit-test/tests/auto-regress/bug1798883.js b/js/src/jit-test/tests/auto-regress/bug1798883.js index 9ebe5daa2e..e0c8b52dd7 100644 --- a/js/src/jit-test/tests/auto-regress/bug1798883.js +++ b/js/src/jit-test/tests/auto-regress/bug1798883.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // String with an initial part which doesn't need to be normalised and a tail // which gets normalised to "\u05E9\u05BC\u05C1". var s = "a".repeat(32) + String.fromCharCode(0xFB2C); @@ -8,4 +6,4 @@ oomTest(function() { // |normalize()| needs to be called at least twice to trigger the bug. s.normalize(); s.normalize(); -}); \ No newline at end of file +}); diff --git a/js/src/jit-test/tests/auto-regress/bug1879688.js b/js/src/jit-test/tests/auto-regress/bug1879688.js index a05ae548b5..fecd582eff 100644 --- a/js/src/jit-test/tests/auto-regress/bug1879688.js +++ b/js/src/jit-test/tests/auto-regress/bug1879688.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - let x = 0; oomTest(function () { let y = x++; diff --git a/js/src/jit-test/tests/baseline/bug1209585.js b/js/src/jit-test/tests/baseline/bug1209585.js index 6873fe37d5..39f6316c26 100644 --- a/js/src/jit-test/tests/baseline/bug1209585.js +++ b/js/src/jit-test/tests/baseline/bug1209585.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: helperThreadCount() === 0 || !('oomAtAllocation' in this) +// |jit-test| skip-if: helperThreadCount() === 0 if ("gczeal" in this) gczeal(0); diff --git a/js/src/jit-test/tests/baseline/bug1344334.js b/js/src/jit-test/tests/baseline/bug1344334.js index 8245148833..b771da02fc 100644 --- a/js/src/jit-test/tests/baseline/bug1344334.js +++ b/js/src/jit-test/tests/baseline/bug1344334.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function f(s) { s + "x"; s.indexOf("y") === 0; diff --git a/js/src/jit-test/tests/baseline/bug1491337.js b/js/src/jit-test/tests/baseline/bug1491337.js index 107507155f..c297d6c9f3 100644 --- a/js/src/jit-test/tests/baseline/bug1491337.js +++ b/js/src/jit-test/tests/baseline/bug1491337.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(new Function(` let kJSEmbeddingMaxTypes = 1000000; let kJSEmbeddingMaxFunctions = 1000000; diff --git a/js/src/jit-test/tests/baseline/bug1491350.js b/js/src/jit-test/tests/baseline/bug1491350.js index 697a39c50c..404ed8bb1e 100644 --- a/js/src/jit-test/tests/baseline/bug1491350.js +++ b/js/src/jit-test/tests/baseline/bug1491350.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(new Function(` var a = ['p', 'q', 'r', 's', 't']; var o = {p:1, q:2, r:3, s:4, t:5}; diff --git a/js/src/jit-test/tests/basic/bug-1198090.js b/js/src/jit-test/tests/basic/bug-1198090.js index 2ee6b5a2ed..d6445639cd 100644 --- a/js/src/jit-test/tests/basic/bug-1198090.js +++ b/js/src/jit-test/tests/basic/bug-1198090.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAtAllocation' in this) +// |jit-test| allow-oom for (let a of [ null, function() {}, function() {}, null, function() {}, function() {}, diff --git a/js/src/jit-test/tests/basic/bug-1271507.js b/js/src/jit-test/tests/basic/bug-1271507.js index 88097aca8d..e053da62e9 100644 --- a/js/src/jit-test/tests/basic/bug-1271507.js +++ b/js/src/jit-test/tests/basic/bug-1271507.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: typeof oomAfterAllocations !== 'function' +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations lfcode = new Array(); oomAfterAllocations(100); loadFile(file); diff --git a/js/src/jit-test/tests/basic/bug-1665583.js b/js/src/jit-test/tests/basic/bug-1665583.js index 012dc1d043..d7350053ef 100644 --- a/js/src/jit-test/tests/basic/bug-1665583.js +++ b/js/src/jit-test/tests/basic/bug-1665583.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function parseModule(source) { offThreadCompileModuleToStencil(source); var stencil = finishOffThreadStencil(); diff --git a/js/src/jit-test/tests/basic/bug1207863.js b/js/src/jit-test/tests/basic/bug1207863.js index ef079a3c29..e452694e99 100644 --- a/js/src/jit-test/tests/basic/bug1207863.js +++ b/js/src/jit-test/tests/basic/bug1207863.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; allow-unhandlable-oom; skip-if: !("oomAtAllocation" in this && "resetOOMFailure" in this) +// |jit-test| allow-oom; allow-unhandlable-oom function oomTest(f) { var i = 1; diff --git a/js/src/jit-test/tests/basic/bug1219128-1.js b/js/src/jit-test/tests/basic/bug1219128-1.js index 7a81d73f0a..4724059bca 100644 --- a/js/src/jit-test/tests/basic/bug1219128-1.js +++ b/js/src/jit-test/tests/basic/bug1219128-1.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - evaluate(` x = evalcx("lazy"); oomTest(function () { diff --git a/js/src/jit-test/tests/basic/bug1219128-2.js b/js/src/jit-test/tests/basic/bug1219128-2.js index 7208fc3260..1a17f5abeb 100644 --- a/js/src/jit-test/tests/basic/bug1219128-2.js +++ b/js/src/jit-test/tests/basic/bug1219128-2.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - a = evalcx("lazy") oomTest(() => a.toString) diff --git a/js/src/jit-test/tests/basic/bug1219128-3.js b/js/src/jit-test/tests/basic/bug1219128-3.js index feca3eb55c..854be23213 100644 --- a/js/src/jit-test/tests/basic/bug1219128-3.js +++ b/js/src/jit-test/tests/basic/bug1219128-3.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - x = evalcx('lazy'); oomTest(function() { x.eval diff --git a/js/src/jit-test/tests/basic/bug1219128-4.js b/js/src/jit-test/tests/basic/bug1219128-4.js index 41f8b9757a..6329b3f198 100644 --- a/js/src/jit-test/tests/basic/bug1219128-4.js +++ b/js/src/jit-test/tests/basic/bug1219128-4.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - x = evalcx("lazy"); oomTest((function() { evalcx("({", x); diff --git a/js/src/jit-test/tests/basic/bug1219128-5.js b/js/src/jit-test/tests/basic/bug1219128-5.js index 30dc56e5ce..9ce2c7ab5c 100644 --- a/js/src/jit-test/tests/basic/bug1219128-5.js +++ b/js/src/jit-test/tests/basic/bug1219128-5.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - x = evalcx("lazy"); oomTest(function() { x.of(new(delete y)); diff --git a/js/src/jit-test/tests/basic/bug1219128-6.js b/js/src/jit-test/tests/basic/bug1219128-6.js index cb9f4c7170..bd02653202 100644 --- a/js/src/jit-test/tests/basic/bug1219128-6.js +++ b/js/src/jit-test/tests/basic/bug1219128-6.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - a = evalcx("lazy") oomTest(function() { a.b diff --git a/js/src/jit-test/tests/basic/bug1219128-7.js b/js/src/jit-test/tests/basic/bug1219128-7.js index 87ec092f87..e5f660cc77 100644 --- a/js/src/jit-test/tests/basic/bug1219128-7.js +++ b/js/src/jit-test/tests/basic/bug1219128-7.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow function main() { const v1 = this.newGlobal(); diff --git a/js/src/jit-test/tests/basic/bug1219128-8.js b/js/src/jit-test/tests/basic/bug1219128-8.js index a957b879dc..d8852b423f 100644 --- a/js/src/jit-test/tests/basic/bug1219128-8.js +++ b/js/src/jit-test/tests/basic/bug1219128-8.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - a = evalcx('lazy') oomTest(() => a < 0) diff --git a/js/src/jit-test/tests/basic/bug1234414.js b/js/src/jit-test/tests/basic/bug1234414.js index 2aeda2c897..5f8af8e0b6 100644 --- a/js/src/jit-test/tests/basic/bug1234414.js +++ b/js/src/jit-test/tests/basic/bug1234414.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { var max = 400; function f(b) { diff --git a/js/src/jit-test/tests/basic/bug1240502.js b/js/src/jit-test/tests/basic/bug1240502.js index 08d6619460..5baed067dc 100644 --- a/js/src/jit-test/tests/basic/bug1240502.js +++ b/js/src/jit-test/tests/basic/bug1240502.js @@ -1,2 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(() => eval(`Array(..."ABC")`)); diff --git a/js/src/jit-test/tests/basic/bug1263868.js b/js/src/jit-test/tests/basic/bug1263868.js index ba678d71d5..6375cfdd65 100644 --- a/js/src/jit-test/tests/basic/bug1263868.js +++ b/js/src/jit-test/tests/basic/bug1263868.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) function g(f, params) { entryPoints(params); } diff --git a/js/src/jit-test/tests/basic/bug1264954.js b/js/src/jit-test/tests/basic/bug1264954.js index e9d6422798..ca1a8fb179 100644 --- a/js/src/jit-test/tests/basic/bug1264954.js +++ b/js/src/jit-test/tests/basic/bug1264954.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) function f(x) { oomTest(() => eval(x)); } diff --git a/js/src/jit-test/tests/basic/bug1265693.js b/js/src/jit-test/tests/basic/bug1265693.js index 9922999d1b..d25713cf97 100644 --- a/js/src/jit-test/tests/basic/bug1265693.js +++ b/js/src/jit-test/tests/basic/bug1265693.js @@ -1,2 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(Function("Function.hasOwnProperty(1.1)")); diff --git a/js/src/jit-test/tests/basic/bug1278839.js b/js/src/jit-test/tests/basic/bug1278839.js index 3756e95d68..cff252cc7a 100644 --- a/js/src/jit-test/tests/basic/bug1278839.js +++ b/js/src/jit-test/tests/basic/bug1278839.js @@ -1,3 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) for (var i=0; i<2; i++) oomTest(() => eval("setJitCompilerOption(eval + Function, 0);")); diff --git a/js/src/jit-test/tests/basic/bug1296249.js b/js/src/jit-test/tests/basic/bug1296249.js index 7c8b7c5df4..c5fb49bdbe 100644 --- a/js/src/jit-test/tests/basic/bug1296249.js +++ b/js/src/jit-test/tests/basic/bug1296249.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow function f(x) { new Int32Array(x); } diff --git a/js/src/jit-test/tests/basic/bug1300904.js b/js/src/jit-test/tests/basic/bug1300904.js index 2274129366..15e62ad818 100644 --- a/js/src/jit-test/tests/basic/bug1300904.js +++ b/js/src/jit-test/tests/basic/bug1300904.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) Object.getOwnPropertyNames(this); oomTest(function() { this[0] = null; diff --git a/js/src/jit-test/tests/basic/bug1316557.js b/js/src/jit-test/tests/basic/bug1316557.js new file mode 100644 index 0000000000..73edb23893 --- /dev/null +++ b/js/src/jit-test/tests/basic/bug1316557.js @@ -0,0 +1 @@ +assertEq(Math.pow(-999, -999), -0); diff --git a/js/src/jit-test/tests/basic/bug1344265.js b/js/src/jit-test/tests/basic/bug1344265.js index 2ffc2f7e5c..da5a882e14 100644 --- a/js/src/jit-test/tests/basic/bug1344265.js +++ b/js/src/jit-test/tests/basic/bug1344265.js @@ -1,3 +1,3 @@ -// |jit-test| allow-unhandlable-oom; allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-unhandlable-oom; allow-oom oomAfterAllocations(1); newString("a", {external: true}); diff --git a/js/src/jit-test/tests/basic/bug1348407.js b/js/src/jit-test/tests/basic/bug1348407.js index 133a49018c..51371fefcd 100644 --- a/js/src/jit-test/tests/basic/bug1348407.js +++ b/js/src/jit-test/tests/basic/bug1348407.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) x = evalcx("lazy"); oomTest(function () { x.eval("1"); diff --git a/js/src/jit-test/tests/basic/bug1411294.js b/js/src/jit-test/tests/basic/bug1411294.js index 327c808bcf..2c748768bc 100644 --- a/js/src/jit-test/tests/basic/bug1411294.js +++ b/js/src/jit-test/tests/basic/bug1411294.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(function() { eval(`var clonebuffer = serialize("abc"); clonebuffer.clonebuffer = "\ diff --git a/js/src/jit-test/tests/basic/bug1447996.js b/js/src/jit-test/tests/basic/bug1447996.js index ec7cc5a25a..82c152ac15 100644 --- a/js/src/jit-test/tests/basic/bug1447996.js +++ b/js/src/jit-test/tests/basic/bug1447996.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('stackTest' in this) - var x = 0; function f() { var s = "abcdef(((((((a|b)a|b)a|b)a|b)a|b)a|b)a|b)" + x; diff --git a/js/src/jit-test/tests/basic/bug1459258.js b/js/src/jit-test/tests/basic/bug1459258.js index d29231a34a..b68ad115a0 100644 --- a/js/src/jit-test/tests/basic/bug1459258.js +++ b/js/src/jit-test/tests/basic/bug1459258.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(function() { return [0, Math.PI, NaN, Infinity, true, false, Symbol(), Math.tan, Reflect, Proxy, print, assertEq, Array, String, Boolean, Number, parseInt, diff --git a/js/src/jit-test/tests/basic/bug1493627.js b/js/src/jit-test/tests/basic/bug1493627.js index ee0525128c..b8952313ff 100644 --- a/js/src/jit-test/tests/basic/bug1493627.js +++ b/js/src/jit-test/tests/basic/bug1493627.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('stackTest' in this) stackTest(function() { eval(`var g = newGlobal(); recomputeWrappers(this, g);`); }); diff --git a/js/src/jit-test/tests/basic/bug1516406.js b/js/src/jit-test/tests/basic/bug1516406.js index 9a513fc1a2..dbee2feacb 100644 --- a/js/src/jit-test/tests/basic/bug1516406.js +++ b/js/src/jit-test/tests/basic/bug1516406.js @@ -1,2 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(() => dumpScopeChain(eval(`b => 1`))); diff --git a/js/src/jit-test/tests/basic/bug1532265.js b/js/src/jit-test/tests/basic/bug1532265.js index 500b6e4a64..bf8416b78d 100644 --- a/js/src/jit-test/tests/basic/bug1532265.js +++ b/js/src/jit-test/tests/basic/bug1532265.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom ignoreUnhandledRejections(); diff --git a/js/src/jit-test/tests/basic/bug1548759-1.js b/js/src/jit-test/tests/basic/bug1548759-1.js index 6e6f795cad..cac4953f06 100644 --- a/js/src/jit-test/tests/basic/bug1548759-1.js +++ b/js/src/jit-test/tests/basic/bug1548759-1.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) (function() { oomTest(async function() { x; diff --git a/js/src/jit-test/tests/basic/bug1548759-2.js b/js/src/jit-test/tests/basic/bug1548759-2.js index 5e0eef54cc..6fad23f92b 100644 --- a/js/src/jit-test/tests/basic/bug1548759-2.js +++ b/js/src/jit-test/tests/basic/bug1548759-2.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(function() { return { x: async function() { diff --git a/js/src/jit-test/tests/basic/bug1574725.js b/js/src/jit-test/tests/basic/bug1574725.js index f7ccb27d92..03cdf897aa 100644 --- a/js/src/jit-test/tests/basic/bug1574725.js +++ b/js/src/jit-test/tests/basic/bug1574725.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 for (let i = 0; i < 15; ++i) { evalInWorker("for (var i = 0; i < 100; i++) {}"); } diff --git a/js/src/jit-test/tests/basic/bug1644839-2.js b/js/src/jit-test/tests/basic/bug1644839-2.js index cf0f7d8981..5c2e06258d 100644 --- a/js/src/jit-test/tests/basic/bug1644839-2.js +++ b/js/src/jit-test/tests/basic/bug1644839-2.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) var code = ` (\`\${key}: \${(args[1]?.toString)?.()}\`) `; diff --git a/js/src/jit-test/tests/basic/bug1644839.js b/js/src/jit-test/tests/basic/bug1644839.js index b83b662358..44fdee1ddf 100644 --- a/js/src/jit-test/tests/basic/bug1644839.js +++ b/js/src/jit-test/tests/basic/bug1644839.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) var code = ` (\`\${key}: \${args[1]?.toString()}\`) `; diff --git a/js/src/jit-test/tests/basic/bug1666856.js b/js/src/jit-test/tests/basic/bug1666856.js index ea6e6942d2..50d8505eb6 100644 --- a/js/src/jit-test/tests/basic/bug1666856.js +++ b/js/src/jit-test/tests/basic/bug1666856.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !this.oomTest - let i = 10000; oomTest(() => { let arr = []; diff --git a/js/src/jit-test/tests/basic/bug1877586.js b/js/src/jit-test/tests/basic/bug1877586.js index d6ff5b1ae3..9d64f110af 100644 --- a/js/src/jit-test/tests/basic/bug1877586.js +++ b/js/src/jit-test/tests/basic/bug1877586.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomAtAllocation' in this); allow-oom +// |jit-test| allow-oom try { for (let i = 0; i < 5; i++) { WebAssembly.instantiateStreaming( diff --git a/js/src/jit-test/tests/basic/bug1883828.js b/js/src/jit-test/tests/basic/bug1883828.js new file mode 100644 index 0000000000..3c63a00d2b --- /dev/null +++ b/js/src/jit-test/tests/basic/bug1883828.js @@ -0,0 +1,5 @@ +const arr = []; +arr[Symbol.toPrimitive] = quit; +const stack = {stack: saveStack(), cause: arr}; +const bound = bindToAsyncStack(function() {}, stack); +bound(); diff --git a/js/src/jit-test/tests/basic/bug1884706.js b/js/src/jit-test/tests/basic/bug1884706.js new file mode 100644 index 0000000000..9bf7c1b52d --- /dev/null +++ b/js/src/jit-test/tests/basic/bug1884706.js @@ -0,0 +1,5 @@ +const arr = new Int32Array(1 << 26); +try { + for (const key in arr) { + } +} catch {} diff --git a/js/src/jit-test/tests/basic/date-getLocale-oom.js b/js/src/jit-test/tests/basic/date-getLocale-oom.js index 7c0b1a7190..dc6371a35b 100644 --- a/js/src/jit-test/tests/basic/date-getLocale-oom.js +++ b/js/src/jit-test/tests/basic/date-getLocale-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function () { new Date(NaN).toString(); }, {keepFailing: true}); diff --git a/js/src/jit-test/tests/basic/date-late-weekday-warning.js b/js/src/jit-test/tests/basic/date-late-weekday-warning.js deleted file mode 100644 index ca6730e56c..0000000000 --- a/js/src/jit-test/tests/basic/date-late-weekday-warning.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Test deprecation warning for late weekday in Date.parse - */ - -function testWarn(date) { - const g = newGlobal(); - g.eval(`Date.parse("${date}")`); - const warning = getLastWarning(); - assertEq(warning !== null, true, `warning should be caught for ${date}`); - assertEq(warning.name, "Warning", warning.name); - - clearLastWarning(); - - g.eval(`Date.parse("${date}")`); - assertEq(getLastWarning(), null, "warning should not be caught for 2nd ocurrence"); -} - -function testNoWarn(date) { - Date.parse(date); - assertEq(getLastWarning(), null, `warning should not be caught for ${date}`); -} - -enableLastWarning(); - -testWarn("Sep 26 1995 Tues"); -testWarn("Sep 26 Tues 1995"); -testWarn("Sep 26 Tues 1995 Tues"); -testWarn("Sep 26 1995 10:Tues:00"); - -testNoWarn("Sep 26 1995"); -testNoWarn("Tues Sep 26 1995"); -testNoWarn("Sep Tues 26 1995"); - -disableLastWarning(); diff --git a/js/src/jit-test/tests/basic/dictionary-add-prop-oom.js b/js/src/jit-test/tests/basic/dictionary-add-prop-oom.js index e393cfca6b..10e09ed06f 100644 --- a/js/src/jit-test/tests/basic/dictionary-add-prop-oom.js +++ b/js/src/jit-test/tests/basic/dictionary-add-prop-oom.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) enableShapeConsistencyChecks(); oomTest(() => { var obj = {a: 1, b: 2, c: 3}; diff --git a/js/src/jit-test/tests/basic/dumpValue.js b/js/src/jit-test/tests/basic/dumpValue.js index 6bf4ffcb8d..b97c9e89d8 100644 --- a/js/src/jit-test/tests/basic/dumpValue.js +++ b/js/src/jit-test/tests/basic/dumpValue.js @@ -1,6 +1,4 @@ -// |jit-test| skip-if: typeof dumpValue !== 'function' || getBuildConfiguration("windows") - -// FIXME: Fix backslash handling on windows (bug 1880003). +// |jit-test| skip-if: typeof dumpValue !== 'function' // Try the dumpValue and dumpValueToString shell functions on various types of // values, and make sure theyit don't crash, and the result is valid JSON. diff --git a/js/src/jit-test/tests/basic/inflate-oom.js b/js/src/jit-test/tests/basic/inflate-oom.js index 645980789f..52d73d66cb 100644 --- a/js/src/jit-test/tests/basic/inflate-oom.js +++ b/js/src/jit-test/tests/basic/inflate-oom.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) function test() { function foo() { return 1; diff --git a/js/src/jit-test/tests/basic/property-error-message-fix-disabled.js b/js/src/jit-test/tests/basic/property-error-message-fix-disabled.js index 542bada65f..a011605ed9 100644 --- a/js/src/jit-test/tests/basic/property-error-message-fix-disabled.js +++ b/js/src/jit-test/tests/basic/property-error-message-fix-disabled.js @@ -1,4 +1,4 @@ -// |jit-test| --disable-property-error-message-fix; skip-if: getBuildConfiguration('pbl') +// |jit-test| --setpref=property_error_message_fix=false; skip-if: getBuildConfiguration('pbl') function check(f, message) { let caught = false; diff --git a/js/src/jit-test/tests/basic/property-error-message-fix.js b/js/src/jit-test/tests/basic/property-error-message-fix.js index 6f27416496..32fe8a7408 100644 --- a/js/src/jit-test/tests/basic/property-error-message-fix.js +++ b/js/src/jit-test/tests/basic/property-error-message-fix.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: getBuildConfiguration('pbl') +// |jit-test| --setpref=property_error_message_fix=true; skip-if: getBuildConfiguration('pbl') function check(f, message) { let caught = false; diff --git a/js/src/jit-test/tests/basic/string-substring-latin1rope-with-twobyte-children.js b/js/src/jit-test/tests/basic/string-substring-latin1rope-with-twobyte-children.js new file mode 100644 index 0000000000..3a1d889073 --- /dev/null +++ b/js/src/jit-test/tests/basic/string-substring-latin1rope-with-twobyte-children.js @@ -0,0 +1,12 @@ +let right = newRope("b", "012345678901234567890123456789"); +let latin1Rope = newRope("a", right); +let twoByteRope = newRope("\u221e", right); + +// Flattening |twoByteRope| changes |right| from a Latin-1 rope into a two-byte +// dependent string. At this point, |latin1Rope| has the Latin-1 flag set, but +// also has a two-byte rope child. +ensureLinearString(twoByteRope); + +let result = latin1Rope.substring(0, 3); + +assertEq(result, "ab0"); diff --git a/js/src/jit-test/tests/basic/testBug756919.js b/js/src/jit-test/tests/basic/testBug756919.js index a72f46bece..9bb0d9a2cc 100644 --- a/js/src/jit-test/tests/basic/testBug756919.js +++ b/js/src/jit-test/tests/basic/testBug756919.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) function test(x) { var upvar = ""; function f() { upvar += ""; } diff --git a/js/src/jit-test/tests/basic/testDetach.js b/js/src/jit-test/tests/basic/testDetach.js new file mode 100644 index 0000000000..fc49e3f99e --- /dev/null +++ b/js/src/jit-test/tests/basic/testDetach.js @@ -0,0 +1,23 @@ +var ab = new ArrayBuffer(4); +var i32 = new Int32Array(ab); +i32[0] = 42; +detachArrayBuffer(ab); +assertEq(i32.length, 0); +assertEq(ab.byteLength, 0); +assertEq(i32[0], undefined); + +var ab = new ArrayBuffer(12); +var i32 = new Int32Array(ab); +i32[0] = 42; +detachArrayBuffer(ab); +assertEq(i32.length, 0); +assertEq(ab.byteLength, 0); +assertEq(i32[0], undefined); + +var ab = new ArrayBuffer(4096); +var i32 = new Int32Array(ab); +i32[0] = 42; +detachArrayBuffer(ab); +assertEq(i32.length, 0); +assertEq(ab.byteLength, 0); +assertEq(i32[0], undefined); diff --git a/js/src/jit-test/tests/basic/testNativeArgsRooting.js b/js/src/jit-test/tests/basic/testNativeArgsRooting.js index 1ce8259f2d..5e3e8f5f12 100644 --- a/js/src/jit-test/tests/basic/testNativeArgsRooting.js +++ b/js/src/jit-test/tests/basic/testNativeArgsRooting.js @@ -1,4 +1,3 @@ -if ('gczeal' in this) (function () { (eval("\ (function () {\ diff --git a/js/src/jit-test/tests/basic/testNeutering.js b/js/src/jit-test/tests/basic/testNeutering.js deleted file mode 100644 index fc49e3f99e..0000000000 --- a/js/src/jit-test/tests/basic/testNeutering.js +++ /dev/null @@ -1,23 +0,0 @@ -var ab = new ArrayBuffer(4); -var i32 = new Int32Array(ab); -i32[0] = 42; -detachArrayBuffer(ab); -assertEq(i32.length, 0); -assertEq(ab.byteLength, 0); -assertEq(i32[0], undefined); - -var ab = new ArrayBuffer(12); -var i32 = new Int32Array(ab); -i32[0] = 42; -detachArrayBuffer(ab); -assertEq(i32.length, 0); -assertEq(ab.byteLength, 0); -assertEq(i32[0], undefined); - -var ab = new ArrayBuffer(4096); -var i32 = new Int32Array(ab); -i32[0] = 42; -detachArrayBuffer(ab); -assertEq(i32.length, 0); -assertEq(ab.byteLength, 0); -assertEq(i32[0], undefined); diff --git a/js/src/jit-test/tests/bug1636306.js b/js/src/jit-test/tests/bug1636306.js index e39dc84f80..ab538831fe 100644 --- a/js/src/jit-test/tests/bug1636306.js +++ b/js/src/jit-test/tests/bug1636306.js @@ -1,4 +1,4 @@ -// |jit-test| --no-ion; skip-if: !('oomTest' in this) +// |jit-test| --no-ion oomTest(() => { eval(` function getCallee() { return getCallee.caller; } diff --git a/js/src/jit-test/tests/bug1681258.js b/js/src/jit-test/tests/bug1681258.js index 4f15a8283e..d0af22c322 100644 --- a/js/src/jit-test/tests/bug1681258.js +++ b/js/src/jit-test/tests/bug1681258.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this);--fast-warmup;--blinterp-warmup-threshold=10 +// |jit-test| --fast-warmup;--blinterp-warmup-threshold=10 ignoreUnhandledRejections(); oomTest(async function() { diff --git a/js/src/jit-test/tests/bug1787730.js b/js/src/jit-test/tests/bug1787730.js index a828527583..09a44496d8 100644 --- a/js/src/jit-test/tests/bug1787730.js +++ b/js/src/jit-test/tests/bug1787730.js @@ -1,3 +1,3 @@ -// |jit-test| --delazification-mode=concurrent-df+on-demand; skip-if: !('oomTest' in this) || isLcovEnabled() +// |jit-test| --delazification-mode=concurrent-df+on-demand; skip-if: isLcovEnabled() oomTest(() => evalcx(0)); diff --git a/js/src/jit-test/tests/bug1878098-serialization-log-oom.js b/js/src/jit-test/tests/bug1878098-serialization-log-oom.js new file mode 100644 index 0000000000..d752337cfa --- /dev/null +++ b/js/src/jit-test/tests/bug1878098-serialization-log-oom.js @@ -0,0 +1,8 @@ +// |jit-test| skip-if: !('oomTest' in this) + +x = []; +x.keepFailing = []; +oomTest(function () { + y = { z: [] }; + makeSerializable().log; +}, x); diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-bytelength-with-sab.js b/js/src/jit-test/tests/dataview/resizable-dataview-bytelength-with-sab.js new file mode 100644 index 0000000000..008657d6e3 --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-bytelength-with-sab.js @@ -0,0 +1,29 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +function testResizableArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new DataView(sab, 0, i); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteLength, i); + + sab.grow(i + j + 1); + assertEq(ta.byteLength, i); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBuffer(); + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new DataView(sab); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteLength, i + j); + + sab.grow(i + j + 1); + assertEq(ta.byteLength, i + j + 1); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-bytelength.js b/js/src/jit-test/tests/dataview/resizable-dataview-bytelength.js new file mode 100644 index 0000000000..851011032f --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-bytelength.js @@ -0,0 +1,43 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +load(libdir + "asserts.js"); + +function testResizableArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new DataView(ab, 0, i); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteLength, i); + + ab.resize(i + 1); + assertEq(ta.byteLength, i); + + if (i > 0) { + ab.resize(i - 1); + assertThrowsInstanceOf(() => ta.byteLength, TypeError); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBuffer(); + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new DataView(ab); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteLength, i); + + ab.resize(i + 1); + assertEq(ta.byteLength, i + 1); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ta.byteLength, i - 1); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-byteoffset-sab.js b/js/src/jit-test/tests/dataview/resizable-dataview-byteoffset-sab.js new file mode 100644 index 0000000000..e671700586 --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-byteoffset-sab.js @@ -0,0 +1,43 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new DataView(sab); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteOffset, 0); + + sab.grow(i + j + 1); + assertEq(ta.byteOffset, 0); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); + +function testResizableArrayBufferAutoLengthNonZeroOffset() { + for (let i = 1; i < 4 + 1; ++i) { + let sab = new SharedArrayBuffer(i + 1, {maxByteLength: i + 100 + 1}); + let ta = new DataView(sab, 1); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteOffset, 1); + + sab.grow(i + j + 2); + assertEq(ta.byteOffset, 1); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLengthNonZeroOffset(); + +function testResizableArrayBufferNonZeroOffset() { + for (let i = 2; i < 4 + 2; ++i) { + let sab = new SharedArrayBuffer(i + 2, {maxByteLength: i + 100 + 2}); + let ta = new DataView(sab, 1, 1); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteOffset, 1); + + sab.grow(i + j + 3); + assertEq(ta.byteOffset, 1); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferNonZeroOffset(); diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-byteoffset.js b/js/src/jit-test/tests/dataview/resizable-dataview-byteoffset.js new file mode 100644 index 0000000000..3f0afa1169 --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-byteoffset.js @@ -0,0 +1,67 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +load(libdir + "asserts.js"); + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new DataView(ab); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteOffset, 0); + + ab.resize(i + 1); + assertEq(ta.byteOffset, 0); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ta.byteOffset, 0); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); + +function testResizableArrayBufferAutoLengthNonZeroOffset() { + for (let i = 1; i < 4 + 1; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new DataView(ab, 1); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteOffset, 1); + + ab.resize(i + 1); + assertEq(ta.byteOffset, 1); + + ab.resize(i - 1); + if (i > 1) { + assertEq(ta.byteOffset, 1); + } else { + assertThrowsInstanceOf(() => ta.byteOffset, TypeError); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLengthNonZeroOffset(); + +function testResizableArrayBufferNonZeroOffset() { + for (let i = 2; i < 4 + 2; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new DataView(ab, 1, 1); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteOffset, 1); + + ab.resize(i + 1); + assertEq(ta.byteOffset, 1); + + ab.resize(i - 1); + if (i > 2) { + assertEq(ta.byteOffset, 1); + } else { + assertThrowsInstanceOf(() => ta.byteOffset, TypeError); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferNonZeroOffset(); diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-get-elem-with-sab.js b/js/src/jit-test/tests/dataview/resizable-dataview-get-elem-with-sab.js new file mode 100644 index 0000000000..ea8ca1666c --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-get-elem-with-sab.js @@ -0,0 +1,48 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +load(libdir + "dataview.js"); + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new SharedArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + for (let i = 0; i < length; ++i) { + actual[i] = type(i * i); + expected[i] = type(i * i); + } + + let dv = new DataView(rab); + for (let i = 0; i < 200; ++i) { + let index = i % length; + let byteIndex = index * TA.BYTES_PER_ELEMENT; + + assertEq(dv.getElem(byteIndex, nativeIsLittleEndian), expected[index]); + } +} + +for (let TA of TypedArrays) { + let getter = "get" + typeName(TA); + + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`.replaceAll("getElem", getter))(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-get-elem.js b/js/src/jit-test/tests/dataview/resizable-dataview-get-elem.js new file mode 100644 index 0000000000..1762f9f5ee --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-get-elem.js @@ -0,0 +1,48 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +load(libdir + "dataview.js"); + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new ArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + for (let i = 0; i < length; ++i) { + actual[i] = type(i * i); + expected[i] = type(i * i); + } + + let dv = new DataView(rab); + for (let i = 0; i < 200; ++i) { + let index = i % length; + let byteIndex = index * TA.BYTES_PER_ELEMENT; + + assertEq(dv.getElem(byteIndex, nativeIsLittleEndian), expected[index]); + } +} + +for (let TA of TypedArrays) { + let getter = "get" + typeName(TA); + + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`.replaceAll("getElem", getter))(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-set-elem-with-sab.js b/js/src/jit-test/tests/dataview/resizable-dataview-set-elem-with-sab.js new file mode 100644 index 0000000000..52d9ddaf4c --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-set-elem-with-sab.js @@ -0,0 +1,47 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +load(libdir + "dataview.js"); + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new SharedArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + let dv = new DataView(rab); + for (let i = 0; i < 200; ++i) { + let index = i % length; + let byteIndex = index * TA.BYTES_PER_ELEMENT; + + let v = type(i); + dv.setElem(byteIndex, v, nativeIsLittleEndian); + expected[index] = v; + + assertEq(actual[index], expected[index]); + } +} + +for (let TA of TypedArrays) { + let setter = "set" + typeName(TA); + + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`.replaceAll("setElem", setter))(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/dataview/resizable-dataview-set-elem.js b/js/src/jit-test/tests/dataview/resizable-dataview-set-elem.js new file mode 100644 index 0000000000..0359d1a8b3 --- /dev/null +++ b/js/src/jit-test/tests/dataview/resizable-dataview-set-elem.js @@ -0,0 +1,47 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +load(libdir + "dataview.js"); + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new ArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + let dv = new DataView(rab); + for (let i = 0; i < 200; ++i) { + let index = i % length; + let byteIndex = index * TA.BYTES_PER_ELEMENT; + + let v = type(i); + dv.setElem(byteIndex, v, nativeIsLittleEndian); + expected[index] = v; + + assertEq(actual[index], expected[index]); + } +} + +for (let TA of TypedArrays) { + let setter = "set" + typeName(TA); + + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`.replaceAll("setElem", setter))(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/debug/Debugger-findScripts-26.js b/js/src/jit-test/tests/debug/Debugger-findScripts-26.js index 1c1510aa4f..57709782ab 100644 --- a/js/src/jit-test/tests/debug/Debugger-findScripts-26.js +++ b/js/src/jit-test/tests/debug/Debugger-findScripts-26.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) var g = newGlobal({newCompartment: true}); var dbg = new Debugger(); var gw = dbg.addDebuggee(g); diff --git a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js index 6ab17714e6..781e300f93 100644 --- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js +++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) - // Test drainAllocationsLog() entries' inNursery flag. gczeal(0); diff --git a/js/src/jit-test/tests/debug/Memory-takeCensus-06.js b/js/src/jit-test/tests/debug/Memory-takeCensus-06.js index 02f8de30be..9a49140638 100644 --- a/js/src/jit-test/tests/debug/Memory-takeCensus-06.js +++ b/js/src/jit-test/tests/debug/Memory-takeCensus-06.js @@ -106,3 +106,29 @@ Pattern({ other: { by: 'count', label: 'other' } } })); + +try { + const breakdown = { by: "objectClass" }; + breakdown.then = breakdown; + dbg.memory.takeCensus({ breakdown }); + assertEq(true, false, "should not reach here"); +} catch (e) { + assertEq(e.message, "takeCensus breakdown 'by' value nested within itself: \"objectClass\""); +} + +try { + const breakdown = { by: "objectClass", then: { by: "objectClass" } }; + dbg.memory.takeCensus({ breakdown }); + assertEq(true, false, "should not reach here"); +} catch (e) { + assertEq(e.message, "takeCensus breakdown 'by' value nested within itself: \"objectClass\""); +} + +try { + const breakdown = { by: "coarseType", scripts: { by: "filename" } }; + breakdown.scripts.noFilename = breakdown; + dbg.memory.takeCensus({ breakdown }); + assertEq(true, false, "should not reach here"); +} catch (e) { + assertEq(e.message, "takeCensus breakdown 'by' value nested within itself: \"coarseType\""); +} diff --git a/js/src/jit-test/tests/debug/Object-getPromiseReactions-07.js b/js/src/jit-test/tests/debug/Object-getPromiseReactions-07.js new file mode 100644 index 0000000000..a79b2dc2ef --- /dev/null +++ b/js/src/jit-test/tests/debug/Object-getPromiseReactions-07.js @@ -0,0 +1,14 @@ +async function f(arg) { + await arg; + + const g = newGlobal({ sameZoneAs: {} }); + const dbg = g.Debugger({}); + const promise = dbg.getNewestFrame().asyncPromise; + dbg.removeAllDebuggees(); + + // getPromiseReactions should return an empty array after removing debuggee. + assertEq(promise.getPromiseReactions().length, 0); +} + +const p = f(); +f(p); diff --git a/js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js b/js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js new file mode 100644 index 0000000000..648847ae49 --- /dev/null +++ b/js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js @@ -0,0 +1,32 @@ +var g = newGlobal({newCompartment: true}); +var dbg = Debugger(g); +var gdbg = dbg.addDebuggee(g); + +assertEq(gdbg.getProperty("print").return.isSameNativeWithJitInfo(print), true); +assertEq(gdbg.getProperty("print").return.isSameNativeWithJitInfo(newGlobal), false); + +// FakeDOMObject's accessor shares the single native functions, with +// different JSJitInfo for each. + +gdbg.executeInGlobal(` +var fun1 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "x").get; +var fun2 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "slot").get; +`); + +var g_fun1 = gdbg.executeInGlobal("fun1").return; +var g_fun2 = gdbg.executeInGlobal("fun2").return; + +var fun1 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "x").get; +var fun2 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "slot").get; + +// isSameNative doesn't distinguish between fun1 and fun2. +assertEq(g_fun1.isSameNative(fun1), true); +assertEq(g_fun1.isSameNative(fun2), true); +assertEq(g_fun2.isSameNative(fun1), true); +assertEq(g_fun2.isSameNative(fun2), true); + +// isSameNativeWithJitInfo can distinguish between fun1 and fun2. +assertEq(g_fun1.isSameNativeWithJitInfo(fun1), true); +assertEq(g_fun1.isSameNativeWithJitInfo(fun2), false); +assertEq(g_fun2.isSameNativeWithJitInfo(fun1), false); +assertEq(g_fun2.isSameNativeWithJitInfo(fun2), true); diff --git a/js/src/jit-test/tests/debug/breakpoint-oom-01.js b/js/src/jit-test/tests/debug/breakpoint-oom-01.js index 4fd709ccd0..cbbbd7ffda 100644 --- a/js/src/jit-test/tests/debug/breakpoint-oom-01.js +++ b/js/src/jit-test/tests/debug/breakpoint-oom-01.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) +// |jit-test| skip-if: !hasFunction.oomTest // Test for OOM hitting a breakpoint in a generator. // diff --git a/js/src/jit-test/tests/debug/bug-1238610.js b/js/src/jit-test/tests/debug/bug-1238610.js index 91562443bd..79fe5b3c2c 100644 --- a/js/src/jit-test/tests/debug/bug-1238610.js +++ b/js/src/jit-test/tests/debug/bug-1238610.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) || helperThreadCount() === 0 +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations || helperThreadCount() === 0 lfcode = new Array(); dbg = Debugger(); diff --git a/js/src/jit-test/tests/debug/bug-1248162.js b/js/src/jit-test/tests/debug/bug-1248162.js index 825b3376e4..6deadfdc07 100644 --- a/js/src/jit-test/tests/debug/bug-1248162.js +++ b/js/src/jit-test/tests/debug/bug-1248162.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom // Adapted from randomly chosen test: js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-01.js for (var i = 0; i < 9; ++i) { diff --git a/js/src/jit-test/tests/debug/bug-1260725.js b/js/src/jit-test/tests/debug/bug-1260725.js index ce1c263f6a..7f8895e589 100644 --- a/js/src/jit-test/tests/debug/bug-1260725.js +++ b/js/src/jit-test/tests/debug/bug-1260725.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var dbg = new Debugger; dbg.onNewGlobalObject = function(global) { dbg.memory.takeCensus({}); diff --git a/js/src/jit-test/tests/debug/bug-1565275.js b/js/src/jit-test/tests/debug/bug-1565275.js index 242bce3a85..9e600162a4 100644 --- a/js/src/jit-test/tests/debug/bug-1565275.js +++ b/js/src/jit-test/tests/debug/bug-1565275.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - Object.defineProperty(this, "fuzzutils", { value: { evaluate: function() {}, diff --git a/js/src/jit-test/tests/debug/bug-1576862-2.js b/js/src/jit-test/tests/debug/bug-1576862-2.js index 6f7c31e98a..e1922f4a19 100644 --- a/js/src/jit-test/tests/debug/bug-1576862-2.js +++ b/js/src/jit-test/tests/debug/bug-1576862-2.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('stackTest' in this) // Failure to rewrap an exception in Completion::fromJSResult should be propagated. var dbgGlobal = newGlobal({ newCompartment: true }); diff --git a/js/src/jit-test/tests/debug/bug-1584195.js b/js/src/jit-test/tests/debug/bug-1584195.js index 93aca7291d..dd74597b1b 100644 --- a/js/src/jit-test/tests/debug/bug-1584195.js +++ b/js/src/jit-test/tests/debug/bug-1584195.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) // Bug 1584195: Debugger.Frame finalizer should't try to apply // IsAboutToBeFinalized to cells of other alloc kinds, whose arenas may have // been turned over to fresh allocations. diff --git a/js/src/jit-test/tests/debug/bug1216261.js b/js/src/jit-test/tests/debug/bug1216261.js index 0d98327256..6051d69c95 100644 --- a/js/src/jit-test/tests/debug/bug1216261.js +++ b/js/src/jit-test/tests/debug/bug1216261.js @@ -1,4 +1,4 @@ -// |jit-test| exitstatus: 3; skip-if: !('oomAfterAllocations' in this) +// |jit-test| exitstatus: 3 var g = newGlobal(); var dbg = new Debugger(g); diff --git a/js/src/jit-test/tests/debug/bug1219905.js b/js/src/jit-test/tests/debug/bug1219905.js index 5ed51a2423..5e5595a4e7 100644 --- a/js/src/jit-test/tests/debug/bug1219905.js +++ b/js/src/jit-test/tests/debug/bug1219905.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom // We need allow-oom here because the debugger reports an uncaught exception if // it hits OOM calling the exception unwind hook. This causes the shell to exit diff --git a/js/src/jit-test/tests/debug/bug1240546.js b/js/src/jit-test/tests/debug/bug1240546.js index 6d548d8b92..797af37988 100644 --- a/js/src/jit-test/tests/debug/bug1240546.js +++ b/js/src/jit-test/tests/debug/bug1240546.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations var g = newGlobal(); g.debuggeeGlobal = this; diff --git a/js/src/jit-test/tests/debug/bug1240803.js b/js/src/jit-test/tests/debug/bug1240803.js index ab1e0fb641..74eb34ed61 100644 --- a/js/src/jit-test/tests/debug/bug1240803.js +++ b/js/src/jit-test/tests/debug/bug1240803.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations (function() { g = newGlobal({newCompartment: true}) diff --git a/js/src/jit-test/tests/debug/bug1242111.js b/js/src/jit-test/tests/debug/bug1242111.js index dae0efcdab..ebfc2eec70 100644 --- a/js/src/jit-test/tests/debug/bug1242111.js +++ b/js/src/jit-test/tests/debug/bug1242111.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations var g = newGlobal(); g.debuggeeGlobal = []; diff --git a/js/src/jit-test/tests/debug/bug1245862.js b/js/src/jit-test/tests/debug/bug1245862.js index 274903bc40..83793a7306 100644 --- a/js/src/jit-test/tests/debug/bug1245862.js +++ b/js/src/jit-test/tests/debug/bug1245862.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations var g = newGlobal({newCompartment: true}); var dbg = new Debugger; diff --git a/js/src/jit-test/tests/debug/bug1251919.js b/js/src/jit-test/tests/debug/bug1251919.js index 79fd05f890..9e5ccac82f 100644 --- a/js/src/jit-test/tests/debug/bug1251919.js +++ b/js/src/jit-test/tests/debug/bug1251919.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // jsfunfuzz-generated fullcompartmentchecks(true); // Adapted from randomly chosen test: js/src/jit-test/tests/debug/bug-1248162.js diff --git a/js/src/jit-test/tests/debug/bug1254123.js b/js/src/jit-test/tests/debug/bug1254123.js index 72f36ef3ec..c96753b305 100644 --- a/js/src/jit-test/tests/debug/bug1254123.js +++ b/js/src/jit-test/tests/debug/bug1254123.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - evaluate(` function ERROR(msg) { throw new Error("boom"); diff --git a/js/src/jit-test/tests/debug/bug1254190.js b/js/src/jit-test/tests/debug/bug1254190.js index 3d3572b469..74a4799c39 100644 --- a/js/src/jit-test/tests/debug/bug1254190.js +++ b/js/src/jit-test/tests/debug/bug1254190.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this); allow-oom +// |jit-test| slow; allow-oom var g = newGlobal({newCompartment: true}); var dbg = new Debugger(g); diff --git a/js/src/jit-test/tests/debug/bug1254578.js b/js/src/jit-test/tests/debug/bug1254578.js index f36bcef601..9592adb67a 100644 --- a/js/src/jit-test/tests/debug/bug1254578.js +++ b/js/src/jit-test/tests/debug/bug1254578.js @@ -1,5 +1,3 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) - var g = newGlobal({newCompartment: true}); g.debuggeeGlobal = this; g.eval("(" + function() { diff --git a/js/src/jit-test/tests/debug/bug1264961.js b/js/src/jit-test/tests/debug/bug1264961.js index c43a29504d..2047768aeb 100644 --- a/js/src/jit-test/tests/debug/bug1264961.js +++ b/js/src/jit-test/tests/debug/bug1264961.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow loadFile(` var o = {} diff --git a/js/src/jit-test/tests/debug/bug1272908.js b/js/src/jit-test/tests/debug/bug1272908.js index b1e1c5aeaf..397de9a8eb 100644 --- a/js/src/jit-test/tests/debug/bug1272908.js +++ b/js/src/jit-test/tests/debug/bug1272908.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow // Adapted from randomly chosen test: js/src/jit-test/tests/modules/bug-1233915.js g = newGlobal({newCompartment: true}); diff --git a/js/src/jit-test/tests/debug/bug1370905.js b/js/src/jit-test/tests/debug/bug1370905.js index 8f8143132e..7237e55420 100644 --- a/js/src/jit-test/tests/debug/bug1370905.js +++ b/js/src/jit-test/tests/debug/bug1370905.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom function x() { var global = newGlobal({sameZoneAs: this}); diff --git a/js/src/jit-test/tests/debug/bug1404710.js b/js/src/jit-test/tests/debug/bug1404710.js index 78a8bbb5b8..69aa078333 100644 --- a/js/src/jit-test/tests/debug/bug1404710.js +++ b/js/src/jit-test/tests/debug/bug1404710.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('stackTest' in this) stackTest(new Function(` var g = newGlobal(); var dbg = new Debugger(g); diff --git a/js/src/jit-test/tests/debug/bug1434391.js b/js/src/jit-test/tests/debug/bug1434391.js index 86efe7970b..d3231b6e15 100644 --- a/js/src/jit-test/tests/debug/bug1434391.js +++ b/js/src/jit-test/tests/debug/bug1434391.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var g = newGlobal({newCompartment: true}); var dbg = new Debugger(); var gw = dbg.addDebuggee(g); diff --git a/js/src/jit-test/tests/debug/bug1647309.js b/js/src/jit-test/tests/debug/bug1647309.js index e4ffcfc349..520e505b5c 100644 --- a/js/src/jit-test/tests/debug/bug1647309.js +++ b/js/src/jit-test/tests/debug/bug1647309.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - const g = newGlobal({ newCompartment: true }); const dbg = new Debugger(g); diff --git a/js/src/jit-test/tests/debug/bug1878511.js b/js/src/jit-test/tests/debug/bug1878511.js index f9143b9961..a6a550c4b7 100644 --- a/js/src/jit-test/tests/debug/bug1878511.js +++ b/js/src/jit-test/tests/debug/bug1878511.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) var c = 0; var dbg = new Debugger(); oomTest(function () { diff --git a/js/src/jit-test/tests/debug/job-queue-04.js b/js/src/jit-test/tests/debug/job-queue-04.js index 76cf241e8d..040f5874c0 100644 --- a/js/src/jit-test/tests/debug/job-queue-04.js +++ b/js/src/jit-test/tests/debug/job-queue-04.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) // Bug 1527862: Don't assert that the Debugger drained its job queue unless we // actually saved the debuggee's queue. diff --git a/js/src/jit-test/tests/debug/wasm-14.js b/js/src/jit-test/tests/debug/wasm-14.js index 023c16dca4..b47b540d72 100644 --- a/js/src/jit-test/tests/debug/wasm-14.js +++ b/js/src/jit-test/tests/debug/wasm-14.js @@ -1,4 +1,4 @@ -// |jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-function-references --wasm-gc; skip-if: !wasmDebuggingEnabled() || !wasmGcEnabled(); skip-if: true +// |jit-test| test-also=--wasm-compiler=optimizing; test-also=--setpref=wasm_gc=true; skip-if: !wasmDebuggingEnabled() || !wasmGcEnabled(); skip-if: true // An extension of wasm-10.js, testing that wasm GC objects are inspectable in locals. // As of bug 1825098, this test is disabled. (skip-if: true) diff --git a/js/src/jit-test/tests/debug/wasm-15.js b/js/src/jit-test/tests/debug/wasm-15.js index 90b1fbea3b..c2af3bdc17 100644 --- a/js/src/jit-test/tests/debug/wasm-15.js +++ b/js/src/jit-test/tests/debug/wasm-15.js @@ -63,7 +63,7 @@ wasmRunWithDebugger( ); // Checking if enter/leave frame at return_call_ref. -wasmFunctionReferencesEnabled() && wasmRunWithDebugger( +wasmGcEnabled() && wasmRunWithDebugger( '(module (type $t (func)) (elem declare func 0) (func) (func (return_call_ref $t (ref.func 0))) (func (call 1)) (export "test" (func 2)))', undefined, function ({dbg}) { diff --git a/js/src/jit-test/tests/fields/private-proxy-oom.js b/js/src/jit-test/tests/fields/private-proxy-oom.js index dd5200d9a6..ff6bf4632b 100644 --- a/js/src/jit-test/tests/fields/private-proxy-oom.js +++ b/js/src/jit-test/tests/fields/private-proxy-oom.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this); // Check for proxy expando OOM issues. function assertThrowsTypeError(f) { @@ -45,4 +44,4 @@ function testing() { assertThrowsTypeError(() => A.gf(target)); } -oomTest(testing); \ No newline at end of file +oomTest(testing); diff --git a/js/src/jit-test/tests/fuses/with.js b/js/src/jit-test/tests/fuses/with.js new file mode 100644 index 0000000000..8a76e5c09b --- /dev/null +++ b/js/src/jit-test/tests/fuses/with.js @@ -0,0 +1,9 @@ +let iterProto = [].values().__proto__ +with (newGlobal()) { + const v3 = [].values(); + Object.defineProperty(v3.__proto__, "return", {}); + const v18 = []; + for (let i = 0; i < 500; i++) { + [] = v18; + } +} diff --git a/js/src/jit-test/tests/gc/bug-1108007.js b/js/src/jit-test/tests/gc/bug-1108007.js index 35daaefc91..487b765c87 100644 --- a/js/src/jit-test/tests/gc/bug-1108007.js +++ b/js/src/jit-test/tests/gc/bug-1108007.js @@ -1,4 +1,4 @@ -// |jit-test| --no-threads; --no-ion; --no-baseline; skip-if: !('gczeal' in this) +// |jit-test| --no-threads; --no-ion; --no-baseline gczeal(2); (function() { diff --git a/js/src/jit-test/tests/gc/bug-1155455.js b/js/src/jit-test/tests/gc/bug-1155455.js index c9b8040884..47b2912804 100644 --- a/js/src/jit-test/tests/gc/bug-1155455.js +++ b/js/src/jit-test/tests/gc/bug-1155455.js @@ -1,4 +1,4 @@ -// |jit-test| error: TypeError; skip-if: !('gczeal' in this) +// |jit-test| error: TypeError var g = newGlobal(); gczeal(10, 2) var dbg = Debugger(g); diff --git a/js/src/jit-test/tests/gc/bug-1161968.js b/js/src/jit-test/tests/gc/bug-1161968.js index 5f83aa510c..dc78749cd5 100644 --- a/js/src/jit-test/tests/gc/bug-1161968.js +++ b/js/src/jit-test/tests/gc/bug-1161968.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) - // This test case is a simplified version of debug/Source-invisible.js. gczeal(2,21); diff --git a/js/src/jit-test/tests/gc/bug-1165966.js b/js/src/jit-test/tests/gc/bug-1165966.js index 79c58274cd..8b0bca873c 100644 --- a/js/src/jit-test/tests/gc/bug-1165966.js +++ b/js/src/jit-test/tests/gc/bug-1165966.js @@ -1,4 +1,4 @@ -// |jit-test| --no-ion; skip-if: !('oomTest' in this) +// |jit-test| --no-ion var g = newGlobal(); oomTest(function() { diff --git a/js/src/jit-test/tests/gc/bug-1171909.js b/js/src/jit-test/tests/gc/bug-1171909.js index 755c6ff89d..9ad1767016 100644 --- a/js/src/jit-test/tests/gc/bug-1171909.js +++ b/js/src/jit-test/tests/gc/bug-1171909.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest((function(x) { assertEq(x + y + ex, 25); })); diff --git a/js/src/jit-test/tests/gc/bug-1175755.js b/js/src/jit-test/tests/gc/bug-1175755.js index 1b6960fb8c..3c07184fe8 100644 --- a/js/src/jit-test/tests/gc/bug-1175755.js +++ b/js/src/jit-test/tests/gc/bug-1175755.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; allow-unhandlable-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; allow-unhandlable-oom setGCCallback({ action: "majorGC", diff --git a/js/src/jit-test/tests/gc/bug-1191576.js b/js/src/jit-test/tests/gc/bug-1191576.js index 6346905256..ba74bfe142 100644 --- a/js/src/jit-test/tests/gc/bug-1191576.js +++ b/js/src/jit-test/tests/gc/bug-1191576.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('gczeal' in this && 'oomAfterAllocations' in this) +// |jit-test| allow-oom var lfcode = new Array(); gczeal(14); diff --git a/js/src/jit-test/tests/gc/bug-1206677.js b/js/src/jit-test/tests/gc/bug-1206677.js index a0d2ff3a1f..0052ef0ad1 100644 --- a/js/src/jit-test/tests/gc/bug-1206677.js +++ b/js/src/jit-test/tests/gc/bug-1206677.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 var lfGlobal = newGlobal(); for (lfLocal in this) { diff --git a/js/src/jit-test/tests/gc/bug-1208994.js b/js/src/jit-test/tests/gc/bug-1208994.js index 12c24f62af..4f28b0c0eb 100644 --- a/js/src/jit-test/tests/gc/bug-1208994.js +++ b/js/src/jit-test/tests/gc/bug-1208994.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => getBacktrace({args: oomTest[load+1], locals: true, thisprops: true})); diff --git a/js/src/jit-test/tests/gc/bug-1209001.js b/js/src/jit-test/tests/gc/bug-1209001.js index a737224d0d..3dfb087156 100644 --- a/js/src/jit-test/tests/gc/bug-1209001.js +++ b/js/src/jit-test/tests/gc/bug-1209001.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => parseModule('import v from "mod";')); diff --git a/js/src/jit-test/tests/gc/bug-1210607.js b/js/src/jit-test/tests/gc/bug-1210607.js index 15312c810a..d304f24d7d 100644 --- a/js/src/jit-test/tests/gc/bug-1210607.js +++ b/js/src/jit-test/tests/gc/bug-1210607.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom var g = newGlobal({newCompartment: true}); x = Debugger(g); diff --git a/js/src/jit-test/tests/gc/bug-1214006.js b/js/src/jit-test/tests/gc/bug-1214006.js index ed2c6468dc..3b150fbaed 100644 --- a/js/src/jit-test/tests/gc/bug-1214006.js +++ b/js/src/jit-test/tests/gc/bug-1214006.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom function f() { eval("(function() y)()"); diff --git a/js/src/jit-test/tests/gc/bug-1214781.js b/js/src/jit-test/tests/gc/bug-1214781.js index d18845812c..b8a5bb87bb 100644 --- a/js/src/jit-test/tests/gc/bug-1214781.js +++ b/js/src/jit-test/tests/gc/bug-1214781.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom try { gcparam("maxBytes", gcparam("gcBytes")); diff --git a/js/src/jit-test/tests/gc/bug-1214846.js b/js/src/jit-test/tests/gc/bug-1214846.js index 23b5b9fe94..4ba8b3a78f 100644 --- a/js/src/jit-test/tests/gc/bug-1214846.js +++ b/js/src/jit-test/tests/gc/bug-1214846.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: !hasFunction.oomTest || helperThreadCount() === 0 enableGeckoProfiling(); var s = newGlobal(); diff --git a/js/src/jit-test/tests/gc/bug-1215363-1.js b/js/src/jit-test/tests/gc/bug-1215363-1.js index 3ed21e1f9a..fe9eb8c9a2 100644 --- a/js/src/jit-test/tests/gc/bug-1215363-1.js +++ b/js/src/jit-test/tests/gc/bug-1215363-1.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => parseModule(10)); diff --git a/js/src/jit-test/tests/gc/bug-1215363-2.js b/js/src/jit-test/tests/gc/bug-1215363-2.js index 4b51a5a96d..afe0af7ac1 100644 --- a/js/src/jit-test/tests/gc/bug-1215363-2.js +++ b/js/src/jit-test/tests/gc/bug-1215363-2.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var lfcode = new Array(); oomTest((function(x) { assertEq(...Object); diff --git a/js/src/jit-test/tests/gc/bug-1215363-3.js b/js/src/jit-test/tests/gc/bug-1215363-3.js index 33495af2e1..0022507763 100644 --- a/js/src/jit-test/tests/gc/bug-1215363-3.js +++ b/js/src/jit-test/tests/gc/bug-1215363-3.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - var lfcode = new Array(); oomTest(() => getBacktrace({})); diff --git a/js/src/jit-test/tests/gc/bug-1216607.js b/js/src/jit-test/tests/gc/bug-1216607.js index 1afac7faab..46530c113c 100644 --- a/js/src/jit-test/tests/gc/bug-1216607.js +++ b/js/src/jit-test/tests/gc/bug-1216607.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - enableGeckoProfilingWithSlowAssertions(); try { (function() { diff --git a/js/src/jit-test/tests/gc/bug-1221359.js b/js/src/jit-test/tests/gc/bug-1221359.js index dcbafeb446..96b323edd0 100644 --- a/js/src/jit-test/tests/gc/bug-1221359.js +++ b/js/src/jit-test/tests/gc/bug-1221359.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => getBacktrace({ locals: true, thisprops: true diff --git a/js/src/jit-test/tests/gc/bug-1221747.js b/js/src/jit-test/tests/gc/bug-1221747.js index 5ff33dd64e..12d31df2fb 100644 --- a/js/src/jit-test/tests/gc/bug-1221747.js +++ b/js/src/jit-test/tests/gc/bug-1221747.js @@ -1,4 +1,4 @@ -// |jit-test| --dump-bytecode; skip-if: !('oomTest' in this) +// |jit-test| --dump-bytecode function f() { eval("(function() {})()"); diff --git a/js/src/jit-test/tests/gc/bug-1223021.js b/js/src/jit-test/tests/gc/bug-1223021.js index bbc40aa1fb..a5a85f3104 100644 --- a/js/src/jit-test/tests/gc/bug-1223021.js +++ b/js/src/jit-test/tests/gc/bug-1223021.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function f() { return this === null; }; diff --git a/js/src/jit-test/tests/gc/bug-1224710.js b/js/src/jit-test/tests/gc/bug-1224710.js index 9cb9aa7cd3..68809d7f36 100644 --- a/js/src/jit-test/tests/gc/bug-1224710.js +++ b/js/src/jit-test/tests/gc/bug-1224710.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { eval("\ function g() {\ diff --git a/js/src/jit-test/tests/gc/bug-1226896.js b/js/src/jit-test/tests/gc/bug-1226896.js index 0b8c513cc8..8ecf66fd59 100644 --- a/js/src/jit-test/tests/gc/bug-1226896.js +++ b/js/src/jit-test/tests/gc/bug-1226896.js @@ -1,4 +1,4 @@ -// |jit-test| --ion-pruning=on; skip-if: !('oomTest' in this) +// |jit-test| --ion-pruning=on oomTest(() => { var g = newGlobal({sameZoneAs: this}); diff --git a/js/src/jit-test/tests/gc/bug-1231386.js b/js/src/jit-test/tests/gc/bug-1231386.js index c2dc55b734..01bbee81cf 100644 --- a/js/src/jit-test/tests/gc/bug-1231386.js +++ b/js/src/jit-test/tests/gc/bug-1231386.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow function f1() {} function f2() {} diff --git a/js/src/jit-test/tests/gc/bug-1232386.js b/js/src/jit-test/tests/gc/bug-1232386.js index 82a33a7ec4..b768176cf0 100644 --- a/js/src/jit-test/tests/gc/bug-1232386.js +++ b/js/src/jit-test/tests/gc/bug-1232386.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom var dbg = new Debugger; dbg.onNewGlobalObject = function(global) { diff --git a/js/src/jit-test/tests/gc/bug-1234410.js b/js/src/jit-test/tests/gc/bug-1234410.js index fe400f8013..79623a0a43 100644 --- a/js/src/jit-test/tests/gc/bug-1234410.js +++ b/js/src/jit-test/tests/gc/bug-1234410.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - enableGeckoProfiling(); oomTest(() => { try { diff --git a/js/src/jit-test/tests/gc/bug-1236473.js b/js/src/jit-test/tests/gc/bug-1236473.js index 0051e789a6..cef0bd1d25 100644 --- a/js/src/jit-test/tests/gc/bug-1236473.js +++ b/js/src/jit-test/tests/gc/bug-1236473.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { offThreadCompileToStencil(`try {} catch (NaN) {}`); var stencil = finishOffThreadStencil(); diff --git a/js/src/jit-test/tests/gc/bug-1238555.js b/js/src/jit-test/tests/gc/bug-1238555.js index 4b9963292e..f9e139a895 100644 --- a/js/src/jit-test/tests/gc/bug-1238555.js +++ b/js/src/jit-test/tests/gc/bug-1238555.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest( function x() { try { diff --git a/js/src/jit-test/tests/gc/bug-1238575-2.js b/js/src/jit-test/tests/gc/bug-1238575-2.js index 9fe011efa1..0c715d3998 100644 --- a/js/src/jit-test/tests/gc/bug-1238575-2.js +++ b/js/src/jit-test/tests/gc/bug-1238575-2.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => evalInWorker("1")); diff --git a/js/src/jit-test/tests/gc/bug-1238575.js b/js/src/jit-test/tests/gc/bug-1238575.js index 8e6a629d9f..fbce26ff52 100644 --- a/js/src/jit-test/tests/gc/bug-1238575.js +++ b/js/src/jit-test/tests/gc/bug-1238575.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; allow-unhandlable-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; allow-unhandlable-oom; skip-if: helperThreadCount() === 0 oomAfterAllocations(5) gcslice(11); diff --git a/js/src/jit-test/tests/gc/bug-1238582.js b/js/src/jit-test/tests/gc/bug-1238582.js index b5dad7a64d..9b1a267627 100644 --- a/js/src/jit-test/tests/gc/bug-1238582.js +++ b/js/src/jit-test/tests/gc/bug-1238582.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { let a = [2147483651]; [a[0], a[undefined]].sort(); }); diff --git a/js/src/jit-test/tests/gc/bug-1240503.js b/js/src/jit-test/tests/gc/bug-1240503.js index 167752962b..cdb93a0929 100644 --- a/js/src/jit-test/tests/gc/bug-1240503.js +++ b/js/src/jit-test/tests/gc/bug-1240503.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function arrayProtoOutOfRange() { for (let [] = () => r, get;;) var r = f(i % 2 ? a : b); diff --git a/js/src/jit-test/tests/gc/bug-1240527.js b/js/src/jit-test/tests/gc/bug-1240527.js index ca4e0e3eb6..1621fa5764 100644 --- a/js/src/jit-test/tests/gc/bug-1240527.js +++ b/js/src/jit-test/tests/gc/bug-1240527.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: helperThreadCount() === 0 || !('oomTest' in this) +// |jit-test| skip-if: helperThreadCount() === 0 offThreadCompileToStencil(` oomTest(() => "".search(/d/)); diff --git a/js/src/jit-test/tests/gc/bug-1241731.js b/js/src/jit-test/tests/gc/bug-1241731.js index 015c7f3e67..320dece892 100644 --- a/js/src/jit-test/tests/gc/bug-1241731.js +++ b/js/src/jit-test/tests/gc/bug-1241731.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => serialize(0, [{}])); diff --git a/js/src/jit-test/tests/gc/bug-1242812.js b/js/src/jit-test/tests/gc/bug-1242812.js index df4ae09998..b685d17928 100644 --- a/js/src/jit-test/tests/gc/bug-1242812.js +++ b/js/src/jit-test/tests/gc/bug-1242812.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - var lfcode = new Array(); oomTest(() => { let a = [2147483651]; [-1, 0, 1, 31, 32].sort(); }); diff --git a/js/src/jit-test/tests/gc/bug-1245520.js b/js/src/jit-test/tests/gc/bug-1245520.js index 1f59c3dbab..d951a071ac 100644 --- a/js/src/jit-test/tests/gc/bug-1245520.js +++ b/js/src/jit-test/tests/gc/bug-1245520.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - var t = {}; oomTest(() => serialize(t)); diff --git a/js/src/jit-test/tests/gc/bug-1252329.js b/js/src/jit-test/tests/gc/bug-1252329.js index 8f5b1ce282..100a1817cf 100644 --- a/js/src/jit-test/tests/gc/bug-1252329.js +++ b/js/src/jit-test/tests/gc/bug-1252329.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: helperThreadCount() == 0 || !('oomAfterAllocations' in this) +// |jit-test| allow-oom; skip-if: helperThreadCount() == 0 || !hasFunction.oomAfterAllocations var lfcode = new Array(); lfcode.push("5"); diff --git a/js/src/jit-test/tests/gc/bug-1253124.js b/js/src/jit-test/tests/gc/bug-1253124.js index 6949605b00..3302e120fb 100644 --- a/js/src/jit-test/tests/gc/bug-1253124.js +++ b/js/src/jit-test/tests/gc/bug-1253124.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - for (let i = 0; i < 10; i++) toPrimitive = Date.prototype[Symbol.toPrimitive]; assertThrowsInstanceOf(() => 0); diff --git a/js/src/jit-test/tests/gc/bug-1259306.js b/js/src/jit-test/tests/gc/bug-1259306.js index fba5f71b6a..bb92bb43f5 100644 --- a/js/src/jit-test/tests/gc/bug-1259306.js +++ b/js/src/jit-test/tests/gc/bug-1259306.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - let runCount = 0; oomTest(() => { if (runCount < 5) { diff --git a/js/src/jit-test/tests/gc/bug-1261329.js b/js/src/jit-test/tests/gc/bug-1261329.js index afa1db2c3d..35015917e4 100644 --- a/js/src/jit-test/tests/gc/bug-1261329.js +++ b/js/src/jit-test/tests/gc/bug-1261329.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) +// |jit-test| skip-if: !hasFunction.oomTest print = function() {} function k() { return dissrc(print); } diff --git a/js/src/jit-test/tests/gc/bug-1263862.js b/js/src/jit-test/tests/gc/bug-1263862.js index 955805047a..1b904d34c7 100644 --- a/js/src/jit-test/tests/gc/bug-1263862.js +++ b/js/src/jit-test/tests/gc/bug-1263862.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function loadFile(lfVarx) { oomTest(() => eval(lfVarx)); } diff --git a/js/src/jit-test/tests/gc/bug-1263871.js b/js/src/jit-test/tests/gc/bug-1263871.js index 6680affedf..92e6d3645b 100644 --- a/js/src/jit-test/tests/gc/bug-1263871.js +++ b/js/src/jit-test/tests/gc/bug-1263871.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - lfLogBuffer = `this[''] = function() {}`; loadFile(lfLogBuffer); loadFile(lfLogBuffer); diff --git a/js/src/jit-test/tests/gc/bug-1263884.js b/js/src/jit-test/tests/gc/bug-1263884.js index 949945e0a4..d203c06354 100644 --- a/js/src/jit-test/tests/gc/bug-1263884.js +++ b/js/src/jit-test/tests/gc/bug-1263884.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { eval(` var argObj = function () { return arguments }() diff --git a/js/src/jit-test/tests/gc/bug-1271110.js b/js/src/jit-test/tests/gc/bug-1271110.js index 12d1617c57..49a849045d 100644 --- a/js/src/jit-test/tests/gc/bug-1271110.js +++ b/js/src/jit-test/tests/gc/bug-1271110.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - gczeal(0); var x1 = []; diff --git a/js/src/jit-test/tests/gc/bug-1280588.js b/js/src/jit-test/tests/gc/bug-1280588.js index a6b2c4f075..b3391e6eef 100644 --- a/js/src/jit-test/tests/gc/bug-1280588.js +++ b/js/src/jit-test/tests/gc/bug-1280588.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var x = []; oomTest(() => setGCCallback({ action: "minorGC" })); oomTest(() => setGCCallback({ action: "majorGC" })); diff --git a/js/src/jit-test/tests/gc/bug-1282986.js b/js/src/jit-test/tests/gc/bug-1282986.js index 934cea5b61..215b2190af 100644 --- a/js/src/jit-test/tests/gc/bug-1282986.js +++ b/js/src/jit-test/tests/gc/bug-1282986.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var lfLogBuffer = ` evalInWorker(\` try { oomAfterAllocations(2); } catch(e) {} diff --git a/js/src/jit-test/tests/gc/bug-1287399.js b/js/src/jit-test/tests/gc/bug-1287399.js index c7e6b8f44d..c7345954f6 100644 --- a/js/src/jit-test/tests/gc/bug-1287399.js +++ b/js/src/jit-test/tests/gc/bug-1287399.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: typeof gczeal !== 'function' || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 var lfGlobal = newGlobal(); gczeal(4); diff --git a/js/src/jit-test/tests/gc/bug-1287869.js b/js/src/jit-test/tests/gc/bug-1287869.js index dc04345ccf..7175342655 100644 --- a/js/src/jit-test/tests/gc/bug-1287869.js +++ b/js/src/jit-test/tests/gc/bug-1287869.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) - gczeal(16); let a = []; for (let i = 0; i < 1000; i++) diff --git a/js/src/jit-test/tests/gc/bug-1292564.js b/js/src/jit-test/tests/gc/bug-1292564.js index f292e1682c..56918093f8 100644 --- a/js/src/jit-test/tests/gc/bug-1292564.js +++ b/js/src/jit-test/tests/gc/bug-1292564.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom oomTest(() => { let global = newGlobal({sameZoneAs: this}); diff --git a/js/src/jit-test/tests/gc/bug-1298356.js b/js/src/jit-test/tests/gc/bug-1298356.js index 4c8a213125..78a492649d 100644 --- a/js/src/jit-test/tests/gc/bug-1298356.js +++ b/js/src/jit-test/tests/gc/bug-1298356.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - /x/; oomTest(function(){ offThreadCompileToStencil(''); diff --git a/js/src/jit-test/tests/gc/bug-1303015.js b/js/src/jit-test/tests/gc/bug-1303015.js index d5b5e3a5bd..021db0568d 100644 --- a/js/src/jit-test/tests/gc/bug-1303015.js +++ b/js/src/jit-test/tests/gc/bug-1303015.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow var x = ``.split(); oomTest(function() { diff --git a/js/src/jit-test/tests/gc/bug-1305220.js b/js/src/jit-test/tests/gc/bug-1305220.js index b6dad199a9..0666530bb9 100644 --- a/js/src/jit-test/tests/gc/bug-1305220.js +++ b/js/src/jit-test/tests/gc/bug-1305220.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations s = newGlobal(); evalcx("\ diff --git a/js/src/jit-test/tests/gc/bug-1310589.js b/js/src/jit-test/tests/gc/bug-1310589.js index 2907c3c440..98b045050c 100644 --- a/js/src/jit-test/tests/gc/bug-1310589.js +++ b/js/src/jit-test/tests/gc/bug-1310589.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - a = o = s = r = [] o2 = s2 = r2 = g2 = f2 = m2 = Map e2 = Set diff --git a/js/src/jit-test/tests/gc/bug-1315946.js b/js/src/jit-test/tests/gc/bug-1315946.js index a0668d00b5..8e95a97d20 100644 --- a/js/src/jit-test/tests/gc/bug-1315946.js +++ b/js/src/jit-test/tests/gc/bug-1315946.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // Don't run a full oomTest because it takes ages - a few iterations are // sufficient to trigger the bug. let i = 0; diff --git a/js/src/jit-test/tests/gc/bug-1325551.js b/js/src/jit-test/tests/gc/bug-1325551.js index 700f61daf8..8c4499a01e 100644 --- a/js/src/jit-test/tests/gc/bug-1325551.js +++ b/js/src/jit-test/tests/gc/bug-1325551.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - let g = newGlobal({newCompartment: true}); let dbg = new Debugger; let gw = dbg.addDebuggee(g); diff --git a/js/src/jit-test/tests/gc/bug-1340010.js b/js/src/jit-test/tests/gc/bug-1340010.js index 30c3cb08b9..22ceafce6f 100644 --- a/js/src/jit-test/tests/gc/bug-1340010.js +++ b/js/src/jit-test/tests/gc/bug-1340010.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: helperThreadCount() === 0 || !('deterministicgc' in this) +// |jit-test| skip-if: helperThreadCount() === 0 gczeal(0); gc(); diff --git a/js/src/jit-test/tests/gc/bug-1384047.js b/js/src/jit-test/tests/gc/bug-1384047.js index 4ec6a5272d..162af6af42 100644 --- a/js/src/jit-test/tests/gc/bug-1384047.js +++ b/js/src/jit-test/tests/gc/bug-1384047.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - +// |jit-test| skip-if: !hasFunction.oomTest newGlobal(); evalcx("oomTest(newGlobal);", newGlobal()); diff --git a/js/src/jit-test/tests/gc/bug-1401141.js b/js/src/jit-test/tests/gc/bug-1401141.js index 6ed1bea611..2674f77c37 100644 --- a/js/src/jit-test/tests/gc/bug-1401141.js +++ b/js/src/jit-test/tests/gc/bug-1401141.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('gczeal' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 gczeal(15,1); setGCCallback({ diff --git a/js/src/jit-test/tests/gc/bug-1411302.js b/js/src/jit-test/tests/gc/bug-1411302.js index 20c051edd9..510648b742 100644 --- a/js/src/jit-test/tests/gc/bug-1411302.js +++ b/js/src/jit-test/tests/gc/bug-1411302.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - let lfPreamble = ` value:{ `; diff --git a/js/src/jit-test/tests/gc/bug-1435295.js b/js/src/jit-test/tests/gc/bug-1435295.js index 01214a6214..0f091b7d49 100644 --- a/js/src/jit-test/tests/gc/bug-1435295.js +++ b/js/src/jit-test/tests/gc/bug-1435295.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: helperThreadCount() === 0 || !('oomTest' in this) +// |jit-test| skip-if: helperThreadCount() === 0 oomTest(new Function(`function execOffThread(source) { offThreadCompileModuleToStencil(source); diff --git a/js/src/jit-test/tests/gc/bug-1449887.js b/js/src/jit-test/tests/gc/bug-1449887.js index ef7fa45c7f..c5732b0723 100644 --- a/js/src/jit-test/tests/gc/bug-1449887.js +++ b/js/src/jit-test/tests/gc/bug-1449887.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { x, 0, { z: function() {} } }); diff --git a/js/src/jit-test/tests/gc/bug-1456536.js b/js/src/jit-test/tests/gc/bug-1456536.js index adfe3f0c9b..b61f5ca09c 100644 --- a/js/src/jit-test/tests/gc/bug-1456536.js +++ b/js/src/jit-test/tests/gc/bug-1456536.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(new Function(`let a = grayRoot();`)); diff --git a/js/src/jit-test/tests/gc/bug-1462337.js b/js/src/jit-test/tests/gc/bug-1462337.js index 84a5392a1f..1eaafc4997 100644 --- a/js/src/jit-test/tests/gc/bug-1462337.js +++ b/js/src/jit-test/tests/gc/bug-1462337.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { grayRoot().x = Object.create((obj[name]++)); }); diff --git a/js/src/jit-test/tests/gc/bug-1472734.js b/js/src/jit-test/tests/gc/bug-1472734.js index f88f3af1c6..2d4432743d 100644 --- a/js/src/jit-test/tests/gc/bug-1472734.js +++ b/js/src/jit-test/tests/gc/bug-1472734.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 try { oomTest(function() { diff --git a/js/src/jit-test/tests/gc/bug-1490042.js b/js/src/jit-test/tests/gc/bug-1490042.js index b043f25486..937ae41ef3 100644 --- a/js/src/jit-test/tests/gc/bug-1490042.js +++ b/js/src/jit-test/tests/gc/bug-1490042.js @@ -1,4 +1,4 @@ -// |jit-test| --no-ion; --no-baseline; --no-blinterp; skip-if: !('gcstate' in this && 'oomAfterAllocations' in this) +// |jit-test| --no-ion; --no-baseline; --no-blinterp; skip-if: !('gcstate' in this && hasFunction.oomAfterAllocations) gczeal(0); diff --git a/js/src/jit-test/tests/gc/bug-1530643.js b/js/src/jit-test/tests/gc/bug-1530643.js index c85e6267c6..fa61063ea9 100644 --- a/js/src/jit-test/tests/gc/bug-1530643.js +++ b/js/src/jit-test/tests/gc/bug-1530643.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomAtAllocation' in this); error: Error +// |jit-test| skip-if: !hasFunction.oomAtAllocation; error: Error const THREAD_TYPE_WORKER = 10; diff --git a/js/src/jit-test/tests/gc/bug-1556155.js b/js/src/jit-test/tests/gc/bug-1556155.js index 3c0dd11251..9bf2648131 100644 --- a/js/src/jit-test/tests/gc/bug-1556155.js +++ b/js/src/jit-test/tests/gc/bug-1556155.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) a = []; minorgc(); Object.defineProperty(a, 12, {}).push(1); diff --git a/js/src/jit-test/tests/gc/bug-1568119.js b/js/src/jit-test/tests/gc/bug-1568119.js index 1aed85c325..ccba9e1a72 100644 --- a/js/src/jit-test/tests/gc/bug-1568119.js +++ b/js/src/jit-test/tests/gc/bug-1568119.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function allocateSomeStuff() { return {a: "a fish", b: [1, 2, 3]}; } diff --git a/js/src/jit-test/tests/gc/bug-1574877.js b/js/src/jit-test/tests/gc/bug-1574877.js index e53746bcb0..09b5b9e6b0 100644 --- a/js/src/jit-test/tests/gc/bug-1574877.js +++ b/js/src/jit-test/tests/gc/bug-1574877.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function parseModule(source) { offThreadCompileModuleToStencil(source); var stencil = finishOffThreadStencil(); diff --git a/js/src/jit-test/tests/gc/bug-1648901.js b/js/src/jit-test/tests/gc/bug-1648901.js index 13e4895068..2eddbd9a3c 100644 --- a/js/src/jit-test/tests/gc/bug-1648901.js +++ b/js/src/jit-test/tests/gc/bug-1648901.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) - gczeal(15); enableShellAllocationMetadataBuilder(); var registry = new FinalizationRegistry(x => 0); diff --git a/js/src/jit-test/tests/gc/bug-1654186.js b/js/src/jit-test/tests/gc/bug-1654186.js index 562938d8f8..e6db718bb2 100644 --- a/js/src/jit-test/tests/gc/bug-1654186.js +++ b/js/src/jit-test/tests/gc/bug-1654186.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom; skip-if: !hasFunction.oomAfterAllocations gczeal(14, 5); var g = newGlobal(); diff --git a/js/src/jit-test/tests/gc/bug-1657554.js b/js/src/jit-test/tests/gc/bug-1657554.js index f751d442b9..f8dd0282b6 100644 --- a/js/src/jit-test/tests/gc/bug-1657554.js +++ b/js/src/jit-test/tests/gc/bug-1657554.js @@ -1,2 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(() => eval("new WeakRef({});")); diff --git a/js/src/jit-test/tests/gc/bug-1660293.js b/js/src/jit-test/tests/gc/bug-1660293.js index a2c953c11f..c7e3f46c9a 100644 --- a/js/src/jit-test/tests/gc/bug-1660293.js +++ b/js/src/jit-test/tests/gc/bug-1660293.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this) - try { function varying(mapColor, keyColor) { enqueueMark(`set-color-${keyColor}`); diff --git a/js/src/jit-test/tests/gc/bug-1689039.js b/js/src/jit-test/tests/gc/bug-1689039.js index 4bfe9bd140..a5d3c71106 100644 --- a/js/src/jit-test/tests/gc/bug-1689039.js +++ b/js/src/jit-test/tests/gc/bug-1689039.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this) - gczeal(7); for (let i = 0; i < 9999; ++i) { undefined + "y"; diff --git a/js/src/jit-test/tests/gc/bug-1692221.js b/js/src/jit-test/tests/gc/bug-1692221.js index 6300788ad9..11bd4a3aea 100644 --- a/js/src/jit-test/tests/gc/bug-1692221.js +++ b/js/src/jit-test/tests/gc/bug-1692221.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAtAllocation' in this) +// |jit-test| allow-oom // Test TenuredChunk::decommitFreeArenasWithoutUnlocking updates chunk // metadata correctly. The data is checked by assertions so this test is about diff --git a/js/src/jit-test/tests/gc/bug-1791975.js b/js/src/jit-test/tests/gc/bug-1791975.js index a194a92dd0..f56f723db7 100644 --- a/js/src/jit-test/tests/gc/bug-1791975.js +++ b/js/src/jit-test/tests/gc/bug-1791975.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAtAllocation' in this) - gczeal(10, 10); try { throw 0; diff --git a/js/src/jit-test/tests/gc/bug-1802478.js b/js/src/jit-test/tests/gc/bug-1802478.js index 05559c3f6f..d37188d576 100644 --- a/js/src/jit-test/tests/gc/bug-1802478.js +++ b/js/src/jit-test/tests/gc/bug-1802478.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this) - enableTrackAllocations(); for (a of "x") { gczeal(2, 1); diff --git a/js/src/jit-test/tests/gc/bug-1804629.js b/js/src/jit-test/tests/gc/bug-1804629.js index 6ed62eec8c..84c473c347 100644 --- a/js/src/jit-test/tests/gc/bug-1804629.js +++ b/js/src/jit-test/tests/gc/bug-1804629.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('gczeal' in this); error: ReferenceError +// |jit-test| error: ReferenceError gczeal(0); setMarkStackLimit(1); diff --git a/js/src/jit-test/tests/gc/bug-1865597.js b/js/src/jit-test/tests/gc/bug-1865597.js index 4bc7ff3a4d..451b806294 100644 --- a/js/src/jit-test/tests/gc/bug-1865597.js +++ b/js/src/jit-test/tests/gc/bug-1865597.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { gcparam('parallelMarkingEnabled', false); assertEq(gcparam('parallelMarkingEnabled'), 0); diff --git a/js/src/jit-test/tests/gc/bug-1870925.js b/js/src/jit-test/tests/gc/bug-1870925.js new file mode 100644 index 0000000000..48182a04e4 --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-1870925.js @@ -0,0 +1,14 @@ +// |jit-test| --no-ggc + +let x = [[]]; +for (let i = 0; i < 25; i++) { + for (let j = 0; j < 25; j++) { + (function () { + x[i] | 0; + })(); + } +} + +verifyprebarriers(); +bailAfter(1); +verifyprebarriers(); diff --git a/js/src/jit-test/tests/gc/bug-1871186.js b/js/src/jit-test/tests/gc/bug-1871186.js index fc4620fa65..260356ab8b 100644 --- a/js/src/jit-test/tests/gc/bug-1871186.js +++ b/js/src/jit-test/tests/gc/bug-1871186.js @@ -1,4 +1,4 @@ -// |jit-test| --blinterp-eager; skip-if: !('oomTest' in this) +// |jit-test| --blinterp-eager gc(); function f(x) { diff --git a/js/src/jit-test/tests/gc/bug-1877406.js b/js/src/jit-test/tests/gc/bug-1877406.js index bcb26ed062..d412abe82c 100644 --- a/js/src/jit-test/tests/gc/bug-1877406.js +++ b/js/src/jit-test/tests/gc/bug-1877406.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this); --fuzzing-safe +// |jit-test| --fuzzing-safe oomTest(Debugger); oomTest(Debugger); diff --git a/js/src/jit-test/tests/gc/bug-1880870.js b/js/src/jit-test/tests/gc/bug-1880870.js new file mode 100644 index 0000000000..e9bffc9295 --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-1880870.js @@ -0,0 +1,6 @@ +var x = []; +function f() { + Object.entries(x); + Object.defineProperty(x, "", { enumerable: true, get: f }); +} +oomTest(f); diff --git a/js/src/jit-test/tests/gc/bug-1881417.js b/js/src/jit-test/tests/gc/bug-1881417.js new file mode 100644 index 0000000000..f79d7d5c33 --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-1881417.js @@ -0,0 +1,12 @@ +for (let x = 0; x < 2; (function() { x++; })()) {}; +function f() { + var y = new (function () {})(); + (function () { + Reflect.apply(y.toString, [], [0]); + })(); +} +f(); +var z = []; +z.keepFailing = []; +oomTest(f, z); +dumpHeap(); diff --git a/js/src/jit-test/tests/gc/bug-1884746.js b/js/src/jit-test/tests/gc/bug-1884746.js new file mode 100644 index 0000000000..5dab465dac --- /dev/null +++ b/js/src/jit-test/tests/gc/bug-1884746.js @@ -0,0 +1,7 @@ +var x = newGlobal().Int8Array; +for (let i = 0; i < 2; i++) { + function f() {} + oomTest(function() { + new x().__proto__ = f; + }); +} diff --git a/js/src/jit-test/tests/gc/bug-978802.js b/js/src/jit-test/tests/gc/bug-978802.js index 1e13b76e0e..42b3553488 100644 --- a/js/src/jit-test/tests/gc/bug-978802.js +++ b/js/src/jit-test/tests/gc/bug-978802.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { try { var max = 400; diff --git a/js/src/jit-test/tests/gc/bug1246607.js b/js/src/jit-test/tests/gc/bug1246607.js index 1fbe9e5208..222fd20ed3 100644 --- a/js/src/jit-test/tests/gc/bug1246607.js +++ b/js/src/jit-test/tests/gc/bug1246607.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: typeof oomTest !== 'function' || typeof Intl !== 'object' +// |jit-test| skip-if: typeof Intl !== 'object' oomTest(() => { try { diff --git a/js/src/jit-test/tests/gc/bug1326343-gcstats.js b/js/src/jit-test/tests/gc/bug1326343-gcstats.js index f29306af4c..fa0190284d 100644 --- a/js/src/jit-test/tests/gc/bug1326343-gcstats.js +++ b/js/src/jit-test/tests/gc/bug1326343-gcstats.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - setJitCompilerOption('baseline.warmup.trigger', 4); oomTest((function () { gcslice(0); diff --git a/js/src/jit-test/tests/gc/bug1337324.js b/js/src/jit-test/tests/gc/bug1337324.js index eaf4c080f0..5ca628fc1d 100644 --- a/js/src/jit-test/tests/gc/bug1337324.js +++ b/js/src/jit-test/tests/gc/bug1337324.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(function () { offThreadCompileModuleToStencil(''); var stencil = finishOffThreadStencil(); diff --git a/js/src/jit-test/tests/gc/bug1471949.js b/js/src/jit-test/tests/gc/bug1471949.js index 5f0f10f4df..30853bf0ff 100644 --- a/js/src/jit-test/tests/gc/bug1471949.js +++ b/js/src/jit-test/tests/gc/bug1471949.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom gczeal(15); oomAfterAllocations(5); diff --git a/js/src/jit-test/tests/gc/bug1704451.js b/js/src/jit-test/tests/gc/bug1704451.js index d4b4d14995..426506e9fc 100644 --- a/js/src/jit-test/tests/gc/bug1704451.js +++ b/js/src/jit-test/tests/gc/bug1704451.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) - enableShellAllocationMetadataBuilder(); gczeal(9,1); var o86 = {x76: 1, y86: 2}; diff --git a/js/src/jit-test/tests/gc/finalizationRegistry-oom1.js b/js/src/jit-test/tests/gc/finalizationRegistry-oom1.js index 753448a650..83295bb702 100644 --- a/js/src/jit-test/tests/gc/finalizationRegistry-oom1.js +++ b/js/src/jit-test/tests/gc/finalizationRegistry-oom1.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // Don't test prototype initialization etc. new FinalizationRegistry(x => 0); diff --git a/js/src/jit-test/tests/gc/finalizationRegistry-oom2.js b/js/src/jit-test/tests/gc/finalizationRegistry-oom2.js index 9d9b2a7db8..c63307dfb0 100644 --- a/js/src/jit-test/tests/gc/finalizationRegistry-oom2.js +++ b/js/src/jit-test/tests/gc/finalizationRegistry-oom2.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) let registry = new FinalizationRegistry(x => 0); let token = {}; oomTest(() => registry.register({}, 1, token)); diff --git a/js/src/jit-test/tests/gc/finalizationRegistry-oom3.js b/js/src/jit-test/tests/gc/finalizationRegistry-oom3.js index d606ad8ba8..bcde1cc6c6 100644 --- a/js/src/jit-test/tests/gc/finalizationRegistry-oom3.js +++ b/js/src/jit-test/tests/gc/finalizationRegistry-oom3.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) let registry = new FinalizationRegistry(x => 0); registry.register({}, 1, {}); let token = {}; diff --git a/js/src/jit-test/tests/gc/finalizationRegistry-oom4.js b/js/src/jit-test/tests/gc/finalizationRegistry-oom4.js index 4b7ef66ba0..03defb8558 100644 --- a/js/src/jit-test/tests/gc/finalizationRegistry-oom4.js +++ b/js/src/jit-test/tests/gc/finalizationRegistry-oom4.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) let registry = new FinalizationRegistry(x => 0); let target = {}; let token = {}; diff --git a/js/src/jit-test/tests/gc/gcparam.js b/js/src/jit-test/tests/gc/gcparam.js index f1077e335f..05e0359088 100644 --- a/js/src/jit-test/tests/gc/gcparam.js +++ b/js/src/jit-test/tests/gc/gcparam.js @@ -52,12 +52,11 @@ testChangeParam("compactingEnabled"); testChangeParam("parallelMarkingEnabled"); testChangeParam("parallelMarkingThresholdMB"); testChangeParam("minLastDitchGCPeriod"); -testChangeParam("nurseryFreeThresholdForIdleCollection"); -testChangeParam("nurseryFreeThresholdForIdleCollectionPercent"); -testChangeParam("nurseryTimeoutForIdleCollectionMS"); +testChangeParam("nurseryEagerCollectionThresholdKB"); +testChangeParam("nurseryEagerCollectionThresholdPercent"); +testChangeParam("nurseryEagerCollectionTimeoutMS"); testChangeParam("zoneAllocDelayKB"); testChangeParam("mallocThresholdBase"); testChangeParam("urgentThreshold"); -testChangeParam("nurseryTimeoutForIdleCollectionMS"); testChangeParam("helperThreadRatio"); testChangeParam("maxHelperThreads"); diff --git a/js/src/jit-test/tests/gc/incremental-compacting.js b/js/src/jit-test/tests/gc/incremental-compacting.js index f051cf60ea..c60ec28722 100644 --- a/js/src/jit-test/tests/gc/incremental-compacting.js +++ b/js/src/jit-test/tests/gc/incremental-compacting.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !("gcstate" in this && "gczeal" in this) - // Exercise incremental compacting GC // Run with MOZ_GCTIMER to see the timings diff --git a/js/src/jit-test/tests/gc/oomInArrayProtoTest.js b/js/src/jit-test/tests/gc/oomInArrayProtoTest.js index b99669d92d..3e3365cde5 100644 --- a/js/src/jit-test/tests/gc/oomInArrayProtoTest.js +++ b/js/src/jit-test/tests/gc/oomInArrayProtoTest.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function arrayProtoOutOfRange() { function f(obj) { return typeof obj[15]; diff --git a/js/src/jit-test/tests/gc/oomInByteSize.js b/js/src/jit-test/tests/gc/oomInByteSize.js index 9566b9cb49..5f9aa0059a 100644 --- a/js/src/jit-test/tests/gc/oomInByteSize.js +++ b/js/src/jit-test/tests/gc/oomInByteSize.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => byteSize({})); oomTest(() => byteSize({ w: 1, x: 2, y: 3 })); oomTest(() => byteSize({ w:1, x:2, y:3, z:4, a:6, 0:0, 1:1, 2:2 })); diff --git a/js/src/jit-test/tests/gc/oomInDebugger.js b/js/src/jit-test/tests/gc/oomInDebugger.js index c1904f573a..959f2f7f4f 100644 --- a/js/src/jit-test/tests/gc/oomInDebugger.js +++ b/js/src/jit-test/tests/gc/oomInDebugger.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - var g = newGlobal(); oomTest(() => Debugger(g)); diff --git a/js/src/jit-test/tests/gc/oomInDtoa.js b/js/src/jit-test/tests/gc/oomInDtoa.js index 83ded51cbb..6f37137e51 100644 --- a/js/src/jit-test/tests/gc/oomInDtoa.js +++ b/js/src/jit-test/tests/gc/oomInDtoa.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { return 1e300; }) diff --git a/js/src/jit-test/tests/gc/oomInExceptionHandlerBailout.js b/js/src/jit-test/tests/gc/oomInExceptionHandlerBailout.js index d5c8f29b27..cdd20cd9b7 100644 --- a/js/src/jit-test/tests/gc/oomInExceptionHandlerBailout.js +++ b/js/src/jit-test/tests/gc/oomInExceptionHandlerBailout.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(() => { let x = 0; try { diff --git a/js/src/jit-test/tests/gc/oomInFindPath.js b/js/src/jit-test/tests/gc/oomInFindPath.js index 4b3d95688c..cacf587699 100644 --- a/js/src/jit-test/tests/gc/oomInFindPath.js +++ b/js/src/jit-test/tests/gc/oomInFindPath.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var o = { w: { x: { y: { z: {} } } } }; oomTest(() => findPath(o, o.w.x.y.z)); diff --git a/js/src/jit-test/tests/gc/oomInFormatStackDump.js b/js/src/jit-test/tests/gc/oomInFormatStackDump.js index ce68e47f9e..59e4921f93 100644 --- a/js/src/jit-test/tests/gc/oomInFormatStackDump.js +++ b/js/src/jit-test/tests/gc/oomInFormatStackDump.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => getBacktrace({args: true, locals: true, thisprops: true})); diff --git a/js/src/jit-test/tests/gc/oomInGetJumpLabelForBranch.js b/js/src/jit-test/tests/gc/oomInGetJumpLabelForBranch.js index a568fc592f..8415c9ac6c 100644 --- a/js/src/jit-test/tests/gc/oomInGetJumpLabelForBranch.js +++ b/js/src/jit-test/tests/gc/oomInGetJumpLabelForBranch.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => getBacktrace({thisprops: gc() && delete addDebuggee.enabled})); diff --git a/js/src/jit-test/tests/gc/oomInNewGlobal.js b/js/src/jit-test/tests/gc/oomInNewGlobal.js index c45737e143..92e8385063 100644 --- a/js/src/jit-test/tests/gc/oomInNewGlobal.js +++ b/js/src/jit-test/tests/gc/oomInNewGlobal.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(newGlobal); diff --git a/js/src/jit-test/tests/gc/oomInOffTheadCompile.js b/js/src/jit-test/tests/gc/oomInOffTheadCompile.js index d4e0d4135e..65a2fe443c 100644 --- a/js/src/jit-test/tests/gc/oomInOffTheadCompile.js +++ b/js/src/jit-test/tests/gc/oomInOffTheadCompile.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 oomTest(() => { offThreadCompileToStencil( diff --git a/js/src/jit-test/tests/gc/oomInOffTheadCompile2.js b/js/src/jit-test/tests/gc/oomInOffTheadCompile2.js index 1cac5ee859..de4ad4106d 100644 --- a/js/src/jit-test/tests/gc/oomInOffTheadCompile2.js +++ b/js/src/jit-test/tests/gc/oomInOffTheadCompile2.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 oomTest(() => { offThreadCompileToStencil("function a(x) {"); diff --git a/js/src/jit-test/tests/gc/oomInOffTheadCompile3.js b/js/src/jit-test/tests/gc/oomInOffTheadCompile3.js index 6535676b72..5e0816f575 100644 --- a/js/src/jit-test/tests/gc/oomInOffTheadCompile3.js +++ b/js/src/jit-test/tests/gc/oomInOffTheadCompile3.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 oomTest(() => { offThreadCompileToStencil(` diff --git a/js/src/jit-test/tests/gc/oomInParseAsmJS.js b/js/src/jit-test/tests/gc/oomInParseAsmJS.js index 72216e1c2c..e2d8441897 100644 --- a/js/src/jit-test/tests/gc/oomInParseAsmJS.js +++ b/js/src/jit-test/tests/gc/oomInParseAsmJS.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function parseAsmJS() { eval(`function m(stdlib) { diff --git a/js/src/jit-test/tests/gc/oomInParseFunction.js b/js/src/jit-test/tests/gc/oomInParseFunction.js index b1c1bd6297..c7471a7e60 100644 --- a/js/src/jit-test/tests/gc/oomInParseFunction.js +++ b/js/src/jit-test/tests/gc/oomInParseFunction.js @@ -1,3 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => eval("function f() {}")); diff --git a/js/src/jit-test/tests/gc/oomInRegExp.js b/js/src/jit-test/tests/gc/oomInRegExp.js index b58f0ac50d..6564fda35b 100644 --- a/js/src/jit-test/tests/gc/oomInRegExp.js +++ b/js/src/jit-test/tests/gc/oomInRegExp.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => assertEq("foobar\xff5baz\u1200".search(/bar\u0178\d/i), 3)); oomTest(() => assertEq((/(?!(?!(?!6)[\Wc]))/i).test(), false)); oomTest(() => assertEq((/bar\u0178\d/i).exec("foobar\xff5baz\u1200") != null, true)); diff --git a/js/src/jit-test/tests/gc/oomInRegExp2.js b/js/src/jit-test/tests/gc/oomInRegExp2.js index c35075b375..8783435424 100644 --- a/js/src/jit-test/tests/gc/oomInRegExp2.js +++ b/js/src/jit-test/tests/gc/oomInRegExp2.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => assertEq("foobar\xff5baz\u1200".search(/bar\u0178\d/i), 3), {keepFailing: true}); oomTest(() => assertEq((/(?!(?!(?!6)[\Wc]))/i).test(), false), {keepFailing: true}); oomTest(() => assertEq((/bar\u0178\d/i).exec("foobar\xff5baz\u1200") != null, true), {keepFailing: true}); diff --git a/js/src/jit-test/tests/gc/oomInWeakMap.js b/js/src/jit-test/tests/gc/oomInWeakMap.js index 522dc24738..0992907ed7 100644 --- a/js/src/jit-test/tests/gc/oomInWeakMap.js +++ b/js/src/jit-test/tests/gc/oomInWeakMap.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function () { eval(`var wm = new WeakMap(); wm.set({}, 'FOO').get(false);`); diff --git a/js/src/jit-test/tests/generators/bug1501722.js b/js/src/jit-test/tests/generators/bug1501722.js index 9ff2724a9f..9ff5df1792 100644 --- a/js/src/jit-test/tests/generators/bug1501722.js +++ b/js/src/jit-test/tests/generators/bug1501722.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - ignoreUnhandledRejections(); (function () { diff --git a/js/src/jit-test/tests/ion/array-push-multiple-frozen.js b/js/src/jit-test/tests/ion/array-push-multiple-frozen.js index 271f6cb07a..da2c7a9262 100644 --- a/js/src/jit-test/tests/ion/array-push-multiple-frozen.js +++ b/js/src/jit-test/tests/ion/array-push-multiple-frozen.js @@ -1,4 +1,4 @@ -// |jit-test| --no-threads; skip-if: !('oomAtAllocation' in this) +// |jit-test| --no-threads // This test case check's Ion ability to recover from an allocation failure in // the inlining of Array.prototype.push, when given multiple arguments. Note, diff --git a/js/src/jit-test/tests/ion/array-push-multiple-with-funapply.js b/js/src/jit-test/tests/ion/array-push-multiple-with-funapply.js index b09fa9c440..0d3f174d9d 100644 --- a/js/src/jit-test/tests/ion/array-push-multiple-with-funapply.js +++ b/js/src/jit-test/tests/ion/array-push-multiple-with-funapply.js @@ -1,4 +1,4 @@ -// |jit-test| --no-threads; skip-if: !('oomAtAllocation' in this) +// |jit-test| --no-threads // This test case check's Ion ability to inline Array.prototype.push, when // fun.apply is used and inlined with the set of arguments of the current diff --git a/js/src/jit-test/tests/ion/array-push-multiple.js b/js/src/jit-test/tests/ion/array-push-multiple.js index 19c1a93e70..8287d07c94 100644 --- a/js/src/jit-test/tests/ion/array-push-multiple.js +++ b/js/src/jit-test/tests/ion/array-push-multiple.js @@ -1,4 +1,4 @@ -// |jit-test| --no-threads; skip-if: !('oomAtAllocation' in this) +// |jit-test| --no-threads // This test case check's Ion ability to recover from an allocation failure in // the inlining of Array.prototype.push, when given multiple arguments. Note, diff --git a/js/src/jit-test/tests/ion/bailout-oom-01.js b/js/src/jit-test/tests/ion/bailout-oom-01.js index b56b323774..0408f44e98 100644 --- a/js/src/jit-test/tests/ion/bailout-oom-01.js +++ b/js/src/jit-test/tests/ion/bailout-oom-01.js @@ -1,4 +1,4 @@ -// |jit-test| --no-threads; --fast-warmup; skip-if: !('oomTest' in this) +// |jit-test| --no-threads; --fast-warmup setJitCompilerOption("ion.warmup.trigger", 20); gczeal(0); diff --git a/js/src/jit-test/tests/ion/bug1207413.js b/js/src/jit-test/tests/ion/bug1207413.js index aedb8ece30..e2d5652b33 100644 --- a/js/src/jit-test/tests/ion/bug1207413.js +++ b/js/src/jit-test/tests/ion/bug1207413.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this) - function first(a) { return a[0]; } diff --git a/js/src/jit-test/tests/ion/bug1216157.js b/js/src/jit-test/tests/ion/bug1216157.js index 1ec9497e40..01a654502b 100644 --- a/js/src/jit-test/tests/ion/bug1216157.js +++ b/js/src/jit-test/tests/ion/bug1216157.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this); allow-oom +// |jit-test| allow-oom gcslice(0); // Start IGC, but don't mark anything. function f(str) { diff --git a/js/src/jit-test/tests/ion/bug1233331.js b/js/src/jit-test/tests/ion/bug1233331.js index 11b8faafd1..b181dfb856 100644 --- a/js/src/jit-test/tests/ion/bug1233331.js +++ b/js/src/jit-test/tests/ion/bug1233331.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - x = 0; try { a; diff --git a/js/src/jit-test/tests/ion/bug1240521.js b/js/src/jit-test/tests/ion/bug1240521.js index 5955705b7a..3160be7a7d 100644 --- a/js/src/jit-test/tests/ion/bug1240521.js +++ b/js/src/jit-test/tests/ion/bug1240521.js @@ -1,4 +1,4 @@ -// |jit-test| allow-oom; skip-if: !('oomAfterAllocations' in this) +// |jit-test| allow-oom var egc = 138; function SwitchTest(value) { diff --git a/js/src/jit-test/tests/ion/bug1269756.js b/js/src/jit-test/tests/ion/bug1269756.js index 659805f16c..1e201f18a4 100644 --- a/js/src/jit-test/tests/ion/bug1269756.js +++ b/js/src/jit-test/tests/ion/bug1269756.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(function() { m = parseModule(`while (x && NaN) prototype; let x`); moduleLink(m); diff --git a/js/src/jit-test/tests/ion/bug1284491.js b/js/src/jit-test/tests/ion/bug1284491.js index eb8f15619b..f061536bb1 100644 --- a/js/src/jit-test/tests/ion/bug1284491.js +++ b/js/src/jit-test/tests/ion/bug1284491.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - loadFile(` function SwitchTest(){ switch(value) { diff --git a/js/src/jit-test/tests/ion/bug1394505.js b/js/src/jit-test/tests/ion/bug1394505.js index 84979c046c..49c24d7ec6 100644 --- a/js/src/jit-test/tests/ion/bug1394505.js +++ b/js/src/jit-test/tests/ion/bug1394505.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: helperThreadCount() === 0 || !('oomTest' in this) +// |jit-test| skip-if: helperThreadCount() === 0 for (let j = 0; j < 50; j++) { if (j === 1) diff --git a/js/src/jit-test/tests/ion/bug1479394.js b/js/src/jit-test/tests/ion/bug1479394.js index ef33e35b20..7123a280d9 100644 --- a/js/src/jit-test/tests/ion/bug1479394.js +++ b/js/src/jit-test/tests/ion/bug1479394.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('stackTest' in this) var dbgGlobal = newGlobal({newCompartment: true}); var dbg = new dbgGlobal.Debugger(this); function f1() { diff --git a/js/src/jit-test/tests/ion/bug1492574.js b/js/src/jit-test/tests/ion/bug1492574.js index c1ce0c000a..070d69eaf7 100644 --- a/js/src/jit-test/tests/ion/bug1492574.js +++ b/js/src/jit-test/tests/ion/bug1492574.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function foo() {} function foooooooooooooooooooooooooooooooo() {} function fn(s) { diff --git a/js/src/jit-test/tests/ion/bug1568397.js b/js/src/jit-test/tests/ion/bug1568397.js index c03bb0283d..68fd83a226 100644 --- a/js/src/jit-test/tests/ion/bug1568397.js +++ b/js/src/jit-test/tests/ion/bug1568397.js @@ -1,4 +1,4 @@ -// |jit-test| error:TypeError: can't access property +// |jit-test| --setpref=property_error_message_fix=true; error:TypeError: can't access property "x" let obj = {x: 1}; obj.x = 1.1; diff --git a/js/src/jit-test/tests/ion/bug1877357.js b/js/src/jit-test/tests/ion/bug1877357.js new file mode 100644 index 0000000000..b1e0d9c686 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug1877357.js @@ -0,0 +1,17 @@ +function f(x) { + let y = x | 0; + z = 1; + Function((x | 0 ? 1 : 9999999999) ? (z ? y : 9999999999) : 1); +} +f(1); +f(1); +f(1); +f(1); +f(1); +f(1); +f(1); +f(1); +f(9999999999); +f(1); +f(); +f(9007199254740993); diff --git a/js/src/jit-test/tests/ion/bug1877709.js b/js/src/jit-test/tests/ion/bug1877709.js new file mode 100644 index 0000000000..1dac277a90 --- /dev/null +++ b/js/src/jit-test/tests/ion/bug1877709.js @@ -0,0 +1,22 @@ +function testMathyFunction (f, inputs) { + var results = []; + for (var j = 0; j < inputs.length; ++j) + for (var k = 0; k < inputs.length; ++k) + results.push(f(inputs[j], inputs[k])); +} +mathy1=(function(stdlib,foreign,heap){ + ff = foreign.ff; + Float32ArrayView = new stdlib.Float32Array(heap); + Uint32ArrayView = new stdlib.Uint32Array(heap); + function f(d0) { + var i2=0; + var i4; + i2=Float32ArrayView[2]; + i4=i2; + ff(2,0) ? f : 6; + Uint32ArrayView[!!d0] + [...[eval]] + return i4 ? 1 : 0; + } +return f +})(this,{ ff:(Function('')) },new SharedArrayBuffer(40)); +testMathyFunction(mathy1,[Math.N,Number.M,(2),Number.M]) diff --git a/js/src/jit-test/tests/ion/dce-with-rinstructions.js b/js/src/jit-test/tests/ion/dce-with-rinstructions.js index 481a1279ec..5fd530fde4 100644 --- a/js/src/jit-test/tests/ion/dce-with-rinstructions.js +++ b/js/src/jit-test/tests/ion/dce-with-rinstructions.js @@ -1983,6 +1983,26 @@ function rnantozero_negzero(i) { return i; } +let uceFault_ratomicsislockfree_true = eval(`(${uceFault})`.replace('uceFault', 'uceFault_ratomicsislockfree_true')); +function ratomicsislockfree_true(i) { + var x = [1, 2, 4, 8][i & 3]; + var y = Atomics.isLockFree(x); + if (uceFault_ratomicsislockfree_true(i) || uceFault_ratomicsislockfree_true(i)) + assertEq(y, true); + assertRecoveredOnBailout(y, true); + return i; +} + +let uceFault_ratomicsislockfree_false = eval(`(${uceFault})`.replace('uceFault', 'uceFault_ratomicsislockfree_false')); +function ratomicsislockfree_false(i) { + var x = [-1, 0, 3, 1000][i & 3]; + var y = Atomics.isLockFree(x); + if (uceFault_ratomicsislockfree_false(i) || uceFault_ratomicsislockfree_false(i)) + assertEq(y, false); + assertRecoveredOnBailout(y, true); + return i; +} + for (j = 100 - max; j < 100; j++) { with({}){} // Do not Ion-compile this loop. let i = j < 2 ? (Math.abs(j) % 50) + 2 : j; @@ -2184,6 +2204,8 @@ for (j = 100 - max; j < 100; j++) { rnantozero_nan(i); rnantozero_poszero(i); rnantozero_negzero(i); + ratomicsislockfree_true(i); + ratomicsislockfree_false(i); } // Test that we can refer multiple time to the same recover instruction, as well diff --git a/js/src/jit-test/tests/ion/scalar-replacement-oom.js b/js/src/jit-test/tests/ion/scalar-replacement-oom.js index 32a3a2e5d5..19d0b026e7 100644 --- a/js/src/jit-test/tests/ion/scalar-replacement-oom.js +++ b/js/src/jit-test/tests/ion/scalar-replacement-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAtAllocation' in this) - var lfcode = new Array(); function k(a, f_arg, b, c) { for (var i = 0; i < 5; ++i) { diff --git a/js/src/jit-test/tests/modules/bug-1219044.js b/js/src/jit-test/tests/modules/bug-1219044.js index 3917d7ca9c..bcddf8fb95 100644 --- a/js/src/jit-test/tests/modules/bug-1219044.js +++ b/js/src/jit-test/tests/modules/bug-1219044.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => parseModule('import v from "mod";')); fullcompartmentchecks(true); diff --git a/js/src/jit-test/tests/modules/bug-1402535.js b/js/src/jit-test/tests/modules/bug-1402535.js index f8cf878260..2ff8e3716b 100644 --- a/js/src/jit-test/tests/modules/bug-1402535.js +++ b/js/src/jit-test/tests/modules/bug-1402535.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('stackTest' in this) - stackTest(function() { let m = parseModule(``); moduleLink(m); diff --git a/js/src/jit-test/tests/modules/bug-1402649.js b/js/src/jit-test/tests/modules/bug-1402649.js index 559a91a98f..8199cbeb31 100644 --- a/js/src/jit-test/tests/modules/bug-1402649.js +++ b/js/src/jit-test/tests/modules/bug-1402649.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - loadFile(` function parseAndEvaluate(source) { let m = parseModule(source); diff --git a/js/src/jit-test/tests/modules/bug-1420420-3.js b/js/src/jit-test/tests/modules/bug-1420420-3.js index 508afa41b1..5ccbf536ca 100644 --- a/js/src/jit-test/tests/modules/bug-1420420-3.js +++ b/js/src/jit-test/tests/modules/bug-1420420-3.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('stackTest' in this) - let a = parseModule(`throw new Error`); moduleLink(a); stackTest(function() { diff --git a/js/src/jit-test/tests/modules/bug-1435327.js b/js/src/jit-test/tests/modules/bug-1435327.js index bb9f18a220..5edb47bedd 100644 --- a/js/src/jit-test/tests/modules/bug-1435327.js +++ b/js/src/jit-test/tests/modules/bug-1435327.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - lfLogBuffer = ` let c = registerModule('c', parseModule("")); let d = registerModule('d', parseModule("import { a } from 'c'; a;")); diff --git a/js/src/jit-test/tests/modules/bug-1771090.js b/js/src/jit-test/tests/modules/bug-1771090.js index cb5a5a2bc6..ffc73f93f2 100644 --- a/js/src/jit-test/tests/modules/bug-1771090.js +++ b/js/src/jit-test/tests/modules/bug-1771090.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this) +// |jit-test| skip-if: !hasFunction.oomAfterAllocations asyncFunc1("geval0\n await ''") async function asyncFunc1(lfVarx) { diff --git a/js/src/jit-test/tests/modules/bug-1802479.js b/js/src/jit-test/tests/modules/bug-1802479.js index c00d0e0da6..fd6ca259da 100644 --- a/js/src/jit-test/tests/modules/bug-1802479.js +++ b/js/src/jit-test/tests/modules/bug-1802479.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this); slow - function test(lfVarx) { try { oomTest(function() { diff --git a/js/src/jit-test/tests/modules/bug1670236.js b/js/src/jit-test/tests/modules/bug1670236.js index 35192c2b58..9237b4c1b2 100644 --- a/js/src/jit-test/tests/modules/bug1670236.js +++ b/js/src/jit-test/tests/modules/bug1670236.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) o0=r=/x/; this.toString=(function() { evaluate("",({ element:o0 })); diff --git a/js/src/jit-test/tests/modules/bug1685992.js b/js/src/jit-test/tests/modules/bug1685992.js index 39fd4ce7fd..d1672e18f9 100644 --- a/js/src/jit-test/tests/modules/bug1685992.js +++ b/js/src/jit-test/tests/modules/bug1685992.js @@ -1,4 +1,4 @@ -// |jit-test| --ion-offthread-compile=off; skip-if: !('oomTest' in this) +// |jit-test| --ion-offthread-compile=off function oomModule(lfMod) { oomTest(function () { @@ -9,4 +9,4 @@ oomModule(` class B50 { #priv() {} } -`) \ No newline at end of file +`) diff --git a/js/src/jit-test/tests/modules/bug1846247.js b/js/src/jit-test/tests/modules/bug1846247.js index 4d63f0cfb3..d7dcd61132 100644 --- a/js/src/jit-test/tests/modules/bug1846247.js +++ b/js/src/jit-test/tests/modules/bug1846247.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this); allow-unhandlable-oom +// |jit-test| allow-unhandlable-oom ignoreUnhandledRejections(); oomTest(() => { gc(); diff --git a/js/src/jit-test/tests/modules/dynamic-import-oom.js b/js/src/jit-test/tests/modules/dynamic-import-oom.js index 9682c7560a..561ccf761e 100644 --- a/js/src/jit-test/tests/modules/dynamic-import-oom.js +++ b/js/src/jit-test/tests/modules/dynamic-import-oom.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this); --ion-offthread-compile=off +// |jit-test| --ion-offthread-compile=off // // Note: without --ion-offthread-compile=off this test takes a long time and // may timeout on some platforms. See bug 1507721. diff --git a/js/src/jit-test/tests/modules/eval-module-oom.js b/js/src/jit-test/tests/modules/eval-module-oom.js index 5587670735..ad5564e5c8 100644 --- a/js/src/jit-test/tests/modules/eval-module-oom.js +++ b/js/src/jit-test/tests/modules/eval-module-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // OOM tests for module parsing. const sa = diff --git a/js/src/jit-test/tests/modules/import-meta-oom.js b/js/src/jit-test/tests/modules/import-meta-oom.js index 168f1102a1..a3856e90eb 100644 --- a/js/src/jit-test/tests/modules/import-meta-oom.js +++ b/js/src/jit-test/tests/modules/import-meta-oom.js @@ -1,3 +1,3 @@ -// |jit-test| module; skip-if: !('oomTest' in this) +// |jit-test| module oomTest(() => import.meta); diff --git a/js/src/jit-test/tests/modules/offthread-oom.js b/js/src/jit-test/tests/modules/offthread-oom.js index 97b783c1ba..0af7d745c3 100644 --- a/js/src/jit-test/tests/modules/offthread-oom.js +++ b/js/src/jit-test/tests/modules/offthread-oom.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 // Test Out-of-Memory handling when parsing modules off-thread diff --git a/js/src/jit-test/tests/parser/bug-1263355-44.js b/js/src/jit-test/tests/parser/bug-1263355-44.js index c2de49fd49..a10366ea49 100644 --- a/js/src/jit-test/tests/parser/bug-1263355-44.js +++ b/js/src/jit-test/tests/parser/bug-1263355-44.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // Adapted from randomly chosen test: js/src/jit-test/tests/profiler/bug1231925.js "use strict"; enableGeckoProfiling(); diff --git a/js/src/jit-test/tests/parser/bug-1324773-2.js b/js/src/jit-test/tests/parser/bug-1324773-2.js index bf485ee602..a95012b72a 100644 --- a/js/src/jit-test/tests/parser/bug-1324773-2.js +++ b/js/src/jit-test/tests/parser/bug-1324773-2.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) - var lfGlobal = newGlobal(); lfGlobal.evaluate(` for (var i = 0; i < 600; i++) diff --git a/js/src/jit-test/tests/parser/bug-1324773.js b/js/src/jit-test/tests/parser/bug-1324773.js index 1ab1a3fb9a..3cb86fe944 100644 --- a/js/src/jit-test/tests/parser/bug-1324773.js +++ b/js/src/jit-test/tests/parser/bug-1324773.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('gczeal' in this) - var lfGlobal = newGlobal(); lfGlobal.evaluate(` for (var i = 0; i < 600; i++) diff --git a/js/src/jit-test/tests/parser/bug-1433014.js b/js/src/jit-test/tests/parser/bug-1433014.js index efb8ab98d3..7787862f6c 100644 --- a/js/src/jit-test/tests/parser/bug-1433014.js +++ b/js/src/jit-test/tests/parser/bug-1433014.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: helperThreadCount() === 0 || !('oomTest' in this) +// |jit-test| skip-if: helperThreadCount() === 0 evaluate(` oomTest(() => { offThreadCompileToStencil(""); diff --git a/js/src/jit-test/tests/parser/bug-1576865-1.js b/js/src/jit-test/tests/parser/bug-1576865-1.js index f31539b8ea..6becf49905 100644 --- a/js/src/jit-test/tests/parser/bug-1576865-1.js +++ b/js/src/jit-test/tests/parser/bug-1576865-1.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) var sourceText = ` function Outer() { var X00, X01, X02, X03, X04, X05, X06, X07; diff --git a/js/src/jit-test/tests/parser/bug-1576865-2.js b/js/src/jit-test/tests/parser/bug-1576865-2.js index d053c24728..4e2b02bfe9 100644 --- a/js/src/jit-test/tests/parser/bug-1576865-2.js +++ b/js/src/jit-test/tests/parser/bug-1576865-2.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) var sourceText = ` function Outer() { function LazyFunction() { diff --git a/js/src/jit-test/tests/parser/bug-1662260.js b/js/src/jit-test/tests/parser/bug-1662260.js index 235737657e..82fc7056a0 100644 --- a/js/src/jit-test/tests/parser/bug-1662260.js +++ b/js/src/jit-test/tests/parser/bug-1662260.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function loadX(lfVarx) { oomTest(function() { let m55 = parseModule(lfVarx); diff --git a/js/src/jit-test/tests/parser/bug-1764737.js b/js/src/jit-test/tests/parser/bug-1764737.js index 0fcc39e276..66d57b0dcc 100644 --- a/js/src/jit-test/tests/parser/bug-1764737.js +++ b/js/src/jit-test/tests/parser/bug-1764737.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this); --fuzzing-safe; --ion-offthread-compile=off +// |jit-test| --fuzzing-safe; --ion-offthread-compile=off function r(src) { oomTest(function() { diff --git a/js/src/jit-test/tests/parser/bug1461034.js b/js/src/jit-test/tests/parser/bug1461034.js index 84d6ae88ca..1b7798a703 100644 --- a/js/src/jit-test/tests/parser/bug1461034.js +++ b/js/src/jit-test/tests/parser/bug1461034.js @@ -1,2 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(function(){s[-1]}); diff --git a/js/src/jit-test/tests/parser/bug1547655.js b/js/src/jit-test/tests/parser/bug1547655.js index 540e011d9a..7a84d55b89 100644 --- a/js/src/jit-test/tests/parser/bug1547655.js +++ b/js/src/jit-test/tests/parser/bug1547655.js @@ -1,2 +1,2 @@ -// |jit-test| allow-unhandlable-oom; allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-unhandlable-oom; allow-oom oomTest(() => evaluate(`meta: { with({}) {} }`)); diff --git a/js/src/jit-test/tests/parser/bug1661454.js b/js/src/jit-test/tests/parser/bug1661454.js index ca7792f4bc..7692431039 100644 --- a/js/src/jit-test/tests/parser/bug1661454.js +++ b/js/src/jit-test/tests/parser/bug1661454.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function oomTestEval(lfVarx) { oomTest(() => eval(lfVarx)); } diff --git a/js/src/jit-test/tests/parser/bug1764715.js b/js/src/jit-test/tests/parser/bug1764715.js index b203925aa8..6fe1a19451 100644 --- a/js/src/jit-test/tests/parser/bug1764715.js +++ b/js/src/jit-test/tests/parser/bug1764715.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(function() { let m = parseModule(`x = a?.b; x = a?.b; x = a?.b;`); }); diff --git a/js/src/jit-test/tests/parser/bug1835785.js b/js/src/jit-test/tests/parser/bug1835785.js index 25317757ec..ea5b642f20 100644 --- a/js/src/jit-test/tests/parser/bug1835785.js +++ b/js/src/jit-test/tests/parser/bug1835785.js @@ -1,4 +1,4 @@ -// |jit-test| allow-unhandlable-oom; allow-oom; skip-if: !('oomAtAllocation' in this) +// |jit-test| allow-unhandlable-oom; allow-oom; skip-if: !hasFunction.oomAtAllocation function main() { this oomAtAllocation(7); diff --git a/js/src/jit-test/tests/parser/compile-script.js b/js/src/jit-test/tests/parser/compile-script.js index 293d25632e..c752f0b518 100644 --- a/js/src/jit-test/tests/parser/compile-script.js +++ b/js/src/jit-test/tests/parser/compile-script.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - load(libdir + "asserts.js"); let stencil = compileToStencil('314;'); diff --git a/js/src/jit-test/tests/parser/off_thread_compile_oom.js b/js/src/jit-test/tests/parser/off_thread_compile_oom.js index 5a8e32eb37..e9fb4c677d 100644 --- a/js/src/jit-test/tests/parser/off_thread_compile_oom.js +++ b/js/src/jit-test/tests/parser/off_thread_compile_oom.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 // OOM during off-thread initialization shouldn't leak memory. eval('oomTest(function(){offThreadCompileToStencil("")})'); diff --git a/js/src/jit-test/tests/parser/warning-oom.js b/js/src/jit-test/tests/parser/warning-oom.js index baf91cb9c9..d784c642d4 100644 --- a/js/src/jit-test/tests/parser/warning-oom.js +++ b/js/src/jit-test/tests/parser/warning-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // OOM during reporting warning should be handled. oomTest(function(){ diff --git a/js/src/jit-test/tests/profiler/bug1211962.js b/js/src/jit-test/tests/profiler/bug1211962.js index d47d823ff2..6803888e36 100644 --- a/js/src/jit-test/tests/profiler/bug1211962.js +++ b/js/src/jit-test/tests/profiler/bug1211962.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| slow; skip-if: helperThreadCount() === 0 enableGeckoProfiling(); var lfGlobal = newGlobal(); diff --git a/js/src/jit-test/tests/profiler/bug1231925.js b/js/src/jit-test/tests/profiler/bug1231925.js index 87325b6763..0e0011feb6 100644 --- a/js/src/jit-test/tests/profiler/bug1231925.js +++ b/js/src/jit-test/tests/profiler/bug1231925.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - enableGeckoProfiling(); oomTest(function() { eval("(function() {})()") diff --git a/js/src/jit-test/tests/profiler/bug1242840.js b/js/src/jit-test/tests/profiler/bug1242840.js index 8770403409..4c2f72024f 100644 --- a/js/src/jit-test/tests/profiler/bug1242840.js +++ b/js/src/jit-test/tests/profiler/bug1242840.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - enableGeckoProfiling(); oomTest(() => { try { diff --git a/js/src/jit-test/tests/profiler/bug1563889.js b/js/src/jit-test/tests/profiler/bug1563889.js index c8f9776ada..64a4c56423 100644 --- a/js/src/jit-test/tests/profiler/bug1563889.js +++ b/js/src/jit-test/tests/profiler/bug1563889.js @@ -1,3 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) for (var i = 0; i < 20; i++) {} oomTest(enableGeckoProfiling); diff --git a/js/src/jit-test/tests/promise/unhandled-rejections-oom.js b/js/src/jit-test/tests/promise/unhandled-rejections-oom.js index 706eba0032..922161f5ed 100644 --- a/js/src/jit-test/tests/promise/unhandled-rejections-oom.js +++ b/js/src/jit-test/tests/promise/unhandled-rejections-oom.js @@ -1,3 +1,3 @@ -// |jit-test| allow-oom; skip-if: !('oomTest' in this) +// |jit-test| allow-oom oomTest(async function() {}, { keepFailing: true }); diff --git a/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js b/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js index 19471fdf50..d261e6ae07 100644 --- a/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js +++ b/js/src/jit-test/tests/regexp/CheckRegExpSyntax.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - load(libdir + "asserts.js"); assertEq(checkRegExpSyntax("correct[reg]exp"), undefined); diff --git a/js/src/jit-test/tests/regexp/bug-1845715.js b/js/src/jit-test/tests/regexp/bug-1845715.js index 992a5a8d8a..d6ca6776a3 100644 --- a/js/src/jit-test/tests/regexp/bug-1845715.js +++ b/js/src/jit-test/tests/regexp/bug-1845715.js @@ -1,2 +1 @@ -// |jit-test| skip-if: !('oomTest' in this) oomTest(() => { gc(); /./d.exec(); }); diff --git a/js/src/jit-test/tests/regexp/bug1640475.js b/js/src/jit-test/tests/regexp/bug1640475.js index 58c092ec1d..07c04827af 100644 --- a/js/src/jit-test/tests/regexp/bug1640475.js +++ b/js/src/jit-test/tests/regexp/bug1640475.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var i = 0; oomTest(function() { for (var j = 0; j < 10; ++j) { diff --git a/js/src/jit-test/tests/regexp/bug1640479.js b/js/src/jit-test/tests/regexp/bug1640479.js index ff166d6451..a04b44a2a3 100644 --- a/js/src/jit-test/tests/regexp/bug1640479.js +++ b/js/src/jit-test/tests/regexp/bug1640479.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var failures = 0; var i = 0; diff --git a/js/src/jit-test/tests/regexp/bug1794317.js b/js/src/jit-test/tests/regexp/bug1794317.js index 1ecb21eb64..ef50fd0c97 100644 --- a/js/src/jit-test/tests/regexp/bug1794317.js +++ b/js/src/jit-test/tests/regexp/bug1794317.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - for (let i = 0; i < 2; i++) { oomTest(function () { RegExp("(?)").exec(); diff --git a/js/src/jit-test/tests/saved-stacks/bug-1445973-quick.js b/js/src/jit-test/tests/saved-stacks/bug-1445973-quick.js index e95315f71f..2e8a5cef34 100644 --- a/js/src/jit-test/tests/saved-stacks/bug-1445973-quick.js +++ b/js/src/jit-test/tests/saved-stacks/bug-1445973-quick.js @@ -1,4 +1,4 @@ -// |jit-test| --no-baseline; skip-if: !('oomTest' in this) +// |jit-test| --no-baseline // // For background, see the comments for LiveSavedFrameCache in js/src/vm/Stack.h. // diff --git a/js/src/jit-test/tests/saved-stacks/oom-in-save-stack-02.js b/js/src/jit-test/tests/saved-stacks/oom-in-save-stack-02.js index ed24db8f0f..e62a3e953e 100644 --- a/js/src/jit-test/tests/saved-stacks/oom-in-save-stack-02.js +++ b/js/src/jit-test/tests/saved-stacks/oom-in-save-stack-02.js @@ -1,4 +1,4 @@ -// |jit-test| --no-ion; --no-baseline; --no-blinterp; skip-if: !('oomAtAllocation' in this) +// |jit-test| --no-ion; --no-baseline; --no-blinterp // This shouldn't assert (bug 1516514). // // Disabled for ion and baseline because those introduce OOMs at some point that diff --git a/js/src/jit-test/tests/saved-stacks/oom-in-save-stack.js b/js/src/jit-test/tests/saved-stacks/oom-in-save-stack.js index c96bbc5c6b..3163646626 100644 --- a/js/src/jit-test/tests/saved-stacks/oom-in-save-stack.js +++ b/js/src/jit-test/tests/saved-stacks/oom-in-save-stack.js @@ -1,4 +1,2 @@ -// |jit-test| skip-if: !('oomTest' in this) - let s = saveStack(); oomTest(() => { saveStack(); }); diff --git a/js/src/jit-test/tests/self-hosting/oom-delazify.js b/js/src/jit-test/tests/self-hosting/oom-delazify.js index 2c9bfc71e9..eb8c64fc0f 100644 --- a/js/src/jit-test/tests/self-hosting/oom-delazify.js +++ b/js/src/jit-test/tests/self-hosting/oom-delazify.js @@ -1,4 +1,4 @@ -// |jit-test| --no-blinterp; skip-if: !('oomTest' in this) +// |jit-test| --no-blinterp // Disable the JITs to make oomTest more reliable diff --git a/js/src/jit-test/tests/self-hosting/oom-toplevel.js b/js/src/jit-test/tests/self-hosting/oom-toplevel.js index 60f2be4e1e..9562d87049 100644 --- a/js/src/jit-test/tests/self-hosting/oom-toplevel.js +++ b/js/src/jit-test/tests/self-hosting/oom-toplevel.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomAtAllocation' in this) +// |jit-test| skip-if: !hasFunction.oomAtAllocation function code(n) { return ` diff --git a/js/src/jit-test/tests/self-test/oom-test-bug1497906.js b/js/src/jit-test/tests/self-test/oom-test-bug1497906.js index da6a0a959d..2acca432d0 100644 --- a/js/src/jit-test/tests/self-test/oom-test-bug1497906.js +++ b/js/src/jit-test/tests/self-test/oom-test-bug1497906.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this && 'stackTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: !(hasFunction.oomTest && hasFunction.stackTest) || helperThreadCount() === 0 // Check that oomTest throws an exception on worker threads. diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength-with-non-growable-write.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength-with-non-growable-write.js new file mode 100644 index 0000000000..32005f4725 --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength-with-non-growable-write.js @@ -0,0 +1,102 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab, sab) { + var ta = new Int32Array(gsab); + var ta2 = new Int32Array(sab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta2, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + var sab = new SharedArrayBuffer(12); + + // Start the worker. + { + let buffers = [gsab, sab]; + + // Shared memory locations: + // + // 0: Number of buffers + // 1: Ready-Flag Worker + // 2: Ready-Flag Main + let sync = new Int32Array(new SharedArrayBuffer(3 * Int32Array.BYTES_PER_ELEMENT)); + sync[0] = buffers.length; + + setSharedObject(sync.buffer); + + evalInWorker(` + let buffers = []; + let sync = new Int32Array(getSharedObject()); + let n = sync[0]; + for (let i = 0; i < n; ++i) { + // Notify we're ready to receive. + Atomics.store(sync, 1, 1); + + // Wait until buffer is in mailbox. + while (Atomics.compareExchange(sync, 2, 1, 0) !== 1); + + buffers.push(getSharedObject()); + } + (${worker})(...buffers); + `); + + for (let buffer of buffers) { + // Wait until worker is ready. + while (Atomics.compareExchange(sync, 1, 1, 0) !== 1); + + setSharedObject(buffer); + + // Notify buffer is in mailbox. + Atomics.store(sync, 2, 1); + } + } + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return {gsab, sab}; +} + +function testGrowableSharedArrayBufferByteLength() { + var {gsab, sab} = setup(); + var ta2 = new Int32Array(sab); + var r = 0; + + // |gsab.byteLength| is a seq-cst load, so it must prevent reordering any + // other loads, including unordered loads like |ta2[2]|. + while (gsab.byteLength <= 12) { + // |ta2[2]| is an unordered load, so it's hoistable by default. + r += ta2[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "gsab.byteLength acts as a memory barrier, so ta2[2] can't be hoisted" + ); +} +testGrowableSharedArrayBufferByteLength(); diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength.js new file mode 100644 index 0000000000..c2f27d967c --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-bytelength.js @@ -0,0 +1,67 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab) { + var ta = new Int32Array(gsab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + + // Pass |gsab| to the mailbox. + setSharedObject(gsab); + + // Start the worker. + evalInWorker(` + (${worker})(getSharedObject()); + `); + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return gsab; +} + +function testGrowableSharedArrayBufferByteLength() { + var gsab = setup(); + var ta = new Int32Array(gsab); + var r = 0; + + // |gsab.byteLength| is a seq-cst load, so it must prevent reordering any + // other loads, including unordered loads like |ta[2]|. + while (gsab.byteLength <= 12) { + // |ta[2]| is an unordered load, so it's hoistable by default. + r += ta[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "gsab.byteLength acts as a memory barrier, so ta[2] can't be hoisted" + ); +} +testGrowableSharedArrayBufferByteLength(); diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength-with-non-growable-write.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength-with-non-growable-write.js new file mode 100644 index 0000000000..fc05df3ab1 --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength-with-non-growable-write.js @@ -0,0 +1,103 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab, sab) { + var ta = new Int32Array(gsab); + var ta2 = new Int32Array(sab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta2, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + var sab = new SharedArrayBuffer(12); + + // Start the worker. + { + let buffers = [gsab, sab]; + + // Shared memory locations: + // + // 0: Number of buffers + // 1: Ready-Flag Worker + // 2: Ready-Flag Main + let sync = new Int32Array(new SharedArrayBuffer(3 * Int32Array.BYTES_PER_ELEMENT)); + sync[0] = buffers.length; + + setSharedObject(sync.buffer); + + evalInWorker(` + let buffers = []; + let sync = new Int32Array(getSharedObject()); + let n = sync[0]; + for (let i = 0; i < n; ++i) { + // Notify we're ready to receive. + Atomics.store(sync, 1, 1); + + // Wait until buffer is in mailbox. + while (Atomics.compareExchange(sync, 2, 1, 0) !== 1); + + buffers.push(getSharedObject()); + } + (${worker})(...buffers); + `); + + for (let buffer of buffers) { + // Wait until worker is ready. + while (Atomics.compareExchange(sync, 1, 1, 0) !== 1); + + setSharedObject(buffer); + + // Notify buffer is in mailbox. + Atomics.store(sync, 2, 1); + } + } + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return {gsab, sab}; +} + +function testDataViewByteLength() { + var {gsab, sab} = setup(); + var dv = new DataView(gsab); + var ta2 = new Int32Array(sab); + var r = 0; + + // |dv.byteLength| is a seq-cst load, so it must prevent reordering any other + // loads, including unordered loads like |ta2[2]|. + while (dv.byteLength <= 12) { + // |ta2[2]| is an unordered load, so it's hoistable by default. + r += ta2[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "dv.byteLength acts as a memory barrier, so ta2[2] can't be hoisted" + ); +} +testDataViewByteLength(); diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength.js new file mode 100644 index 0000000000..51ed63f254 --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-dataview-bytelength.js @@ -0,0 +1,68 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab) { + var ta = new Int32Array(gsab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + + // Pass |gsab| to the mailbox. + setSharedObject(gsab); + + // Start the worker. + evalInWorker(` + (${worker})(getSharedObject()); + `); + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return gsab; +} + +function testDataViewByteLength() { + var gsab = setup(); + var ta = new Int32Array(gsab); + var dv = new DataView(gsab); + var r = 0; + + // |dv.byteLength| is a seq-cst load, so it must prevent reordering any other + // loads, including unordered loads like |ta[2]|. + while (dv.byteLength <= 12) { + // |ta[2]| is an unordered load, so it's hoistable by default. + r += ta[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "dv.byteLength acts as a memory barrier, so ta[2] can't be hoisted" + ); +} +testDataViewByteLength(); diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength-with-non-growable-write.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength-with-non-growable-write.js new file mode 100644 index 0000000000..fd92ff615a --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength-with-non-growable-write.js @@ -0,0 +1,103 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab, sab) { + var ta = new Int32Array(gsab); + var ta2 = new Int32Array(sab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta2, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + var sab = new SharedArrayBuffer(12); + + // Start the worker. + { + let buffers = [gsab, sab]; + + // Shared memory locations: + // + // 0: Number of buffers + // 1: Ready-Flag Worker + // 2: Ready-Flag Main + let sync = new Int32Array(new SharedArrayBuffer(3 * Int32Array.BYTES_PER_ELEMENT)); + sync[0] = buffers.length; + + setSharedObject(sync.buffer); + + evalInWorker(` + let buffers = []; + let sync = new Int32Array(getSharedObject()); + let n = sync[0]; + for (let i = 0; i < n; ++i) { + // Notify we're ready to receive. + Atomics.store(sync, 1, 1); + + // Wait until buffer is in mailbox. + while (Atomics.compareExchange(sync, 2, 1, 0) !== 1); + + buffers.push(getSharedObject()); + } + (${worker})(...buffers); + `); + + for (let buffer of buffers) { + // Wait until worker is ready. + while (Atomics.compareExchange(sync, 1, 1, 0) !== 1); + + setSharedObject(buffer); + + // Notify buffer is in mailbox. + Atomics.store(sync, 2, 1); + } + } + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return {gsab, sab}; +} + +function testTypedArrayByteLength() { + var {gsab, sab} = setup(); + var ta = new Int32Array(gsab); + var ta2 = new Int32Array(sab); + var r = 0; + + // |ta.byteLength| is a seq-cst load, so it must prevent reordering any other + // loads, including unordered loads like |ta2[2]|. + while (ta.byteLength <= 12) { + // |ta2[2]| is an unordered load, so it's hoistable by default. + r += ta2[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "ta.byteLength acts as a memory barrier, so ta2[2] can't be hoisted" + ); +} +testTypedArrayByteLength(); diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength.js new file mode 100644 index 0000000000..843f7dce15 --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-bytelength.js @@ -0,0 +1,67 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab) { + var ta = new Int32Array(gsab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + + // Pass |gsab| to the mailbox. + setSharedObject(gsab); + + // Start the worker. + evalInWorker(` + (${worker})(getSharedObject()); + `); + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return gsab; +} + +function testTypedArrayByteLength() { + var gsab = setup(); + var ta = new Int32Array(gsab); + var r = 0; + + // |ta.byteLength| is a seq-cst load, so it must prevent reordering any other + // loads, including unordered loads like |ta[2]|. + while (ta.byteLength <= 12) { + // |ta[2]| is an unordered load, so it's hoistable by default. + r += ta[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "ta.byteLength acts as a memory barrier, so ta[2] can't be hoisted" + ); +} +testTypedArrayByteLength(); diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length-with-non-growable-write.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length-with-non-growable-write.js new file mode 100644 index 0000000000..4371dd2b00 --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length-with-non-growable-write.js @@ -0,0 +1,103 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab, sab) { + var ta = new Int32Array(gsab); + var ta2 = new Int32Array(sab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta2, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + var sab = new SharedArrayBuffer(12); + + // Start the worker. + { + let buffers = [gsab, sab]; + + // Shared memory locations: + // + // 0: Number of buffers + // 1: Ready-Flag Worker + // 2: Ready-Flag Main + let sync = new Int32Array(new SharedArrayBuffer(3 * Int32Array.BYTES_PER_ELEMENT)); + sync[0] = buffers.length; + + setSharedObject(sync.buffer); + + evalInWorker(` + let buffers = []; + let sync = new Int32Array(getSharedObject()); + let n = sync[0]; + for (let i = 0; i < n; ++i) { + // Notify we're ready to receive. + Atomics.store(sync, 1, 1); + + // Wait until buffer is in mailbox. + while (Atomics.compareExchange(sync, 2, 1, 0) !== 1); + + buffers.push(getSharedObject()); + } + (${worker})(...buffers); + `); + + for (let buffer of buffers) { + // Wait until worker is ready. + while (Atomics.compareExchange(sync, 1, 1, 0) !== 1); + + setSharedObject(buffer); + + // Notify buffer is in mailbox. + Atomics.store(sync, 2, 1); + } + } + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return {gsab, sab}; +} + +function testTypedArrayLength() { + var {gsab, sab} = setup(); + var ta = new Int32Array(gsab); + var ta2 = new Int32Array(sab); + var r = 0; + + // |ta.length| is a seq-cst load, so it must prevent reordering any other + // loads, including unordered loads like |ta2[2]|. + while (ta.length <= 3) { + // |ta2[2]| is an unordered load, so it's hoistable by default. + r += ta2[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "ta.length acts as a memory barrier, so ta2[2] can't be hoisted" + ); +} +testTypedArrayLength(); diff --git a/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length.js b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length.js new file mode 100644 index 0000000000..b32af6ae78 --- /dev/null +++ b/js/src/jit-test/tests/sharedbuf/growable-sab-memory-barrier-typedarray-length.js @@ -0,0 +1,67 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer||helperThreadCount()===0 + +function setup() { + // Shared memory locations: + // + // 0: Lock + // 1: Sleep + // 2: Data + // 3: Unused + + function worker(gsab) { + var ta = new Int32Array(gsab); + + // Notify the main thread that the worker is ready. + Atomics.store(ta, 0, 1); + + // Sleep to give the main thread time to execute and tier-up the loop. + Atomics.wait(ta, 1, 0, 500); + + // Modify the memory read in the loop. + Atomics.store(ta, 2, 1); + + // Sleep again to give the main thread time to execute the loop. + Atomics.wait(ta, 1, 0, 100); + + // Grow the buffer. This modifies the loop condition. + gsab.grow(16); + } + + var gsab = new SharedArrayBuffer(12, {maxByteLength: 16}); + + // Pass |gsab| to the mailbox. + setSharedObject(gsab); + + // Start the worker. + evalInWorker(` + (${worker})(getSharedObject()); + `); + + // Wait until worker is ready. + var ta = new Int32Array(gsab); + while (Atomics.load(ta, 0) === 0); + + return gsab; +} + +function testTypedArrayLength() { + var gsab = setup(); + var ta = new Int32Array(gsab); + var r = 0; + + // |ta.length| is a seq-cst load, so it must prevent reordering any other + // loads, including unordered loads like |ta[2]|. + while (ta.length <= 3) { + // |ta[2]| is an unordered load, so it's hoistable by default. + r += ta[2]; + } + + // The memory location is first modified and then the buffer is grown, so we + // must observe reads of the modified memory location before exiting the loop. + assertEq( + r > 0, + true, + "ta.length acts as a memory barrier, so ta[2] can't be hoisted" + ); +} +testTypedArrayLength(); diff --git a/js/src/jit-test/tests/stream/bug-1513266.js b/js/src/jit-test/tests/stream/bug-1513266.js index 3db1e2d941..5511ce8000 100644 --- a/js/src/jit-test/tests/stream/bug-1513266.js +++ b/js/src/jit-test/tests/stream/bug-1513266.js @@ -1,4 +1,4 @@ -// |jit-test| --no-ion; --no-baseline; skip-if: !('oomTest' in this && this.hasOwnProperty("ReadableStream")) +// |jit-test| --no-ion; --no-baseline; skip-if: !this.hasOwnProperty("ReadableStream") ignoreUnhandledRejections(); diff --git a/js/src/jit-test/tests/stream/bug-1515816.js b/js/src/jit-test/tests/stream/bug-1515816.js index 44329b056d..6199eb9a31 100644 --- a/js/src/jit-test/tests/stream/bug-1515816.js +++ b/js/src/jit-test/tests/stream/bug-1515816.js @@ -1,4 +1,4 @@ -// |jit-test| --no-ion; --no-baseline; --no-blinterp; skip-if: !('oomAfterAllocations' in this && this.hasOwnProperty("ReadableStream")) +// |jit-test| --no-ion; --no-baseline; --no-blinterp; skip-if: !this.hasOwnProperty("ReadableStream") // Don't crash on OOM in ReadableStreamDefaultReader.prototype.read(). for (let n = 1; n < 1000; n++) { diff --git a/js/src/jit-test/tests/typedarray/construct-with-growable-sharedarraybuffer.js b/js/src/jit-test/tests/typedarray/construct-with-growable-sharedarraybuffer.js new file mode 100644 index 0000000000..29696f0860 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/construct-with-growable-sharedarraybuffer.js @@ -0,0 +1,81 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +// Test TypedArray constructor when called with growable SharedArrayBuffers. + +function testSharedArrayBuffer() { + function test() { + var N = 200; + var sab = new SharedArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: (5 + N) * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < N; ++i) { + var ta = new Int32Array(sab); + assertEq(ta.length, 4 + i); + + // Ensure auto-length tracking works correctly. + sab.grow((5 + i) * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 5 + i); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testSharedArrayBuffer(); + +function testSharedArrayBufferAndByteOffset() { + function test() { + var N = 200; + var sab = new SharedArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: (5 + N) * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < N; ++i) { + var ta = new Int32Array(sab, Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 3 + i); + + // Ensure auto-length tracking works correctly. + sab.grow((5 + i) * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 4 + i); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testSharedArrayBufferAndByteOffset(); + +function testSharedArrayBufferAndByteOffsetAndLength() { + function test() { + var N = 200; + var sab = new SharedArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: (5 + N) * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < N; ++i) { + var ta = new Int32Array(sab, Int32Array.BYTES_PER_ELEMENT, 2); + assertEq(ta.length, 2); + + // Ensure length doesn't change when resizing the buffer. + sab.grow((5 + i) * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 2); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testSharedArrayBufferAndByteOffsetAndLength(); + +function testWrappedSharedArrayBuffer() { + var g = newGlobal(); + + function test() { + var N = 200; + var sab = new g.SharedArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: (5 + N) * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < N; ++i) { + var ta = new Int32Array(sab); + assertEq(ta.length, 4 + i); + + // Ensure auto-length tracking works correctly. + sab.grow((5 + i) * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 5 + i); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testWrappedSharedArrayBuffer(); diff --git a/js/src/jit-test/tests/typedarray/construct-with-resizable-arraybuffer.js b/js/src/jit-test/tests/typedarray/construct-with-resizable-arraybuffer.js new file mode 100644 index 0000000000..33f7a4f6c6 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/construct-with-resizable-arraybuffer.js @@ -0,0 +1,102 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +// Test TypedArray constructor when called with resizable ArrayBuffers. + +function testArrayBuffer() { + function test() { + var ab = new ArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: 5 * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < 200; ++i) { + var ta = new Int32Array(ab); + assertEq(ta.length, 4); + + // Ensure auto-length tracking works correctly. + ab.resize(5 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 5); + + ab.resize(2 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 2); + + // Reset to original length. + ab.resize(4 * Int32Array.BYTES_PER_ELEMENT); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testArrayBuffer(); + +function testArrayBufferAndByteOffset() { + function test() { + var ab = new ArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: 5 * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < 200; ++i) { + var ta = new Int32Array(ab, Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 3); + + // Ensure auto-length tracking works correctly. + ab.resize(5 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 4); + + ab.resize(2 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 1); + + // Reset to original length. + ab.resize(4 * Int32Array.BYTES_PER_ELEMENT); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testArrayBufferAndByteOffset(); + +function testArrayBufferAndByteOffsetAndLength() { + function test() { + var ab = new ArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: 5 * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < 200; ++i) { + var ta = new Int32Array(ab, Int32Array.BYTES_PER_ELEMENT, 2); + assertEq(ta.length, 2); + + // Ensure length doesn't change when resizing the buffer. + ab.resize(5 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 2); + + // Returns zero when the TypedArray get out-of-bounds. + ab.resize(2 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 0); + + // Reset to original length. + ab.resize(4 * Int32Array.BYTES_PER_ELEMENT); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testArrayBufferAndByteOffsetAndLength(); + +function testWrappedArrayBuffer() { + var g = newGlobal(); + + function test() { + var ab = new g.ArrayBuffer(4 * Int32Array.BYTES_PER_ELEMENT, {maxByteLength: 5 * Int32Array.BYTES_PER_ELEMENT}); + for (var i = 0; i < 200; ++i) { + var ta = new Int32Array(ab); + assertEq(ta.length, 4); + + // Ensure auto-length tracking works correctly. + ab.resize(5 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 5); + + ab.resize(2 * Int32Array.BYTES_PER_ELEMENT); + assertEq(ta.length, 2); + + // Reset to original length. + ab.resize(4 * Int32Array.BYTES_PER_ELEMENT); + } + } + for (var i = 0; i < 2; ++i) { + test(); + } +} +testWrappedArrayBuffer(); diff --git a/js/src/jit-test/tests/typedarray/ensure-non-inline.js b/js/src/jit-test/tests/typedarray/ensure-non-inline.js index d8859fa627..a1321be88a 100644 --- a/js/src/jit-test/tests/typedarray/ensure-non-inline.js +++ b/js/src/jit-test/tests/typedarray/ensure-non-inline.js @@ -1,3 +1,5 @@ +// |jit-test| --enable-arraybuffer-resizable + const constructors = [ Int8Array, Uint8Array, @@ -73,6 +75,16 @@ function test() { const big = new ctor(ab); messWith(big, ab); } + + // With resizable buffer. + for (const ctor of constructors) { + let ab = new ArrayBuffer(32, {maxByteLength: 64}); + const small = new ctor(ab); + messWith(small, small); + ab = new ArrayBuffer(4000, {maxByteLength: 4096}); + const big = new ctor(ab); + messWith(big, big); + } } try { diff --git a/js/src/jit-test/tests/typedarray/growable-sharedarraybuffer-bytelength.js b/js/src/jit-test/tests/typedarray/growable-sharedarraybuffer-bytelength.js new file mode 100644 index 0000000000..421bf03475 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/growable-sharedarraybuffer-bytelength.js @@ -0,0 +1,14 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +function testGrowableSharedArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + for (let j = 0; j < 100; ++j) { + assertEq(sab.byteLength, i + j); + + sab.grow(i + j + 1); + assertEq(sab.byteLength, i + j + 1); + } + } +} +for (let i = 0; i < 2; ++i) testGrowableSharedArrayBuffer(); diff --git a/js/src/jit-test/tests/typedarray/indexed-integer-exotics.js b/js/src/jit-test/tests/typedarray/indexed-integer-exotics.js index 6331efd7c3..510e57c0f0 100644 --- a/js/src/jit-test/tests/typedarray/indexed-integer-exotics.js +++ b/js/src/jit-test/tests/typedarray/indexed-integer-exotics.js @@ -88,10 +88,10 @@ assertEq(undefined, f()); // These checks currently fail due to bug 1129202 not being implemented yet. // We should uncomment them once that bug landed. -//assertThrows('Object.defineProperty(new Int32Array(100), -1, {value: 1})'); +assertThrows('Object.defineProperty(new Int32Array(100), -1, {value: 1})'); // -0 gets converted to the string "0", so use "-0" instead. -//assertThrows('Object.defineProperty(new Int32Array(100), "-0", {value: 1})'); -//assertThrows('Object.defineProperty(new Int32Array(100), -10, {value: 1})'); -//assertThrows('Object.defineProperty(new Int32Array(), 4294967295, {value: 1})'); +assertThrows('Object.defineProperty(new Int32Array(100), "-0", {value: 1})'); +assertThrows('Object.defineProperty(new Int32Array(100), -10, {value: 1})'); +assertThrows('Object.defineProperty(new Int32Array(), 4294967295, {value: 1})'); check(); diff --git a/js/src/jit-test/tests/typedarray/oom-allocating-arraybuffer-contents.js b/js/src/jit-test/tests/typedarray/oom-allocating-arraybuffer-contents.js index 16d1bf976f..1362c8d14c 100644 --- a/js/src/jit-test/tests/typedarray/oom-allocating-arraybuffer-contents.js +++ b/js/src/jit-test/tests/typedarray/oom-allocating-arraybuffer-contents.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // Resolve ArrayBuffer before OOM-testing, so OOM-testing runs less code and is // less fragile. var AB = ArrayBuffer; diff --git a/js/src/jit-test/tests/typedarray/oom-allocating-copying-same-buffer-contents.js b/js/src/jit-test/tests/typedarray/oom-allocating-copying-same-buffer-contents.js index ec33e4ef8e..cdbc3d7215 100644 --- a/js/src/jit-test/tests/typedarray/oom-allocating-copying-same-buffer-contents.js +++ b/js/src/jit-test/tests/typedarray/oom-allocating-copying-same-buffer-contents.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var buffer = new ArrayBuffer(16); var i8 = new Int8Array(buffer); var i16 = new Int16Array(buffer); diff --git a/js/src/jit-test/tests/typedarray/resizable-arraybuffer-bytelength.js b/js/src/jit-test/tests/typedarray/resizable-arraybuffer-bytelength.js new file mode 100644 index 0000000000..7b50331a15 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-arraybuffer-bytelength.js @@ -0,0 +1,20 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +function testResizableArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ab.byteLength, i); + + ab.resize(i + 1); + assertEq(ab.byteLength, i + 1); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ab.byteLength, i - 1); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBuffer(); diff --git a/js/src/jit-test/tests/typedarray/resizable-buffer-inlined-data-moved.js b/js/src/jit-test/tests/typedarray/resizable-buffer-inlined-data-moved.js new file mode 100644 index 0000000000..1206edd5e5 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-buffer-inlined-data-moved.js @@ -0,0 +1,53 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +function fillArrayBuffer(rab) { + let fill = new Int8Array(rab); + for (let i = 0; i < fill.length; ++i) fill[i] = i + 1; +} + +function test() { + let rab = new ArrayBuffer(4, {maxByteLength: 4}); + let ta = new Int8Array(rab, 2, 2); + + fillArrayBuffer(rab); + + assertEq(ta[0], 3); + assertEq(ta[1], 4); + + // Shrink to make |ta| out-of-bounds. + rab.resize(3); + + // Request GC to move inline data. + gc(); + + // Grow to make |ta| in-bounds again. + rab.resize(4); + + assertEq(ta[0], 3); + assertEq(ta[1], 0); +} +test(); + + +function testAutoLength() { + let rab = new ArrayBuffer(4, {maxByteLength: 4}); + let ta = new Int8Array(rab, 2); + + fillArrayBuffer(rab); + + assertEq(ta[0], 3); + assertEq(ta[1], 4); + + // Shrink to make |ta| out-of-bounds. + rab.resize(1); + + // Request GC to move inline data. + gc(); + + // Grow to make |ta| in-bounds again. + rab.resize(4); + + assertEq(ta[0], 0); + assertEq(ta[1], 0); +} +testAutoLength(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength-with-sab.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength-with-sab.js new file mode 100644 index 0000000000..828e989b92 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength-with-sab.js @@ -0,0 +1,29 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +function testResizableArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new Int8Array(sab, 0, i); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteLength, i); + + sab.grow(i + j + 1); + assertEq(ta.byteLength, i); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBuffer(); + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new Int8Array(sab); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteLength, i + j); + + sab.grow(i + j + 1); + assertEq(ta.byteLength, i + j + 1); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength.js new file mode 100644 index 0000000000..925750d186 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-bytelength.js @@ -0,0 +1,41 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +function testResizableArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new Int8Array(ab, 0, i); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteLength, i); + + ab.resize(i + 1); + assertEq(ta.byteLength, i); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ta.byteLength, 0); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBuffer(); + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new Int8Array(ab); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteLength, i); + + ab.resize(i + 1); + assertEq(ta.byteLength, i + 1); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ta.byteLength, i - 1); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset-sab.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset-sab.js new file mode 100644 index 0000000000..6142d75978 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset-sab.js @@ -0,0 +1,43 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new Int8Array(sab); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteOffset, 0); + + sab.grow(i + j + 1); + assertEq(ta.byteOffset, 0); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); + +function testResizableArrayBufferAutoLengthNonZeroOffset() { + for (let i = 1; i < 4 + 1; ++i) { + let sab = new SharedArrayBuffer(i + 1, {maxByteLength: i + 100 + 1}); + let ta = new Int8Array(sab, 1); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteOffset, 1); + + sab.grow(i + j + 2); + assertEq(ta.byteOffset, 1); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLengthNonZeroOffset(); + +function testResizableArrayBufferNonZeroOffset() { + for (let i = 2; i < 4 + 2; ++i) { + let sab = new SharedArrayBuffer(i + 2, {maxByteLength: i + 100 + 2}); + let ta = new Int8Array(sab, 1, 1); + for (let j = 0; j < 100; ++j) { + assertEq(ta.byteOffset, 1); + + sab.grow(i + j + 3); + assertEq(ta.byteOffset, 1); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferNonZeroOffset(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset.js new file mode 100644 index 0000000000..56552eeb7f --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-byteoffset.js @@ -0,0 +1,57 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new Int8Array(ab); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteOffset, 0); + + ab.resize(i + 1); + assertEq(ta.byteOffset, 0); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ta.byteOffset, 0); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); + +function testResizableArrayBufferAutoLengthNonZeroOffset() { + for (let i = 1; i < 4 + 1; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new Int8Array(ab, 1); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteOffset, 1); + + ab.resize(i + 1); + assertEq(ta.byteOffset, 1); + + ab.resize(i - 1); + assertEq(ta.byteOffset, i > 1 ? 1 : 0); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLengthNonZeroOffset(); + +function testResizableArrayBufferNonZeroOffset() { + for (let i = 2; i < 4 + 2; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new Int8Array(ab, 1, 1); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.byteOffset, 1); + + ab.resize(i + 1); + assertEq(ta.byteOffset, 1); + + ab.resize(i - 1); + assertEq(ta.byteOffset, i > 2 ? 1 : 0); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferNonZeroOffset(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem-with-sab.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem-with-sab.js new file mode 100644 index 0000000000..236641d9a8 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem-with-sab.js @@ -0,0 +1,49 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Uint8ClampedArray, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new SharedArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + for (let i = 0; i < length; ++i) { + actual[i] = type(i * i); + expected[i] = type(i * i); + } + + // In-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % length; + assertEq(actual[index], expected[index]); + } + + // Out-of-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % (length + 4); + assertEq(actual[index], expected[index]); + } +} + +for (let TA of TypedArrays) { + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`)(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem.js new file mode 100644 index 0000000000..902841e526 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-get-elem.js @@ -0,0 +1,49 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Uint8ClampedArray, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new ArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + for (let i = 0; i < length; ++i) { + actual[i] = type(i * i); + expected[i] = type(i * i); + } + + // In-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % length; + assertEq(actual[index], expected[index]); + } + + // Out-of-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % (length + 4); + assertEq(actual[index], expected[index]); + } +} + +for (let TA of TypedArrays) { + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`)(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem-with-sab.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem-with-sab.js new file mode 100644 index 0000000000..40d51ebfe2 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem-with-sab.js @@ -0,0 +1,36 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Uint8ClampedArray, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new SharedArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + + for (let i = 0; i < 200; ++i) { + let index = (i % (length + 4)); + assertEq(index in actual, index in expected); + } +} + +for (let TA of TypedArrays) { + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`)(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem.js new file mode 100644 index 0000000000..07d44bf55b --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-has-elem.js @@ -0,0 +1,36 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Uint8ClampedArray, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new ArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + + for (let i = 0; i < 200; ++i) { + let index = (i % (length + 4)); + assertEq(index in actual, index in expected); + } +} + +for (let TA of TypedArrays) { + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`)(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-byteOffset.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-byteOffset.js new file mode 100644 index 0000000000..1b9f9a28e7 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-byteOffset.js @@ -0,0 +1,73 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +const TypedArrayByteOffset = getSelfHostedValue("TypedArrayByteOffset"); + +function testTypedArrayByteOffset() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab), + new Int8Array(ab, 1), + new Int8Array(ab, 2), + new Int8Array(ab, 3), + ]; + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayByteOffset(ta), i & 3); + } +} +testTypedArrayByteOffset(); + +function testTypedArrayByteOffsetOutOfBounds() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab, 0, 10), + new Int8Array(ab, 1, 10), + new Int8Array(ab, 2, 10), + new Int8Array(ab, 3, 10), + ]; + + // Resize to zero to make all views out-of-bounds. + ab.resize(0); + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayByteOffset(ta), i & 3); + } +} +testTypedArrayByteOffsetOutOfBounds(); + +function testTypedArrayByteOffsetDetached() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab, 0, 10), + new Int8Array(ab, 1, 10), + new Int8Array(ab, 2, 10), + new Int8Array(ab, 3, 10), + ]; + + // Detach the buffer. + ab.transfer(); + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayByteOffset(ta), 0); + } +} +testTypedArrayByteOffsetDetached(); + +function testTypedArrayByteOffsetWithShared() { + let ab = new SharedArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab), + new Int8Array(ab, 1), + new Int8Array(ab, 2), + new Int8Array(ab, 3), + ]; + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayByteOffset(ta), i & 3); + } +} +testTypedArrayByteOffsetWithShared(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLength.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLength.js new file mode 100644 index 0000000000..c36b4f997f --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLength.js @@ -0,0 +1,75 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +load(libdir + "asserts.js"); + +const TypedArrayLength = getSelfHostedValue("TypedArrayLength"); + +function testTypedArrayLength() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab), + new Int8Array(ab, 1), + new Int8Array(ab, 2), + new Int8Array(ab, 3), + ]; + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayLength(ta), 100 - (i & 3)); + } +} +testTypedArrayLength(); + +function testTypedArrayLengthOutOfBounds() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab, 0, 10), + new Int8Array(ab, 1, 10), + new Int8Array(ab, 2, 10), + new Int8Array(ab, 3, 10), + ]; + + // Resize to zero to make all views out-of-bounds. + ab.resize(0); + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertThrowsInstanceOf(() => TypedArrayLength(ta), TypeError); + } +} +testTypedArrayLengthOutOfBounds(); + +function testTypedArrayLengthDetached() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab, 0, 10), + new Int8Array(ab, 1, 10), + new Int8Array(ab, 2, 10), + new Int8Array(ab, 3, 10), + ]; + + // Detach the buffer. + ab.transfer(); + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayLength(ta), 0); + } +} +testTypedArrayLengthDetached(); + +function testTypedArrayLengthWithShared() { + let ab = new SharedArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab), + new Int8Array(ab, 1), + new Int8Array(ab, 2), + new Int8Array(ab, 3), + ]; + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayLength(ta), 100 - (i & 3)); + } +} +testTypedArrayLengthWithShared(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLengthZeroOnOutOfBounds.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLengthZeroOnOutOfBounds.js new file mode 100644 index 0000000000..a272d7d8c2 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-intrinsic-typedArrayLengthZeroOnOutOfBounds.js @@ -0,0 +1,75 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +load(libdir + "asserts.js"); + +const TypedArrayLengthZeroOnOutOfBounds = getSelfHostedValue("TypedArrayLengthZeroOnOutOfBounds"); + +function testTypedArrayLength() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab), + new Int8Array(ab, 1), + new Int8Array(ab, 2), + new Int8Array(ab, 3), + ]; + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayLengthZeroOnOutOfBounds(ta), 100 - (i & 3)); + } +} +testTypedArrayLength(); + +function testTypedArrayLengthOutOfBounds() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab, 0, 10), + new Int8Array(ab, 1, 10), + new Int8Array(ab, 2, 10), + new Int8Array(ab, 3, 10), + ]; + + // Resize to zero to make all views out-of-bounds. + ab.resize(0); + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayLengthZeroOnOutOfBounds(ta), 0); + } +} +testTypedArrayLengthOutOfBounds(); + +function testTypedArrayLengthDetached() { + let ab = new ArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab, 0, 10), + new Int8Array(ab, 1, 10), + new Int8Array(ab, 2, 10), + new Int8Array(ab, 3, 10), + ]; + + // Detach the buffer. + ab.transfer(); + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayLengthZeroOnOutOfBounds(ta), 0); + } +} +testTypedArrayLengthDetached(); + +function testTypedArrayLengthWithShared() { + let ab = new SharedArrayBuffer(100, {maxByteLength: 100}); + let typedArrays = [ + new Int8Array(ab), + new Int8Array(ab, 1), + new Int8Array(ab, 2), + new Int8Array(ab, 3), + ]; + + for (let i = 0; i < 200; ++i) { + let ta = typedArrays[i & 3]; + assertEq(TypedArrayLengthZeroOnOutOfBounds(ta), 100 - (i & 3)); + } +} +testTypedArrayLengthWithShared(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-length-with-sab.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-length-with-sab.js new file mode 100644 index 0000000000..9b1a9d41e8 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-length-with-sab.js @@ -0,0 +1,29 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +function testResizableArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new Int8Array(sab, 0, i); + for (let j = 0; j < 100; ++j) { + assertEq(ta.length, i); + + sab.grow(i + j + 1); + assertEq(ta.length, i); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBuffer(); + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let sab = new SharedArrayBuffer(i, {maxByteLength: i + 100}); + let ta = new Int8Array(sab); + for (let j = 0; j < 100; ++j) { + assertEq(ta.length, i + j); + + sab.grow(i + j + 1); + assertEq(ta.length, i + j + 1); + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-length.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-length.js new file mode 100644 index 0000000000..96bbc9752e --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-length.js @@ -0,0 +1,41 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +function testResizableArrayBuffer() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new Int8Array(ab, 0, i); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.length, i); + + ab.resize(i + 1); + assertEq(ta.length, i); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ta.length, 0); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBuffer(); + +function testResizableArrayBufferAutoLength() { + for (let i = 0; i < 4; ++i) { + let ab = new ArrayBuffer(i, {maxByteLength: i + 1}); + let ta = new Int8Array(ab); + for (let j = 0; j < 100; ++j) { + ab.resize(i); + assertEq(ta.length, i); + + ab.resize(i + 1); + assertEq(ta.length, i + 1); + + if (i > 0) { + ab.resize(i - 1); + assertEq(ta.length, i - 1); + } + } + } +} +for (let i = 0; i < 2; ++i) testResizableArrayBufferAutoLength(); diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem-with-sab.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem-with-sab.js new file mode 100644 index 0000000000..67a15e7714 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem-with-sab.js @@ -0,0 +1,54 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize||!this.SharedArrayBuffer + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Uint8ClampedArray, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new SharedArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + // In-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % length; + + let v = type(i); + actual[index] = v; + expected[index] = v; + + assertEq(actual[index], expected[index]); + } + + // Out-of-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % (length + 4); + + let v = type(i); + actual[index] = v; + expected[index] = v; + + assertEq(actual[index], expected[index]); + } +} + +for (let TA of TypedArrays) { + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`)(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem.js b/js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem.js new file mode 100644 index 0000000000..91f5c7b048 --- /dev/null +++ b/js/src/jit-test/tests/typedarray/resizable-typedarray-set-elem.js @@ -0,0 +1,54 @@ +// |jit-test| --enable-arraybuffer-resizable; skip-if: !ArrayBuffer.prototype.resize + +const TypedArrays = [ + Int8Array, + Uint8Array, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Uint8ClampedArray, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array, +]; + +function test(TA) { + const length = 4; + const byteLength = length * TA.BYTES_PER_ELEMENT; + + let rab = new ArrayBuffer(byteLength, {maxByteLength: byteLength}); + let actual = new TA(rab); + let expected = new TA(length); + let type = expected[0].constructor; + + // In-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % length; + + let v = type(i); + actual[index] = v; + expected[index] = v; + + assertEq(actual[index], expected[index]); + } + + // Out-of-bounds access + for (let i = 0; i < 200; ++i) { + let index = i % (length + 4); + + let v = type(i); + actual[index] = v; + expected[index] = v; + + assertEq(actual[index], expected[index]); + } +} + +for (let TA of TypedArrays) { + // Copy test function to ensure monomorphic ICs. + let copy = Function(`return ${test}`)(); + + copy(TA); +} diff --git a/js/src/jit-test/tests/warp/bug1665303.js b/js/src/jit-test/tests/warp/bug1665303.js index b2c26e01cf..3b0bc75079 100644 --- a/js/src/jit-test/tests/warp/bug1665303.js +++ b/js/src/jit-test/tests/warp/bug1665303.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this); --fast-warmup +// |jit-test| --fast-warmup // Prevent slowness with --ion-eager. setJitCompilerOption("ion.warmup.trigger", 100); diff --git a/js/src/jit-test/tests/warp/bug1667685.js b/js/src/jit-test/tests/warp/bug1667685.js index 2b9e392d24..99699b88d5 100644 --- a/js/src/jit-test/tests/warp/bug1667685.js +++ b/js/src/jit-test/tests/warp/bug1667685.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this); --fast-warmup +// |jit-test| --fast-warmup // Prevent slowness with --ion-eager. setJitCompilerOption("ion.warmup.trigger", 100); diff --git a/js/src/jit-test/tests/warp/bug1668197.js b/js/src/jit-test/tests/warp/bug1668197.js index 2dcd6cb376..24e1becec0 100644 --- a/js/src/jit-test/tests/warp/bug1668197.js +++ b/js/src/jit-test/tests/warp/bug1668197.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) function f(x, y) { return ~Math.hypot(x >>> 0, 2 - x >>> 0); } diff --git a/js/src/jit-test/tests/warp/bug1871089.js b/js/src/jit-test/tests/warp/bug1871089.js new file mode 100644 index 0000000000..8abddb6574 --- /dev/null +++ b/js/src/jit-test/tests/warp/bug1871089.js @@ -0,0 +1,13 @@ +// |jit-test| --fast-warmup +var i = 0; +function a() { + if (i++ > 50) { + return; + } + function b() { + new a("abcdefghijklm"); + } + [new b]; +} +gczeal(4); +a(); diff --git a/js/src/jit-test/tests/warp/trial-inline-gc-4.js b/js/src/jit-test/tests/warp/trial-inline-gc-4.js new file mode 100644 index 0000000000..2aecd4d371 --- /dev/null +++ b/js/src/jit-test/tests/warp/trial-inline-gc-4.js @@ -0,0 +1,42 @@ +// 1) Trial inline f => g1 => h. +// 2) Make f => g1 call site polymorphic by calling f => g2. +// This gets rid of the ICScript::inlinedChildren_ edge. +// 3) Restore f => g1. +// 4) Trigger a shrinking GC from f => g1 => h (h not trial-inlined; h preserves Baseline code) +// This purges h's inlined ICScript. +// 5) Call f => g1 => h (trial inlined). This must not use the discarded ICScript. +function h(i, x) { + if (i === 900) { + // Step 4. + gc(this, "shrinking"); + } + return x + 1; +} +function g2(i, x) { + if (i === 820) { + // Step 3. + callee = g1; + } + return h(i, x) + x; +} +function g1(i, x) { + if (i === 800) { + // Step 2. + callee = g2; + } + if (i === 900) { + // Step 4. + h(i, x); + } + return h(i, x) + x; +} + +var callee = g1; + +function f() { + for (var i = 0; i < 1000; i++) { + callee(i, i); + callee(i, "foo"); + } +} +f(); diff --git a/js/src/jit-test/tests/wasm/binary.js b/js/src/jit-test/tests/wasm/binary.js index 5a59330768..f7d60a56ce 100644 --- a/js/src/jit-test/tests/wasm/binary.js +++ b/js/src/jit-test/tests/wasm/binary.js @@ -119,7 +119,7 @@ wasmEval(moduleWithSections([tableSection0()])); wasmEval(moduleWithSections([memorySection(0)])); -function invalidMemorySection2() { +function memorySection2() { var body = []; body.push(...varU32(2)); // number of memories body.push(...varU32(0x0)); @@ -130,7 +130,11 @@ function invalidMemorySection2() { } wasmEval(moduleWithSections([memorySection0()])); -assertErrorMessage(() => wasmEval(moduleWithSections([invalidMemorySection2()])), CompileError, /number of memories must be at most one/); +if (wasmMultiMemoryEnabled()) { + wasmEval(moduleWithSections([memorySection2()])); +} else { + assertErrorMessage(() => wasmEval(moduleWithSections([memorySection2()])), CompileError, /number of memories must be at most one/); +} // Test early 'end' const bodyMismatch = /(function body length mismatch)|(operators remaining after end of function)/; diff --git a/js/src/jit-test/tests/wasm/bug1858423.js b/js/src/jit-test/tests/wasm/bug1858423.js index a90d308906..f6296c03d9 100644 --- a/js/src/jit-test/tests/wasm/bug1858423.js +++ b/js/src/jit-test/tests/wasm/bug1858423.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-gc; skip-if: !wasmCachingEnabled() || !wasmGcEnabled() +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmCachingEnabled() || !wasmGcEnabled() const code = wasmTextToBinary(`(module (type $t (struct (field i32) (field anyref))) diff --git a/js/src/jit-test/tests/wasm/builtin-modules/integer-gemm/directives.txt b/js/src/jit-test/tests/wasm/builtin-modules/integer-gemm/directives.txt index 46c9c504f4..7c458ede07 100644 --- a/js/src/jit-test/tests/wasm/builtin-modules/integer-gemm/directives.txt +++ b/js/src/jit-test/tests/wasm/builtin-modules/integer-gemm/directives.txt @@ -1 +1 @@ -|jit-test| --wasm-moz-intgemm; skip-if: (!getBuildConfiguration("x64") && !getBuildConfiguration("x86") && !getBuildConfiguration("arm64")) || getBuildConfiguration("simulator") || !wasmMozIntGemmEnabled() +|jit-test| --setpref=wasm_moz_intgemm=true; skip-if: (!getBuildConfiguration("x64") && !getBuildConfiguration("x86") && !getBuildConfiguration("arm64")) || getBuildConfiguration("simulator") || !wasmMozIntGemmEnabled() diff --git a/js/src/jit-test/tests/wasm/builtin-modules/js-string/basic.js b/js/src/jit-test/tests/wasm/builtin-modules/js-string/basic.js index dce6204fee..2c0ecb89c5 100644 --- a/js/src/jit-test/tests/wasm/builtin-modules/js-string/basic.js +++ b/js/src/jit-test/tests/wasm/builtin-modules/js-string/basic.js @@ -1,110 +1,126 @@ // |jit-test| skip-if: !wasmJSStringBuiltinsEnabled(); -let testModule = wasmTextToBinary(`(module +let testModule = `(module + (type $arrayMutI16 (array (mut i16))) + (func - (import "wasm:js-string" "fromWTF16Array") - (param anyref i32 i32) - (result externref) + (import "wasm:js-string" "test") + (param externref) + (result i32) + ) + (export "test" (func 0)) + + (func + (import "wasm:js-string" "cast") + (param externref) + (result (ref extern)) + ) + (export "cast" (func 1)) + + (func + (import "wasm:js-string" "fromCharCodeArray") + (param (ref null $arrayMutI16) i32 i32) + (result (ref extern)) ) - (export "fromWTF16Array" (func 0)) + (export "fromCharCodeArray" (func 2)) (func - (import "wasm:js-string" "toWTF16Array") - (param externref anyref i32) + (import "wasm:js-string" "intoCharCodeArray") + (param externref (ref null $arrayMutI16) i32) (result i32) ) - (export "toWTF16Array" (func 1)) + (export "intoCharCodeArray" (func 3)) (func (import "wasm:js-string" "fromCharCode") (param i32) (result externref) ) - (export "fromCharCode" (func 2)) + (export "fromCharCode" (func 4)) (func (import "wasm:js-string" "fromCodePoint") (param i32) (result externref) ) - (export "fromCodePoint" (func 3)) + (export "fromCodePoint" (func 5)) (func (import "wasm:js-string" "charCodeAt") (param externref i32) (result i32) ) - (export "charCodeAt" (func 4)) + (export "charCodeAt" (func 6)) (func (import "wasm:js-string" "codePointAt") (param externref i32) (result i32) ) - (export "codePointAt" (func 5)) + (export "codePointAt" (func 7)) (func (import "wasm:js-string" "length") (param externref) (result i32) ) - (export "length" (func 6)) + (export "length" (func 8)) (func - (import "wasm:js-string" "concatenate") + (import "wasm:js-string" "concat") (param externref externref) (result externref) ) - (export "concatenate" (func 7)) + (export "concat" (func 9)) (func (import "wasm:js-string" "substring") (param externref i32 i32) (result externref) ) - (export "substring" (func 8)) + (export "substring" (func 10)) (func (import "wasm:js-string" "equals") (param externref externref) (result i32) ) - (export "equals" (func 9)) + (export "equals" (func 11)) (func (import "wasm:js-string" "compare") (param externref externref) (result i32) ) - (export "compare" (func 10)) -)`); + (export "compare" (func 12)) +)`; let { - createArray, + createArrayMutI16, arrayLength, arraySet, arrayGet } = wasmEvalText(`(module - (type $i16Array (array (mut i16))) - (func (export "createArray") (param i32) (result anyref) + (type $arrayMutI16 (array (mut i16))) + (func (export "createArrayMutI16") (param i32) (result anyref) i32.const 0 local.get 0 - array.new $i16Array + array.new $arrayMutI16 ) (func (export "arrayLength") (param arrayref) (result i32) local.get 0 array.len ) - (func (export "arraySet") (param (ref $i16Array) i32 i32) + (func (export "arraySet") (param (ref $arrayMutI16) i32 i32) local.get 0 local.get 1 local.get 2 - array.set $i16Array + array.set $arrayMutI16 ) - (func (export "arrayGet") (param (ref $i16Array) i32) (result i32) + (func (export "arrayGet") (param (ref $arrayMutI16) i32) (result i32) local.get 0 local.get 1 - array.get_u $i16Array + array.get_u $arrayMutI16 ) )`).exports; @@ -114,9 +130,23 @@ function throwIfNotString(a) { } } let polyFillImports = { - fromWTF16Array: (array, arrayStart, arrayCount) => { - arrayStart |= 0; - arrayCount |= 0; + test: (string) => { + if (string === null || + typeof string !== "string") { + return 0; + } + return 1; + }, + cast: (string) => { + if (string === null || + typeof string !== "string") { + throw new WebAssembly.RuntimeError(); + } + return string; + }, + fromCharCodeArray: (array, arrayStart, arrayCount) => { + arrayStart >>>= 0; + arrayCount >>>= 0; let length = arrayLength(array); if (BigInt(arrayStart) + BigInt(arrayCount) > BigInt(length)) { throw new WebAssembly.RuntimeError(); @@ -127,8 +157,8 @@ let polyFillImports = { } return result; }, - toWTF16Array: (string, arr, arrayStart) => { - arrayStart |= 0; + intoCharCodeArray: (string, arr, arrayStart) => { + arrayStart >>>= 0; throwIfNotString(string); let arrLength = arrayLength(arr); let stringLength = string.length; @@ -141,22 +171,22 @@ let polyFillImports = { return stringLength; }, fromCharCode: (charCode) => { - charCode |= 0; + charCode >>>= 0; return String.fromCharCode(charCode); }, fromCodePoint: (codePoint) => { - codePoint |= 0; + codePoint >>>= 0; return String.fromCodePoint(codePoint); }, charCodeAt: (string, stringIndex) => { - stringIndex |= 0; + stringIndex >>>= 0; throwIfNotString(string); if (stringIndex >= string.length) throw new WebAssembly.RuntimeError(); return string.charCodeAt(stringIndex); }, codePointAt: (string, stringIndex) => { - stringIndex |= 0; + stringIndex >>>= 0; throwIfNotString(string); if (stringIndex >= string.length) throw new WebAssembly.RuntimeError(); @@ -166,14 +196,14 @@ let polyFillImports = { throwIfNotString(string); return string.length; }, - concatenate: (stringA, stringB) => { + concat: (stringA, stringB) => { throwIfNotString(stringA); throwIfNotString(stringB); return stringA + stringB; }, substring: (string, startIndex, endIndex) => { - startIndex |= 0; - endIndex |= 0; + startIndex >>>= 0; + endIndex >>>= 0; throwIfNotString(string); if (startIndex > string.length, endIndex > string.length, @@ -217,7 +247,6 @@ function assertSameBehavior(funcA, funcB, ...params) { if (errA || errB) { assertEq(errA === null, errB === null, errA ? errA.message : errB.message); assertEq(Object.getPrototypeOf(errA), Object.getPrototypeOf(errB)); - assertEq(errA.message, errB.message); } assertEq(resultA, resultB); @@ -227,13 +256,30 @@ function assertSameBehavior(funcA, funcB, ...params) { return resultA; } -let builtinExports = new WebAssembly.Instance(new WebAssembly.Module(testModule, {builtins: ["js-string"]}), {}).exports; -let polyfillExports = new WebAssembly.Instance(new WebAssembly.Module(testModule), { 'wasm:js-string': polyFillImports }).exports; +let builtinExports = wasmEvalText(testModule, {}, {builtins: ["js-string"]}).exports; +let polyfillExports = wasmEvalText(testModule, { 'wasm:js-string': polyFillImports }).exports; let testStrings = ["", "a", "1", "ab", "hello, world", "\n", "☺", "☺smiley", String.fromCodePoint(0x10000, 0x10001)]; let testCharCodes = [1, 2, 3, 10, 0x7f, 0xff, 0xfffe, 0xffff]; let testCodePoints = [1, 2, 3, 10, 0x7f, 0xff, 0xfffe, 0xffff, 0x10000, 0x10001]; +for (let a of WasmExternrefValues) { + assertSameBehavior( + builtinExports['test'], + polyfillExports['test'], + a + ); + try { + assertSameBehavior( + builtinExports['cast'], + polyfillExports['cast'], + a + ); + } catch (err) { + assertEq(err instanceof WebAssembly.RuntimeError, true); + } +} + for (let a of testCharCodes) { assertSameBehavior( builtinExports['fromCharCode'], @@ -272,16 +318,16 @@ for (let a of testStrings) { ); } - let array = createArray(length); + let arrayMutI16 = createArrayMutI16(length); assertSameBehavior( - builtinExports['toWTF16Array'], - polyfillExports['toWTF16Array'], - a, array, 0 + builtinExports['intoCharCodeArray'], + polyfillExports['intoCharCodeArray'], + a, arrayMutI16, 0 ); assertSameBehavior( - builtinExports['fromWTF16Array'], - polyfillExports['fromWTF16Array'], - array, 0, length + builtinExports['fromCharCodeArray'], + polyfillExports['fromCharCodeArray'], + arrayMutI16, 0, length ); for (let i = 0; i < length; i++) { @@ -298,8 +344,8 @@ for (let a of testStrings) { for (let a of testStrings) { for (let b of testStrings) { assertSameBehavior( - builtinExports['concatenate'], - polyfillExports['concatenate'], + builtinExports['concat'], + polyfillExports['concat'], a, b ); assertSameBehavior( @@ -314,3 +360,13 @@ for (let a of testStrings) { ); } } + +// fromCharCodeArray length is an unsigned integer +{ + let arrayMutI16 = createArrayMutI16(1); + assertErrorMessage(() => assertSameBehavior( + builtinExports['fromCharCodeArray'], + polyfillExports['fromCharCodeArray'], + arrayMutI16, 1, -1 + ), WebAssembly.RuntimeError, /./); +} diff --git a/js/src/jit-test/tests/wasm/builtin-modules/js-string/directives.txt b/js/src/jit-test/tests/wasm/builtin-modules/js-string/directives.txt index 8c5e6882eb..408d4dd01a 100644 --- a/js/src/jit-test/tests/wasm/builtin-modules/js-string/directives.txt +++ b/js/src/jit-test/tests/wasm/builtin-modules/js-string/directives.txt @@ -1 +1 @@ -|jit-test| --wasm-gc; --wasm-js-string-builtins; test-also=--wasm-compiler=optimizing; include:wasm.js +|jit-test| --setpref=wasm_js_string_builtins=true; test-also=--wasm-compiler=optimizing; include:wasm.js diff --git a/js/src/jit-test/tests/wasm/builtin-modules/oom-test.js b/js/src/jit-test/tests/wasm/builtin-modules/oom-test.js index 32aa1b2515..aaf8d1e5c3 100644 --- a/js/src/jit-test/tests/wasm/builtin-modules/oom-test.js +++ b/js/src/jit-test/tests/wasm/builtin-modules/oom-test.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { const module = wasmBuiltinI8VecMul(); WebAssembly.Module.imports(module); diff --git a/js/src/jit-test/tests/wasm/directiveless/bug1877358.js b/js/src/jit-test/tests/wasm/directiveless/bug1877358.js index 1f8fad0e43..10cb54398a 100644 --- a/js/src/jit-test/tests/wasm/directiveless/bug1877358.js +++ b/js/src/jit-test/tests/wasm/directiveless/bug1877358.js @@ -1,4 +1,4 @@ -// |jit-test| --no-wasm-exceptions; include:wasm.js +// |jit-test| -P wasm_exceptions=false; include:wasm.js let {test} = wasmEvalText(`(module (func $m (import "" "m")) diff --git a/js/src/jit-test/tests/wasm/directives.txt b/js/src/jit-test/tests/wasm/directives.txt index 15c7511171..4a2413125a 100644 --- a/js/src/jit-test/tests/wasm/directives.txt +++ b/js/src/jit-test/tests/wasm/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); test-also=--wasm-test-serialization; test-also=--wasm-compiler=optimizing --no-avx; skip-variant-if: --wasm-compiler=optimizing --no-avx, !getBuildConfiguration("x86") && !getBuildConfiguration("x64") || getBuildConfiguration("simulator"); include:wasm.js +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); test-also=--setpref=wasm_test_serialization=true; test-also=--wasm-compiler=optimizing --no-avx; skip-variant-if: --wasm-compiler=optimizing --no-avx, !getBuildConfiguration("x86") && !getBuildConfiguration("x64") || getBuildConfiguration("simulator"); include:wasm.js diff --git a/js/src/jit-test/tests/wasm/exceptions/bug-1751699.js b/js/src/jit-test/tests/wasm/exceptions/bug-1751699.js index 38268e7905..c60a94a8ed 100644 --- a/js/src/jit-test/tests/wasm/exceptions/bug-1751699.js +++ b/js/src/jit-test/tests/wasm/exceptions/bug-1751699.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { wasmEvalText(` (import "" "" (func $d)) diff --git a/js/src/jit-test/tests/wasm/exceptions/bug-1788213.js b/js/src/jit-test/tests/wasm/exceptions/bug-1788213.js index 4d0b4abcdc..7c0710c117 100644 --- a/js/src/jit-test/tests/wasm/exceptions/bug-1788213.js +++ b/js/src/jit-test/tests/wasm/exceptions/bug-1788213.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { wasmEvalText(`(import "" "" (tag $undef)) (func throw 0) (func (try (do)))`); }); diff --git a/js/src/jit-test/tests/wasm/exceptions/bug-1791361.js b/js/src/jit-test/tests/wasm/exceptions/bug-1791361.js index 9c4432de91..0e09a8a746 100644 --- a/js/src/jit-test/tests/wasm/exceptions/bug-1791361.js +++ b/js/src/jit-test/tests/wasm/exceptions/bug-1791361.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { wasmEvalText(` (tag $d) diff --git a/js/src/jit-test/tests/wasm/exceptions/directives.txt b/js/src/jit-test/tests/wasm/exceptions/directives.txt index 84f10ac2b3..c9c2613039 100644 --- a/js/src/jit-test/tests/wasm/exceptions/directives.txt +++ b/js/src/jit-test/tests/wasm/exceptions/directives.txt @@ -1 +1 @@ -|jit-test| --wasm-exceptions; test-also=--wasm-exnref; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; include:wasm.js; skip-if: !wasmExceptionsEnabled() +|jit-test| test-also=--setpref=wasm_exnref=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; include:wasm.js diff --git a/js/src/jit-test/tests/wasm/exceptions/oom-construct-message.js b/js/src/jit-test/tests/wasm/exceptions/oom-construct-message.js index a7820876bc..8eb515ea9b 100644 --- a/js/src/jit-test/tests/wasm/exceptions/oom-construct-message.js +++ b/js/src/jit-test/tests/wasm/exceptions/oom-construct-message.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - const tag = new WebAssembly.Tag({ parameters: ["i32"] }); oomTest(() => { new WebAssembly.Exception(tag, []); diff --git a/js/src/jit-test/tests/wasm/exceptions/oom-create-exception-data.js b/js/src/jit-test/tests/wasm/exceptions/oom-create-exception-data.js index 0aa1e75698..51d4558da8 100644 --- a/js/src/jit-test/tests/wasm/exceptions/oom-create-exception-data.js +++ b/js/src/jit-test/tests/wasm/exceptions/oom-create-exception-data.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - const tag = new WebAssembly.Tag({ parameters: ["i32", "i32", "i32", "i32"] }); const params = [0, 0, 0, 0]; oomTest(() => { diff --git a/js/src/jit-test/tests/wasm/exceptions/unreachable.js b/js/src/jit-test/tests/wasm/exceptions/unreachable.js index f0091bc617..2dc2c8b3b1 100644 --- a/js/src/jit-test/tests/wasm/exceptions/unreachable.js +++ b/js/src/jit-test/tests/wasm/exceptions/unreachable.js @@ -1,4 +1,4 @@ -// |jit-test| test-also=--wasm-function-references --wasm-gc --wasm-compiler=optimizing; test-also=--wasm-function-references --wasm-gc --wasm-compiler=baseline; +// |jit-test| test-also=--setpref=wasm_gc=true --wasm-compiler=optimizing; test-also=--setpref=wasm_gc=true --wasm-compiler=baseline; wasmFailValidateText(`(module (tag) diff --git a/js/src/jit-test/tests/wasm/exnref/bug1883865.js b/js/src/jit-test/tests/wasm/exnref/bug1883865.js new file mode 100644 index 0000000000..d6418d1285 --- /dev/null +++ b/js/src/jit-test/tests/wasm/exnref/bug1883865.js @@ -0,0 +1,25 @@ +// Checks proper padding for nested tryNotes. + +new WebAssembly.Module(wasmTextToBinary(`(module + (func + try_table $l3 + try_table $l4 + try_table $l5 + end + end + end + ) +)`)); + +new WebAssembly.Module(wasmTextToBinary(`(module + (func + try_table $l3 + try_table $l4 + try_table $l5 + end + try_table $l5a + end + end + end + ) +)`)); diff --git a/js/src/jit-test/tests/wasm/exnref/directives.txt b/js/src/jit-test/tests/wasm/exnref/directives.txt index bc17009ea8..b993dbd1d5 100644 --- a/js/src/jit-test/tests/wasm/exnref/directives.txt +++ b/js/src/jit-test/tests/wasm/exnref/directives.txt @@ -1 +1 @@ -|jit-test| --wasm-exnref; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; include:wasm.js; skip-if: !wasmExnRefEnabled() +|jit-test| --setpref=wasm_exnref=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; include:wasm.js; skip-if: !wasmExnRefEnabled() diff --git a/js/src/jit-test/tests/wasm/extended-const/basic.js b/js/src/jit-test/tests/wasm/extended-const/basic.js index bf0ce460d5..6b71385cb6 100644 --- a/js/src/jit-test/tests/wasm/extended-const/basic.js +++ b/js/src/jit-test/tests/wasm/extended-const/basic.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !wasmExtendedConstEnabled() - function testPrivateGlobal(valtype, expr, result) { // Immutable private globals have a single cell for wasm. let { get } = wasmEvalText(`(module diff --git a/js/src/jit-test/tests/wasm/extended-const/directives.txt b/js/src/jit-test/tests/wasm/extended-const/directives.txt index 0d16de6524..c4b5e420f1 100644 --- a/js/src/jit-test/tests/wasm/extended-const/directives.txt +++ b/js/src/jit-test/tests/wasm/extended-const/directives.txt @@ -1 +1 @@ -|jit-test| --wasm-extended-const; test-also=--wasm-compiler=optimizing; test-also=--wasm-test-serialization; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; include:wasm.js +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--setpref=wasm_test_serialization=true; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; include:wasm.js diff --git a/js/src/jit-test/tests/wasm/extended-const/disabled.js b/js/src/jit-test/tests/wasm/extended-const/disabled.js deleted file mode 100644 index 01e64f6c44..0000000000 --- a/js/src/jit-test/tests/wasm/extended-const/disabled.js +++ /dev/null @@ -1,22 +0,0 @@ -// |jit-test| skip-if: wasmExtendedConstEnabled() - -const { CompileError, validate } = WebAssembly; - -const DISABLED = /extended constant expressions not enabled|unrecognized opcode/; - -let tests = [ - "(module (global i32 i32.const 0 i32.const 0 i32.add))", - "(module (global i32 i32.const 0 i32.const 0 i32.sub))", - "(module (global i32 i32.const 0 i32.const 0 i32.mul))", - "(module (global i64 i64.const 0 i64.const 0 i64.add))", - "(module (global i64 i64.const 0 i64.const 0 i64.sub))", - "(module (global i64 i64.const 0 i64.const 0 i64.mul))", -]; - -// Test that use of extended constants fails when disabled. - -for (let src of tests) { - let bin = wasmTextToBinary(src); - assertEq(validate(bin), false); - wasmCompilationShouldFail(bin, DISABLED); -} diff --git a/js/src/jit-test/tests/wasm/extended-const/pathological.js b/js/src/jit-test/tests/wasm/extended-const/pathological.js index e3695f3625..8a87b25be4 100644 --- a/js/src/jit-test/tests/wasm/extended-const/pathological.js +++ b/js/src/jit-test/tests/wasm/extended-const/pathological.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !wasmExtendedConstEnabled() - // Let's calculate zero in some elaborate ways. function testFancyZeroOffset(fancyZero, memType = 'i32') { try { diff --git a/js/src/jit-test/tests/wasm/features.js b/js/src/jit-test/tests/wasm/features.js index 904dd03e76..3292334ee6 100644 --- a/js/src/jit-test/tests/wasm/features.js +++ b/js/src/jit-test/tests/wasm/features.js @@ -1,5 +1,3 @@ -// |jit-test| test-also=--wasm-extended-const; test-also=--wasm-exceptions; - // Test that if a feature is 'experimental' then we must be in a nightly build, // and if a feature is 'released' then it must be enabled on release and beta. // @@ -67,27 +65,17 @@ for (let [name, enabled, test] of releasedFeaturesMaybeDisabledAnyway) { let releasedFeatures = [ ['threads', wasmThreadsEnabled(), `(module (memory 1 1 shared))`], - [ - 'exceptions', - wasmExceptionsEnabled(), - `(module (type (func)) (tag (type 0)))` - ], - [ - 'extended-const', - wasmExtendedConstEnabled(), - `(module - (global i32 - i32.const 0 - i32.const 0 - i32.add - ) - )` - ], [ 'tail-calls', wasmTailCallsEnabled(), `(module (func) (func (return_call 0)))` ], + ['gc', wasmGcEnabled(), `(module (type (struct)))`], + [ + 'multi-memory', + wasmMultiMemoryEnabled(), + `(module (memory 0) (memory 0))`, + ], ]; for (let [name, enabled, test] of releasedFeatures) { diff --git a/js/src/jit-test/tests/wasm/function-references/as-non-null.js b/js/src/jit-test/tests/wasm/function-references/as-non-null.js index 1280c8ee06..6fd02d61ac 100644 --- a/js/src/jit-test/tests/wasm/function-references/as-non-null.js +++ b/js/src/jit-test/tests/wasm/function-references/as-non-null.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() let {checkNonNull} = wasmEvalText(`(module (func (export "checkNonNull") (param externref) (result (ref extern)) diff --git a/js/src/jit-test/tests/wasm/function-references/binary.js b/js/src/jit-test/tests/wasm/function-references/binary.js index 91cf807dc4..0e64f0723e 100644 --- a/js/src/jit-test/tests/wasm/function-references/binary.js +++ b/js/src/jit-test/tests/wasm/function-references/binary.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() load(libdir + "wasm-binary.js"); diff --git a/js/src/jit-test/tests/wasm/function-references/br-non-null.js b/js/src/jit-test/tests/wasm/function-references/br-non-null.js index 371cdaa40a..6d359105fb 100644 --- a/js/src/jit-test/tests/wasm/function-references/br-non-null.js +++ b/js/src/jit-test/tests/wasm/function-references/br-non-null.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() // br_on_non_null from constant wasmValidateText(`(module diff --git a/js/src/jit-test/tests/wasm/function-references/br-null.js b/js/src/jit-test/tests/wasm/function-references/br-null.js index 26d1013de2..08728a3644 100644 --- a/js/src/jit-test/tests/wasm/function-references/br-null.js +++ b/js/src/jit-test/tests/wasm/function-references/br-null.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() // br_on_null from constant wasmValidateText(`(module diff --git a/js/src/jit-test/tests/wasm/function-references/call_ref.js b/js/src/jit-test/tests/wasm/function-references/call_ref.js index 514c3145d6..50bdfb6441 100644 --- a/js/src/jit-test/tests/wasm/function-references/call_ref.js +++ b/js/src/jit-test/tests/wasm/function-references/call_ref.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() let { plusOne } = wasmEvalText(`(module (; forward declaration so that ref.func works ;) diff --git a/js/src/jit-test/tests/wasm/function-references/directives.txt b/js/src/jit-test/tests/wasm/function-references/directives.txt index f7d2135421..293724e57a 100644 --- a/js/src/jit-test/tests/wasm/function-references/directives.txt +++ b/js/src/jit-test/tests/wasm/function-references/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing --wasm-function-references; test-also=--wasm-compiler=baseline --wasm-function-references; include:wasm.js +|jit-test| test-also=--setpref=wasm_gc=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js diff --git a/js/src/jit-test/tests/wasm/function-references/disabled.js b/js/src/jit-test/tests/wasm/function-references/disabled.js index 70a66a937d..6e67d2ce7f 100644 --- a/js/src/jit-test/tests/wasm/function-references/disabled.js +++ b/js/src/jit-test/tests/wasm/function-references/disabled.js @@ -1,8 +1,8 @@ -// |jit-test| skip-if: wasmFunctionReferencesEnabled() +// |jit-test| skip-if: wasmGcEnabled() const { CompileError, validate } = WebAssembly; -const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|bad type|\(ref T\) types not enabled/; +const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|bad type|gc not enabled/; let simpleTests = [ `(module (func (param (ref 0)) (unreachable)))`, diff --git a/js/src/jit-test/tests/wasm/function-references/nnl-test.js b/js/src/jit-test/tests/wasm/function-references/nnl-test.js index 9436b970d5..df79a748a9 100644 --- a/js/src/jit-test/tests/wasm/function-references/nnl-test.js +++ b/js/src/jit-test/tests/wasm/function-references/nnl-test.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() // Generates combinations of different block types and operations for // non-defaultable locals (local.set / .tee / .get). diff --git a/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js b/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js index 97ab04713c..4efdfcd642 100644 --- a/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js +++ b/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() // non-null table initialization var { get1, get2, get3, get4 } = wasmEvalText(`(module @@ -40,25 +40,33 @@ for (let i of [ )`, /(type mismatch|table with non-nullable references requires initializer)/); } -var t1 = new WebAssembly.Table({initial: 10, element: {ref: 'func', nullable: false }}, sampleWasmFunction); +let values = "10 funcref (ref.func $dummy)"; +let t1 = new wasmEvalText(`(module (func $dummy) (table (export "t1") ${values}))`).exports.t1; assertEq(t1.get(2) != null, true); -assertThrows(() => { - new WebAssembly.Table({initial: 10, element: {ref: 'func', nullable: false }}); -}); -assertThrows(() => { - new WebAssembly.Table({initial: 10, element: {ref: 'func', nullable: false }}, null); -}); -var t2 = new WebAssembly.Table({initial: 6, maximum: 20, element: {ref: 'extern', nullable: false }}, {foo: "bar"}); -assertEq(t2.get(1).foo, "bar"); +wasmFailValidateText(`(module + (table $t 10 (ref func)) +)`, /table with non-nullable references requires initializer/); + +wasmFailValidateText(` +(module + (func $dummy) + (table (export "t") 10 funcref (ref.null none)) +)`, /type mismatch/); + +const foo = "bar"; +const { t2, get } = wasmEvalText(` +(module + (global (import "" "foo") externref) + (table (export "t2") 6 20 externref (global.get 0)) +)`, { "": { "foo": foo } }).exports; + +assertEq(t2.get(5), "bar"); assertThrows(() => { t2.get(7) }); -assertThrows(() => { t2.grow(9, null) }); +assertThrows(() => { t2.grow(30, null) }); t2.grow(8, {t: "test"}); -assertEq(t2.get(3).foo, "bar"); +assertEq(t2.get(3), "bar"); assertEq(t2.get(7).t, "test"); -assertThrows(() => { - new WebAssembly.Table({initial: 10, element: {ref: 'extern', nullable: false }}, null); -}); // Fail because tables come before globals in the binary format, so tables // cannot refer to globals. diff --git a/js/src/jit-test/tests/wasm/function-references/non-nullable.js b/js/src/jit-test/tests/wasm/function-references/non-nullable.js index afe1d3cb43..653bbe7ab6 100644 --- a/js/src/jit-test/tests/wasm/function-references/non-nullable.js +++ b/js/src/jit-test/tests/wasm/function-references/non-nullable.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() // non-null values are subtype of null values wasmValidateText(`(module diff --git a/js/src/jit-test/tests/wasm/function-references/reftype-parse.js b/js/src/jit-test/tests/wasm/function-references/reftype-parse.js index 643f753ec8..f4cca7cb74 100644 --- a/js/src/jit-test/tests/wasm/function-references/reftype-parse.js +++ b/js/src/jit-test/tests/wasm/function-references/reftype-parse.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmFunctionReferencesEnabled() +// |jit-test| skip-if: !wasmGcEnabled() // RefType/ValueType as a simple string const t01 = new WebAssembly.Table({element: 'funcref', initial: 3}); @@ -16,36 +16,6 @@ assertErrorMessage( assertErrorMessage( () => new WebAssembly.Table({element: true, initial: 1}), TypeError, /bad value type/); - -// RefType/ValueType can be specified as an {ref: 'func', ...} object -const t11 = new WebAssembly.Table({element: {ref: 'func', nullable: true}, initial: 3}); -const t12 = new WebAssembly.Table({element: {ref: 'extern', nullable: true}, initial: 3}); -const t13 = new WebAssembly.Table({element: {ref: 'extern', nullable: false}, initial: 3}, {}); - -assertErrorMessage( - () => new WebAssembly.Table({element: {ref: 'func', nullable: false}, initial: 1}, null), - TypeError, /cannot pass null to non-nullable WebAssembly reference/); -assertErrorMessage( - () => new WebAssembly.Table({element: {ref: 'extern', nullable: false}, initial: 1}, null), - TypeError, /cannot pass null to non-nullable WebAssembly reference/); - -assertErrorMessage( - () => new WebAssembly.Table({element: {ref: 'bar', nullable: true}, initial: 1}), - TypeError, /bad value type/); - -const g11 = new WebAssembly.Global({value: {ref: 'func', nullable: true}, mutable: true}); -const g12 = new WebAssembly.Global({value: {ref: 'extern', nullable: true}, mutable: true}); -const g13 = new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true}, {}); -const g14 = new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true}); -const g15 = new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true}, void 0); - -assertErrorMessage( - () => new WebAssembly.Global({value: {ref: 'func', nullable: false}, mutable: true}), - TypeError, /cannot pass null to non-nullable WebAssembly reference/); -assertErrorMessage( - () => new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true}, null), - TypeError, /cannot pass null to non-nullable WebAssembly reference/); - assertErrorMessage( () => new WebAssembly.Global({value: {ref: 'bar', nullable: true}, mutable: true}), TypeError, /bad value type/); diff --git a/js/src/jit-test/tests/wasm/gc/arrays.js b/js/src/jit-test/tests/wasm/gc/arrays.js index b3f03151bb..cb61bb1b07 100644 --- a/js/src/jit-test/tests/wasm/gc/arrays.js +++ b/js/src/jit-test/tests/wasm/gc/arrays.js @@ -604,6 +604,51 @@ assertErrorMessage(() => wasmEvalText(`(module },WebAssembly.RuntimeError, /index out of bounds/); } +// run: zero-length copies are allowed +{ + let { newData } = wasmEvalText(`(module + (type $a (array i8)) + (data $d "1337") + (func (export "newData") (result eqref) + (; offset=0 into data ;) i32.const 0 + (; size=0 into data ;) i32.const 0 + array.new_data $a $d + ) + )`).exports; + let arr = newData(); + assertEq(wasmGcArrayLength(arr), 0); +} + +// run: a zero-length copy from the end is allowed +{ + let { newData } = wasmEvalText(`(module + (type $a (array i8)) + (data $d "1337") + (func (export "newData") (result eqref) + (; offset=4 into data ;) i32.const 4 + (; size=0 into data ;) i32.const 0 + array.new_data $a $d + ) + )`).exports; + let arr = newData(); + assertEq(wasmGcArrayLength(arr), 0); +} + +// run: even empty data segments are allowed +{ + let { newData } = wasmEvalText(`(module + (type $a (array i8)) + (data $d "") + (func (export "newData") (result eqref) + (; offset=0 into data ;) i32.const 0 + (; size=0 into data ;) i32.const 0 + array.new_data $a $d + ) + )`).exports; + let arr = newData(); + assertEq(wasmGcArrayLength(arr), 0); +} + // run: resulting array is as expected { let { newData } = wasmEvalText(`(module @@ -802,6 +847,59 @@ assertErrorMessage(() => wasmEvalText(`(module },WebAssembly.RuntimeError, /index out of bounds/); } +// run: zero-length copies are allowed +{ + let { newElem, f1, f2, f3, f4 } = wasmEvalText(`(module + (type $a (array funcref)) + (elem $e func $f1 $f2 $f3 $f4) + (func $f1 (export "f1")) + (func $f2 (export "f2")) + (func $f3 (export "f3")) + (func $f4 (export "f4")) + (func (export "newElem") (result eqref) + (; offset=0 into elem ;) i32.const 0 + (; size=0 into elem ;) i32.const 0 + array.new_elem $a $e + ) + )`).exports; + let arr = newElem(); + assertEq(wasmGcArrayLength(arr), 0); +} + +// run: a zero-length copy from the end is allowed +{ + let { newElem, f1, f2, f3, f4 } = wasmEvalText(`(module + (type $a (array funcref)) + (elem $e func $f1 $f2 $f3 $f4) + (func $f1 (export "f1")) + (func $f2 (export "f2")) + (func $f3 (export "f3")) + (func $f4 (export "f4")) + (func (export "newElem") (result eqref) + (; offset=4 into elem ;) i32.const 4 + (; size=0 into elem ;) i32.const 0 + array.new_elem $a $e + ) + )`).exports; + let arr = newElem(); + assertEq(wasmGcArrayLength(arr), 0); +} + +// run: even empty elem segments are allowed +{ + let { newElem, f1, f2, f3, f4 } = wasmEvalText(`(module + (type $a (array funcref)) + (elem $e func) + (func (export "newElem") (result eqref) + (; offset=0 into elem ;) i32.const 0 + (; size=0 into elem ;) i32.const 0 + array.new_elem $a $e + ) + )`).exports; + let arr = newElem(); + assertEq(wasmGcArrayLength(arr), 0); +} + // run: resulting array is as expected { let { newElem, f1, f2, f3, f4 } = wasmEvalText(`(module @@ -1130,6 +1228,29 @@ assertErrorMessage(() => wasmEvalText(`(module },WebAssembly.RuntimeError, /index out of bounds/); } +// run: zeroes everywhere +{ + let { initData } = wasmEvalText(`(module + (type $a (array (mut i8))) + (data $d "") + (func (export "initData") (result eqref) + (local $arr (ref $a)) + (local.set $arr (array.new_default $a (i32.const 0))) + + (; array to init ;) local.get $arr + (; offset=0 into array ;) i32.const 0 + (; offset=0 into data ;) i32.const 0 + (; size=0 elements ;) i32.const 0 + array.init_data $a $d + + local.get $arr + ) + (func data.drop 0) ;; force write of data count section, see https://github.com/bytecodealliance/wasm-tools/pull/1194 + )`).exports; + let arr = initData(); + assertEq(wasmGcArrayLength(arr), 0); +} + // run: resulting array is as expected { let { initData } = wasmEvalText(`(module @@ -1488,6 +1609,28 @@ assertErrorMessage(() => wasmEvalText(`(module },WebAssembly.RuntimeError, /index out of bounds/); } +// run: zeroes everywhere +{ + let { initElem, f1, f2, f3, f4 } = wasmEvalText(`(module + (type $a (array (mut funcref))) + (elem $e func) + (func (export "initElem") (result eqref) + (local $arr (ref $a)) + (local.set $arr (array.new_default $a (i32.const 0))) + + (; array to init ;) local.get $arr + (; offset=0 into array ;) i32.const 0 + (; offset=0 into elem ;) i32.const 0 + (; size=0 into elem ;) i32.const 0 + array.init_elem $a $e + + local.get $arr + ) + )`).exports; + let arr = initElem(); + assertEq(wasmGcArrayLength(arr), 0); +} + // run: resulting array is as expected { let { initElem, f1, f2, f3, f4 } = wasmEvalText(`(module diff --git a/js/src/jit-test/tests/wasm/gc/binary.js b/js/src/jit-test/tests/wasm/gc/binary.js index 1ef4a586a8..e16af2bfbf 100644 --- a/js/src/jit-test/tests/wasm/gc/binary.js +++ b/js/src/jit-test/tests/wasm/gc/binary.js @@ -2,14 +2,16 @@ load(libdir + "wasm-binary.js"); -const v2vSig = {args:[], ret:VoidCode}; -const v2vSigSection = sigSection([v2vSig]); - function checkInvalid(body, errorMessage) { assertErrorMessage(() => new WebAssembly.Module( - moduleWithSections([v2vSigSection, declSection([0]), bodySection([body])])), - WebAssembly.CompileError, - errorMessage); + moduleWithSections([ + typeSection([ + { kind: FuncCode, args: [], ret: [] }, + ]), + declSection([0]), + bodySection([body]), + ]) + ), WebAssembly.CompileError, errorMessage); } const invalidRefBlockType = funcBody({locals:[], body:[ @@ -23,7 +25,7 @@ checkInvalid(invalidRefBlockType, /heap type/); const invalidTooBigRefType = funcBody({locals:[], body:[ BlockCode, OptRefCode, - varU32(1000000), + ...varU32(1000000), EndCode, ]}); checkInvalid(invalidTooBigRefType, /heap type/); diff --git a/js/src/jit-test/tests/wasm/gc/bug-1843295.js b/js/src/jit-test/tests/wasm/gc/bug-1843295.js index 19a32263f6..765a9000a1 100644 --- a/js/src/jit-test/tests/wasm/gc/bug-1843295.js +++ b/js/src/jit-test/tests/wasm/gc/bug-1843295.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmGcEnabled(); --wasm-test-serialization +// |jit-test| skip-if: !wasmGcEnabled(); --setpref=wasm_test_serialization=true wasmEvalText(`(module (type (sub (array (mut i32)))) diff --git a/js/src/jit-test/tests/wasm/gc/bug-1845436.js b/js/src/jit-test/tests/wasm/gc/bug-1845436.js index a79c22d9a1..6ea8070f4d 100644 --- a/js/src/jit-test/tests/wasm/gc/bug-1845436.js +++ b/js/src/jit-test/tests/wasm/gc/bug-1845436.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmGcEnabled(); --wasm-test-serialization +// |jit-test| skip-if: !wasmGcEnabled(); --setpref=wasm_test_serialization=true // Test that serialization doesn't create a forward reference to the third // struct when serializing the reference to the first struct, which is diff --git a/js/src/jit-test/tests/wasm/gc/bug-1854007.js b/js/src/jit-test/tests/wasm/gc/bug-1854007.js index c9d6b25369..d3e5afa9cd 100644 --- a/js/src/jit-test/tests/wasm/gc/bug-1854007.js +++ b/js/src/jit-test/tests/wasm/gc/bug-1854007.js @@ -1,4 +1,4 @@ -// |jit-test| test-also=--wasm-test-serialization; skip-if: !wasmGcEnabled() +// |jit-test| test-also=--setpref=wasm_test_serialization=true; skip-if: !wasmGcEnabled() let {run} = wasmEvalText(`(module (rec (type $$t1 (func (result (ref null $$t1))))) diff --git a/js/src/jit-test/tests/wasm/gc/bug-1879096.js b/js/src/jit-test/tests/wasm/gc/bug-1879096.js new file mode 100644 index 0000000000..e71d2bac27 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/bug-1879096.js @@ -0,0 +1,65 @@ +// |jit-test| test-also=--setpref=wasm_test_serialization; skip-if: !wasmGcEnabled() + +// Conditional branch instructions need to rewrite their stack types according +// to the destination label types. This loses information but is mandated by +// the spec. + +// br_if +wasmFailValidateText(`(module + (func (result anyref) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + i32.const 0 ;; stack: [arrayref structref i32] + br_if 0 ;; stack: [arrayref anyref] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); + +// br_on_null +wasmFailValidateText(`(module + (func (param externref) (result anyref) + ref.null array ;; stack: [arrayref] + local.get 0 ;; stack: [arrayref externref] + br_on_null 0 ;; stack: [anyref (ref extern)] + drop ;; stack: [anyref] + array.len ;; should fail + unreachable + ) +)`, /type mismatch: expression has type anyref but expected arrayref/); + +// br_on_non_null +wasmFailValidateText(`(module + (func (param externref) (result anyref (ref extern)) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + local.get 0 ;; stack: [arrayref structref externref] + br_on_non_null 0 ;; stack: [arrayref anyref] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); + +// br_on_cast +wasmFailValidateText(`(module + (type $s (struct)) + (func (result anyref (ref $s)) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + br_on_cast 0 structref (ref $s) ;; stack: [anyref structref] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); + +// br_on_cast_fail +wasmFailValidateText(`(module + (type $s (struct)) + (func (result anyref anyref) + ref.null array ;; stack: [arrayref] + ref.null struct ;; stack: [arrayref structref] + br_on_cast_fail 0 structref (ref $s) ;; stack: [anyref (ref $s)] + ref.eq ;; should fail (anyref is not eq) + unreachable + ) +)`, /type mismatch: expression has type anyref but expected eqref/); diff --git a/js/src/jit-test/tests/wasm/gc/call-indirect-subtyping.js b/js/src/jit-test/tests/wasm/gc/call-indirect-subtyping.js index 4301621a8c..d83f2ed624 100644 --- a/js/src/jit-test/tests/wasm/gc/call-indirect-subtyping.js +++ b/js/src/jit-test/tests/wasm/gc/call-indirect-subtyping.js @@ -1,4 +1,4 @@ -// |jit-test| test-also=--wasm-tail-calls; skip-if: !wasmGcEnabled() +// |jit-test| test-also=--setpref=wasm_tail_calls=true; skip-if: !wasmGcEnabled() // Test that call_indirect will respect subtyping by defining a bunch of types // and checking every combination of (expected, actual) type. diff --git a/js/src/jit-test/tests/wasm/gc/directives.txt b/js/src/jit-test/tests/wasm/gc/directives.txt index e6d978cc44..293724e57a 100644 --- a/js/src/jit-test/tests/wasm/gc/directives.txt +++ b/js/src/jit-test/tests/wasm/gc/directives.txt @@ -1 +1 @@ -|jit-test| --wasm-gc; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js +|jit-test| test-also=--setpref=wasm_gc=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js diff --git a/js/src/jit-test/tests/wasm/gc/disabled.js b/js/src/jit-test/tests/wasm/gc/disabled.js index 791c6ff25e..206d32b1c4 100644 --- a/js/src/jit-test/tests/wasm/gc/disabled.js +++ b/js/src/jit-test/tests/wasm/gc/disabled.js @@ -2,7 +2,7 @@ const { CompileError, validate } = WebAssembly; -const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|(Structure|reference|gc) types not enabled|invalid heap type|invalid inline block type|bad type|\(ref T\) types not enabled|Invalid type|invalid function type/; +const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|gc not enabled|invalid heap type|invalid inline block type|bad type|Invalid type|invalid function type/; let simpleTests = [ "(module (func (drop (ref.null eq))))", diff --git a/js/src/jit-test/tests/wasm/gc/ion-and-baseline.js b/js/src/jit-test/tests/wasm/gc/ion-and-baseline.js index 5a4951c585..2c67bbce8b 100644 --- a/js/src/jit-test/tests/wasm/gc/ion-and-baseline.js +++ b/js/src/jit-test/tests/wasm/gc/ion-and-baseline.js @@ -10,7 +10,7 @@ // actually testing something here. // // Some logging with printf confirms that refmod is baseline-compiled and -// nonrefmod is ion-compiled at present, with --wasm-gc enabled. +// nonrefmod is ion-compiled at present, with --setpref=wasm_gc=true enabled. var refmod = new WebAssembly.Module(wasmTextToBinary( `(module diff --git a/js/src/jit-test/tests/wasm/gc/limits.js b/js/src/jit-test/tests/wasm/gc/limits.js deleted file mode 100644 index e6f21b5d6b..0000000000 --- a/js/src/jit-test/tests/wasm/gc/limits.js +++ /dev/null @@ -1,69 +0,0 @@ -// |jit-test| skip-if: !wasmGcEnabled() || getBuildConfiguration("tsan") - -// This test has a timeout on TSAN configurations due to the large -// allocations. - -// Limit of 1 million recursion groups -wasmValidateText(`(module - ${`(rec (type (func)))`.repeat(1_000_000)} - )`); -wasmFailValidateText(`(module - ${`(rec (type (func)))`.repeat(1_000_001)} - )`, /too many/); - -// Limit of 1 million types (across all recursion groups) -wasmValidateText(`(module - (rec ${`(type (func))`.repeat(1_000_000)}) - )`); -wasmValidateText(`(module - (rec ${`(type (func))`.repeat(500_000)}) - (rec ${`(type (func))`.repeat(500_000)}) - )`); -wasmFailValidateText(`(module - (rec ${`(type (func))`.repeat(1_000_001)}) - )`, /too many/); -wasmFailValidateText(`(module - (rec ${`(type (func))`.repeat(500_000)}) - (rec ${`(type (func))`.repeat(500_001)}) - )`, /too many/); - -// Limit of subtyping hierarchy 63 deep -function testSubtypingModule(depth) { - let types = '(type (sub (func)))'; - for (let i = 1; i <= depth; i++) { - types += `(type (sub ${i - 1} (func)))`; - } - return `(module - ${types} - )`; -} -wasmValidateText(testSubtypingModule(63)); -wasmFailValidateText(testSubtypingModule(64), /too deep/); - -// Limit of 10_000 struct fields -wasmFailValidateText(`(module - (type (struct ${'(field i64)'.repeat(10_001)})) -)`, /too many/); - -{ - let {makeLargeStructDefault, makeLargeStruct} = wasmEvalText(`(module - (type $s (struct ${'(field i64)'.repeat(10_000)})) - (func (export "makeLargeStructDefault") (result anyref) - struct.new_default $s - ) - (func (export "makeLargeStruct") (result anyref) - ${'i64.const 0 '.repeat(10_000)} - struct.new $s - ) - )`).exports; - let largeStructDefault = makeLargeStructDefault(); - let largeStruct = makeLargeStruct(); -} - -// array.new_fixed has limit of 10_000 operands -wasmFailValidateText(`(module - (type $a (array i32)) - (func - array.new_fixed $a 10001 - ) -)`, /too many/); diff --git a/js/src/jit-test/tests/wasm/gc/limits/array-new-fixed.js b/js/src/jit-test/tests/wasm/gc/limits/array-new-fixed.js new file mode 100644 index 0000000000..4b0600c724 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/array-new-fixed.js @@ -0,0 +1,9 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; + +// array.new_fixed has limit of 10_000 operands +wasmFailValidateText(`(module + (type $a (array i32)) + (func + array.new_fixed $a 10001 + ) +)`, /too many/); diff --git a/js/src/jit-test/tests/wasm/gc/limits/load-mod.js b/js/src/jit-test/tests/wasm/gc/limits/load-mod.js new file mode 100644 index 0000000000..cd972ceb65 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/load-mod.js @@ -0,0 +1,5 @@ +// Files for some of these tests are pre-generated and located in js/src/jit-test/lib/gen. +// There you will also find the script to update these files. +function loadMod(name) { + return decompressLZ4(os.file.readFile(libdir + "gen/" + name, "binary").buffer) +} diff --git a/js/src/jit-test/tests/wasm/gc/limits/rec-groups-1.js b/js/src/jit-test/tests/wasm/gc/limits/rec-groups-1.js new file mode 100644 index 0000000000..489bf89cd4 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/rec-groups-1.js @@ -0,0 +1,6 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; + +loadRelativeToScript("load-mod.js"); + +// Limit of 1 million recursion groups +wasmValidateBinary(loadMod("wasm-gc-limits-r1M-t1.wasm")); diff --git a/js/src/jit-test/tests/wasm/gc/limits/rec-groups-2.js b/js/src/jit-test/tests/wasm/gc/limits/rec-groups-2.js new file mode 100644 index 0000000000..40c020c4b5 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/rec-groups-2.js @@ -0,0 +1,6 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; + +loadRelativeToScript("load-mod.js"); + +// Limit of 1 million recursion groups +wasmFailValidateBinary(loadMod("wasm-gc-limits-r1M1-t1.wasm"), /too many/); diff --git a/js/src/jit-test/tests/wasm/gc/limits/struct-fields.js b/js/src/jit-test/tests/wasm/gc/limits/struct-fields.js new file mode 100644 index 0000000000..ae60f38d57 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/struct-fields.js @@ -0,0 +1,11 @@ +// |jit-test| --setpref=wasm_gc; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js; + +loadRelativeToScript("load-mod.js"); + +// Limit of 10_000 struct fields +wasmFailValidateBinary(loadMod("wasm-gc-limits-s10K1.wasm"), /too many/); +{ + let {makeLargeStructDefault, makeLargeStruct} = wasmEvalBinary(loadMod("wasm-gc-limits-s10K.wasm")).exports; + let largeStructDefault = makeLargeStructDefault(); + let largeStruct = makeLargeStruct(); +} diff --git a/js/src/jit-test/tests/wasm/gc/limits/subtyping-depth.js b/js/src/jit-test/tests/wasm/gc/limits/subtyping-depth.js new file mode 100644 index 0000000000..2d70215ee9 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/subtyping-depth.js @@ -0,0 +1,13 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; include: wasm-binary.js; + +// Limit of subtyping hierarchy 63 deep +function moduleSubtypingDepth(depth) { + let types = []; + types.push({final: false, kind: FuncCode, args: [], ret: []}); + for (let i = 1; i <= depth; i++) { + types.push({final: false, sub: i - 1, kind: FuncCode, args: [], ret: []}); + } + return moduleWithSections([typeSection(types)]); +} +wasmValidateBinary(moduleSubtypingDepth(63)); +wasmFailValidateBinary(moduleSubtypingDepth(64), /too deep/); diff --git a/js/src/jit-test/tests/wasm/gc/limits/types-1.js b/js/src/jit-test/tests/wasm/gc/limits/types-1.js new file mode 100644 index 0000000000..c097907e79 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/types-1.js @@ -0,0 +1,6 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; + +loadRelativeToScript("load-mod.js"); + +// Limit of 1 million types (across all recursion groups) +wasmValidateBinary(loadMod("wasm-gc-limits-r1-t1M.wasm")); diff --git a/js/src/jit-test/tests/wasm/gc/limits/types-2.js b/js/src/jit-test/tests/wasm/gc/limits/types-2.js new file mode 100644 index 0000000000..5e81bdf6ab --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/types-2.js @@ -0,0 +1,6 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; + +loadRelativeToScript("load-mod.js"); + +// Limit of 1 million types (across all recursion groups) +wasmValidateBinary(loadMod("wasm-gc-limits-r2-t500K.wasm")); diff --git a/js/src/jit-test/tests/wasm/gc/limits/types-3.js b/js/src/jit-test/tests/wasm/gc/limits/types-3.js new file mode 100644 index 0000000000..e9effa4bfa --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/types-3.js @@ -0,0 +1,6 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; + +loadRelativeToScript("load-mod.js"); + +// Limit of 1 million types (across all recursion groups) +wasmFailValidateBinary(loadMod("wasm-gc-limits-r1-t1M1.wasm"), /too many/); diff --git a/js/src/jit-test/tests/wasm/gc/limits/types-4.js b/js/src/jit-test/tests/wasm/gc/limits/types-4.js new file mode 100644 index 0000000000..dd413ed4e9 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/limits/types-4.js @@ -0,0 +1,6 @@ +// |jit-test| --setpref=wasm_gc; include:wasm.js; + +loadRelativeToScript("load-mod.js"); + +// Limit of 1 million types (across all recursion groups) +wasmFailValidateBinary(loadMod("wasm-gc-limits-r2-t500K1.wasm"), /too many/); diff --git a/js/src/jit-test/tests/wasm/gc/ref.js b/js/src/jit-test/tests/wasm/gc/ref.js index a55b0c8f02..2bf76daf52 100644 --- a/js/src/jit-test/tests/wasm/gc/ref.js +++ b/js/src/jit-test/tests/wasm/gc/ref.js @@ -173,7 +173,7 @@ assertErrorMessage(() => wasmEvalText(` `), WebAssembly.CompileError, /expression has type \(ref null.*\) but expected \(ref null.*\)/); -if (!wasmFunctionReferencesEnabled()) { +if (!wasmGcEnabled()) { // Ref type can't reference a function type assertErrorMessage(() => wasmEvalText(` diff --git a/js/src/jit-test/tests/wasm/gc/regress-1754701.js b/js/src/jit-test/tests/wasm/gc/regress-1754701.js index 656aa5d625..1a2307fa87 100644 --- a/js/src/jit-test/tests/wasm/gc/regress-1754701.js +++ b/js/src/jit-test/tests/wasm/gc/regress-1754701.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmGcEnabled() || !('oomTest' in this) +// |jit-test| skip-if: !wasmGcEnabled() let { testArray, testStructInline, testStructOutline } = wasmEvalText(` (module diff --git a/js/src/jit-test/tests/wasm/gc/regress-1884767.js b/js/src/jit-test/tests/wasm/gc/regress-1884767.js new file mode 100644 index 0000000000..54a168d657 --- /dev/null +++ b/js/src/jit-test/tests/wasm/gc/regress-1884767.js @@ -0,0 +1,13 @@ +// |jit-test| skip-if: !wasmGcEnabled() + +const { test } = wasmEvalText(`(module + (type $a (array i32)) + (func (export "test") (result anyref) + try (result anyref) + (array.new_default $a (i32.const 999999999)) + catch_all + unreachable + end + ) +)`).exports; +assertErrorMessage(() => test(), WebAssembly.RuntimeError, /too many array elements/); diff --git a/js/src/jit-test/tests/wasm/gc/structs.js b/js/src/jit-test/tests/wasm/gc/structs.js index 0ff0cbd4b4..15dab873e9 100644 --- a/js/src/jit-test/tests/wasm/gc/structs.js +++ b/js/src/jit-test/tests/wasm/gc/structs.js @@ -665,46 +665,6 @@ assertErrorMessage(() => new WebAssembly.Module(bad), let exports = wasmEvalText(txt).exports; } -////////////////////////////////////////////////////////////////////////////// -// -// Checks for requests to create structs with more than MaxStructFields, where -// MaxStructFields == 1000. - -function structNewOfManyFields(numFields) { - let defString = "(type $s (struct "; - for (i = 0; i < numFields; i++) { - defString += "(field i32) "; - } - defString += "))"; - - let insnString = "(struct.new $s "; - for (i = 0; i < numFields; i++) { - insnString += "(i32.const 1337) "; - } - insnString += ")"; - - return "(module " + - defString + - " (func (export \"create\") (result eqref) " + - insnString + - "))"; -} - -{ - // 10_000 fields is allowable - let exports = wasmEvalText(structNewOfManyFields(10000)).exports; - let s = exports.create(); - assertEq(s, s); -} -{ - // but 10_001 is not - assertErrorMessage(() => wasmEvalText(structNewOfManyFields(10001)), - WebAssembly.CompileError, - /too many fields in struct/); -} - -// FIXME: also check struct.new_default, once it is available in both compilers. - // Exercise stack maps and GC { // Zeal will cause us to allocate structs via instance call, requiring live registers diff --git a/js/src/jit-test/tests/wasm/globals.js b/js/src/jit-test/tests/wasm/globals.js index 5a6d83e348..bbba095bb9 100644 --- a/js/src/jit-test/tests/wasm/globals.js +++ b/js/src/jit-test/tests/wasm/globals.js @@ -1,5 +1,3 @@ -// |jit-test| test-also=--wasm-extended-const; test-also=--no-wasm-extended-const - const { Instance, Module, LinkError } = WebAssembly; // Locally-defined globals @@ -44,68 +42,65 @@ testInner('i32', 13, 37, x => x|0); testInner('f32', 13.37, 0.1989, Math.fround); testInner('f64', 13.37, 0.1989, x => +x); -// Extended const stuff -if (wasmExtendedConstEnabled()) { - // Basic global shenanigans - { - const module = wasmEvalText(`(module - ;; -2 * (5 - (-10 + 20)) = 10 - (global i32 (i32.mul (i32.const -2) (i32.sub (i32.const 5) (i32.add (i32.const -10) (i32.const 20))))) - ;; ((1 + 2) - (3 * 4)) = -9 - (global i64 (i64.sub (i64.add (i64.const 1) (i64.const 2)) (i64.mul (i64.const 3) (i64.const 4)))) - - (func (export "get0") (result i32) global.get 0) - (func (export "get1") (result i64) global.get 1) - )`).exports; - - assertEq(module.get0(), 10); - assertEq(module.get1(), -9n); - } +// Basic global shenanigans +{ + const module = wasmEvalText(`(module + ;; -2 * (5 - (-10 + 20)) = 10 + (global i32 (i32.mul (i32.const -2) (i32.sub (i32.const 5) (i32.add (i32.const -10) (i32.const 20))))) + ;; ((1 + 2) - (3 * 4)) = -9 + (global i64 (i64.sub (i64.add (i64.const 1) (i64.const 2)) (i64.mul (i64.const 3) (i64.const 4)))) + + (func (export "get0") (result i32) global.get 0) + (func (export "get1") (result i64) global.get 1) + )`).exports; - // Example use of dynamic linking - { - // Make a memory for two dynamically-linked modules to share. Each module gets five pages. - const mem = new WebAssembly.Memory({ initial: 15, maximum: 15 }); - - const mod1 = new WebAssembly.Module(wasmTextToBinary(`(module - (memory (import "env" "memory") 15 15) - (global $memBase (import "env" "__memory_base") i32) - (data (offset (global.get $memBase)) "Hello from module 1.") - (data (offset (i32.add (global.get $memBase) (i32.const 65536))) "Goodbye from module 1.") - )`)); - const instance1 = new WebAssembly.Instance(mod1, { - env: { - memory: mem, - __memory_base: 65536 * 5, // this module's memory starts at page 5 - }, - }); - - const mod2 = new WebAssembly.Module(wasmTextToBinary(`(module - (memory (import "env" "memory") 15 15) - (global $memBase (import "env" "__memory_base") i32) - (data (offset (global.get $memBase)) "Hello from module 2.") - (data (offset (i32.add (global.get $memBase) (i32.const 65536))) "Goodbye from module 2.") - )`)); - const instance2 = new WebAssembly.Instance(mod2, { - env: { - memory: mem, - __memory_base: 65536 * 10, // this module's memory starts at page 10 - }, - }); - - // All four strings should now be present in the memory. - - function assertStringInMem(mem, str, addr) { - const bytes = new Uint8Array(mem.buffer).slice(addr, addr + str.length); - let memStr = String.fromCharCode(...bytes); - assertEq(memStr, str); - } + assertEq(module.get0(), 10); + assertEq(module.get1(), -9n); +} - assertStringInMem(mem, "Hello from module 1.", 65536 * 5); - assertStringInMem(mem, "Goodbye from module 1.", 65536 * 6); - assertStringInMem(mem, "Hello from module 2.", 65536 * 10); - assertStringInMem(mem, "Goodbye from module 2.", 65536 * 11); +// Example use of dynamic linking +{ + // Make a memory for two dynamically-linked modules to share. Each module gets five pages. + const mem = new WebAssembly.Memory({ initial: 15, maximum: 15 }); + + const mod1 = new WebAssembly.Module(wasmTextToBinary(`(module + (memory (import "env" "memory") 15 15) + (global $memBase (import "env" "__memory_base") i32) + (data (offset (global.get $memBase)) "Hello from module 1.") + (data (offset (i32.add (global.get $memBase) (i32.const 65536))) "Goodbye from module 1.") + )`)); + const instance1 = new WebAssembly.Instance(mod1, { + env: { + memory: mem, + __memory_base: 65536 * 5, // this module's memory starts at page 5 + }, + }); + + const mod2 = new WebAssembly.Module(wasmTextToBinary(`(module + (memory (import "env" "memory") 15 15) + (global $memBase (import "env" "__memory_base") i32) + (data (offset (global.get $memBase)) "Hello from module 2.") + (data (offset (i32.add (global.get $memBase) (i32.const 65536))) "Goodbye from module 2.") + )`)); + const instance2 = new WebAssembly.Instance(mod2, { + env: { + memory: mem, + __memory_base: 65536 * 10, // this module's memory starts at page 10 + }, + }); + + // All four strings should now be present in the memory. + + function assertStringInMem(mem, str, addr) { + const bytes = new Uint8Array(mem.buffer).slice(addr, addr + str.length); + let memStr = String.fromCharCode(...bytes); + assertEq(memStr, str); } + + assertStringInMem(mem, "Hello from module 1.", 65536 * 5); + assertStringInMem(mem, "Goodbye from module 1.", 65536 * 6); + assertStringInMem(mem, "Hello from module 2.", 65536 * 10); + assertStringInMem(mem, "Goodbye from module 2.", 65536 * 11); } // Semantic errors. diff --git a/js/src/jit-test/tests/wasm/import-export.js b/js/src/jit-test/tests/wasm/import-export.js index 4845269f24..ecd02ca143 100644 --- a/js/src/jit-test/tests/wasm/import-export.js +++ b/js/src/jit-test/tests/wasm/import-export.js @@ -401,9 +401,10 @@ wasmFailValidateText('(module (export "a" (memory 0)))', /exported memory index wasmFailValidateText('(module (export "a" (table 0)))', /exported table index out of bounds/); // Default memory/table rules - -wasmFailValidateText('(module (import "a" "b" (memory 1 1)) (memory 1 1))', /already have default memory/); -wasmFailValidateText('(module (import "a" "b" (memory 1 1)) (import "x" "y" (memory 2 2)))', /already have default memory/); +if (!wasmMultiMemoryEnabled()) { + wasmFailValidateText('(module (import "a" "b" (memory 1 1)) (memory 1 1))', /already have default memory/); + wasmFailValidateText('(module (import "a" "b" (memory 1 1)) (import "x" "y" (memory 2 2)))', /already have default memory/); +} // Data segments on imports diff --git a/js/src/jit-test/tests/wasm/memory-control/directives.txt b/js/src/jit-test/tests/wasm/memory-control/directives.txt index 1092e20d8a..a3daf19d97 100644 --- a/js/src/jit-test/tests/wasm/memory-control/directives.txt +++ b/js/src/jit-test/tests/wasm/memory-control/directives.txt @@ -1 +1 @@ -|jit-test| include:wasm.js; test-also=--wasm-compiler=optimizing --wasm-memory-control; test-also=--wasm-compiler=baseline --wasm-memory-control; test-also=--wasm-compiler=optimizing --no-wasm-memory64 --wasm-memory-control; test-also=--wasm-compiler=baseline --no-wasm-memory64 --wasm-memory-control +|jit-test| include:wasm.js; test-also=--wasm-compiler=optimizing --setpref=wasm_memory_control=true; test-also=--wasm-compiler=baseline --setpref=wasm_memory_control=true; test-also=--wasm-compiler=optimizing --setpref=wasm_memory64=false --setpref=wasm_memory_control=true; test-also=--wasm-compiler=baseline --setpref=wasm_memory64=false --setpref=wasm_memory_control=true diff --git a/js/src/jit-test/tests/wasm/memory-control/memory-discard.js b/js/src/jit-test/tests/wasm/memory-control/memory-discard.js index 87f2ae625a..8d2c63ad8a 100644 --- a/js/src/jit-test/tests/wasm/memory-control/memory-discard.js +++ b/js/src/jit-test/tests/wasm/memory-control/memory-discard.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmMemoryControlEnabled(); test-also=--wasm-memory64; test-also=--no-wasm-memory64 +// |jit-test| skip-if: !wasmMemoryControlEnabled(); test-also=--setpref=wasm_memory64=true; test-also=--setpref=wasm_memory64=false // This tests memory.discard and WebAssembly.Memory.discard() by placing data // (the alphabet) halfway across a page boundary, then discarding the first diff --git a/js/src/jit-test/tests/wasm/memory64/directives.txt b/js/src/jit-test/tests/wasm/memory64/directives.txt index 98d92a7afc..5fc5acabf0 100644 --- a/js/src/jit-test/tests/wasm/memory64/directives.txt +++ b/js/src/jit-test/tests/wasm/memory64/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; include:wasm.js; skip-if: !wasmMemory64Enabled() +|jit-test| test-also=--setpref=wasm_memory64=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; include:wasm.js; skip-if: !wasmMemory64Enabled() diff --git a/js/src/jit-test/tests/wasm/multi-memory/directives.txt b/js/src/jit-test/tests/wasm/multi-memory/directives.txt index 44374e8ceb..2ed5e3dd2a 100644 --- a/js/src/jit-test/tests/wasm/multi-memory/directives.txt +++ b/js/src/jit-test/tests/wasm/multi-memory/directives.txt @@ -1,2 +1,2 @@ -|jit-test| --wasm-multi-memory; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js; skip-if: !wasmMultiMemoryEnabled() +|jit-test| --setpref=wasm_multi_memory=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js; skip-if: !wasmMultiMemoryEnabled() diff --git a/js/src/jit-test/tests/wasm/multi-value/directives.txt b/js/src/jit-test/tests/wasm/multi-value/directives.txt index f636e648ec..b5a203297f 100644 --- a/js/src/jit-test/tests/wasm/multi-value/directives.txt +++ b/js/src/jit-test/tests/wasm/multi-value/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); include:wasm.js +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); include:wasm.js diff --git a/js/src/jit-test/tests/wasm/oom/breakpoints.js b/js/src/jit-test/tests/wasm/oom/breakpoints.js index a90f97739a..eabb660e0f 100644 --- a/js/src/jit-test/tests/wasm/oom/breakpoints.js +++ b/js/src/jit-test/tests/wasm/oom/breakpoints.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - var dbgGlobal = newGlobal({newCompartment: true}); var dbg = new dbgGlobal.Debugger(); dbg.addDebuggee(this); diff --git a/js/src/jit-test/tests/wasm/oom/exports.js b/js/src/jit-test/tests/wasm/oom/exports.js index 391850fda7..f75ada6199 100644 --- a/js/src/jit-test/tests/wasm/oom/exports.js +++ b/js/src/jit-test/tests/wasm/oom/exports.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { let text = `(module (type (func (param i32) (result i32))) diff --git a/js/src/jit-test/tests/wasm/oom/jsapi-prototype.js b/js/src/jit-test/tests/wasm/oom/jsapi-prototype.js index 4888a70db0..f5f319a8c5 100644 --- a/js/src/jit-test/tests/wasm/oom/jsapi-prototype.js +++ b/js/src/jit-test/tests/wasm/oom/jsapi-prototype.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - oomTest(() => { let memory = new WebAssembly.Memory({initial: 0}); assertEq(Object.getPrototypeOf(memory), WebAssembly.Memory.prototype, "prototype"); diff --git a/js/src/jit-test/tests/wasm/ref-types/directives.txt b/js/src/jit-test/tests/wasm/ref-types/directives.txt index ed90b6bd5f..f9c573abef 100644 --- a/js/src/jit-test/tests/wasm/ref-types/directives.txt +++ b/js/src/jit-test/tests/wasm/ref-types/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); test-also=--wasm-test-serialization; include:wasm.js +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); test-also=--setpref=wasm_test_serialization=true; include:wasm.js diff --git a/js/src/jit-test/tests/wasm/regress/bug1708124.js b/js/src/jit-test/tests/wasm/regress/bug1708124.js index dc035b02e5..3cccd59dc0 100644 --- a/js/src/jit-test/tests/wasm/regress/bug1708124.js +++ b/js/src/jit-test/tests/wasm/regress/bug1708124.js @@ -1,4 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) // Ensure that trap reporting mechanism doesn't crash under OOM conditions. oomTest( diff --git a/js/src/jit-test/tests/wasm/regress/bug1839065.js b/js/src/jit-test/tests/wasm/regress/bug1839065.js index ecc4c1b90c..e3d84589b6 100644 --- a/js/src/jit-test/tests/wasm/regress/bug1839065.js +++ b/js/src/jit-test/tests/wasm/regress/bug1839065.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-gc; --wasm-function-references; skip-if: !wasmGcEnabled() || !wasmFunctionReferencesEnabled() +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() || !wasmGcEnabled() function wasmEvalText(str, imports) { let binary = wasmTextToBinary(str); m = new WebAssembly.Module(binary); diff --git a/js/src/jit-test/tests/wasm/regress/bug1839142.js b/js/src/jit-test/tests/wasm/regress/bug1839142.js index 339c1d7cb9..49ca0117e9 100644 --- a/js/src/jit-test/tests/wasm/regress/bug1839142.js +++ b/js/src/jit-test/tests/wasm/regress/bug1839142.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-gc; --wasm-function-references; skip-if: !wasmSimdEnabled() || !wasmGcEnabled() || !wasmFunctionReferencesEnabled() +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmSimdEnabled() || !wasmGcEnabled() || !wasmGcEnabled() var wasm_code = new Uint8Array([0,97,115,109,1,0,0,0,1,152,128,128,128,0,4,80,0,95,1,126,0,80,0,94,124,1,80,0,96,3,127,127,127,1,127,96,0,0,3,130,128,128,128,0,1,2,4,133,128,128,128,0,1,112,1,1,1,5,132,128,128,128,0,1,1,16,32,13,131,128,128,128,0,1,0,3,6,204,131,128,128,0,62,100,107,0,66,197,129,131,134,140,152,176,224,64,251,0,0,11,127,0,65,196,129,131,134,124,11,100,107,0,66,192,129,131,134,204,132,137,146,36,251,0,0,11,124,1,68,0,0,0,0,0,0,0,0,11,124,1,68,0,0,0,0,0,0,0,0,11,124,1,68,0,0,0,0,0,0,0,0,11,124,1,68,0,0,0,0,0,0,0,0,11,100,107,0,66,192,129,131,134,140,216,53,251,0,0,11,100,107,1,66,210,164,201,146,165,202,148,169,210,0,66,210,164,201,146,165,202,212,156,218,0,66,192,129,131,134,140,152,176,224,64,66,192,129,131,134,140,152,176,224,64,126,125,66,192,129,131,128,130,152,176,224,64,125,66,192,129,131,190,130,152,176,224,36,125,66,164,200,0,125,125,66,0,125,66,0,125,66,0,125,251,0,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,127,0,65,0,11,7,136,128,128,128,0,1,4,109,97,105,110,0,0,9,139,128,128,128,0,1,6,0,65,0,11,112,1,210,0,11,10,141,133,128,128,0,1,138,5,0,65,238,235,177,226,126,253,15,253,83,32,0,65,235,146,246,155,122,65,244,231,246,248,124,253,15,253,164,1,65,230,152,157,154,7,253,15,253,164,1,118,65,167,184,218,133,127,253,15,253,164,1,118,118,66,149,131,127,66,164,128,218,132,206,227,209,231,254,0,65,230,133,189,200,126,65,252,208,237,164,5,254,32,0,132,245,241,222,13,27,254,71,2,211,226,246,158,7,66,243,213,226,237,209,166,141,199,0,68,76,189,205,180,194,110,195,89,36,3,131,253,18,253,127,253,127,253,127,253,127,253,164,1,65,138,173,198,47,65,138,248,237,203,120,65,205,162,146,252,5,65,190,148,192,156,5,254,53,0,200,229,139,195,9,65,167,139,216,173,5,65,215,146,221,45,254,53,0,169,255,135,252,1,254,53,0,193,209,131,217,7,40,2,134,242,184,197,3,65,228,191,145,146,6,65,142,162,226,169,4,254,53,0,168,178,151,189,15,113,109,71,109,107,254,46,0,191,232,145,230,9,67,66,84,34,11,67,88,147,220,200,91,68,233,240,20,66,52,37,190,38,182,187,182,187,182,187,182,187,182,187,57,3,168,169,148,198,10,65,226,162,208,167,7,65,221,226,226,242,120,107,65,140,215,139,233,5,65,141,151,153,19,107,107,65,188,134,175,165,5,65,183,219,200,136,121,107,65,250,197,157,214,123,65,139,168,173,167,126,107,107,107,42,1,249,156,171,169,13,187,182,187,182,187,182,187,182,187,182,65,191,253,243,170,122,253,15,65,203,195,202,169,122,253,15,65,179,204,244,234,123,253,15,253,119,65,166,184,138,186,122,253,15,65,129,140,243,163,6,253,15,253,119,65,229,139,254,233,121,253,15,65,183,191,195,183,122,253,15,253,119,253,119,65,151,211,231,151,122,253,15,253,119,253,119,253,119,65,192,156,192,215,3,65,178,193,209,198,7,107,65,240,157,246,199,6,65,221,225,148,169,1,107,65,145,183,142,141,127,65,188,218,139,244,7,107,107,65,236,243,250,169,127,65,146,241,174,181,120,107,65,139,147,232,229,124,65,255,203,253,217,3,107,107,65,250,197,224,140,2,65,202,242,215,181,3,107,65,135,244,246,28,65,140,170,229,200,123,107,107,107,65,154,217,196,153,1,65,137,128,243,231,123,107,107,107,107,65,227,146,143,180,126,40,1,245,130,139,196,13,40,2,244,172,225,238,10,40,0,216,160,178,215,11,40,1,197,193,230,178,3,40,2,195,241,223,254,2,65,158,240,247,204,124,40,2,140,190,218,180,14,40,2,215,128,167,146,8,40,0,141,143,157,196,10,40,0,147,146,185,143,13,40,1,195,168,134,179,5,107,107,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,253,15,253,119,253,31,0,91,254,46,0,203,243,148,239,8,11]); var wasm_module = new WebAssembly.Module(wasm_code); var wasm_instance = new WebAssembly.Instance(wasm_module); diff --git a/js/src/jit-test/tests/wasm/regress/bug1856733.js b/js/src/jit-test/tests/wasm/regress/bug1856733.js index 0f3e59dcfe..57e1380780 100644 --- a/js/src/jit-test/tests/wasm/regress/bug1856733.js +++ b/js/src/jit-test/tests/wasm/regress/bug1856733.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-gc; skip-if: !wasmGcEnabled() +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() // Validates if imported globals are accounted for in init expressions. diff --git a/js/src/jit-test/tests/wasm/regress/bug1857829.js b/js/src/jit-test/tests/wasm/regress/bug1857829.js index 037855a4b1..df0598f678 100644 --- a/js/src/jit-test/tests/wasm/regress/bug1857829.js +++ b/js/src/jit-test/tests/wasm/regress/bug1857829.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-gc; skip-if: !wasmGcEnabled() +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() // Tests if i31ref global value is normalized. var ins = wasmEvalText(`(module diff --git a/js/src/jit-test/tests/wasm/regress/bug1858982.js b/js/src/jit-test/tests/wasm/regress/bug1858982.js index 574c4bfe24..c67ae317f1 100644 --- a/js/src/jit-test/tests/wasm/regress/bug1858982.js +++ b/js/src/jit-test/tests/wasm/regress/bug1858982.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-tail-calls; --wasm-gc; skip-if: !wasmGcEnabled() || !wasmTailCallsEnabled() +// |jit-test| --setpref=wasm_tail_calls=true; --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() || !wasmTailCallsEnabled() // Tests if instance registers were restored properly when call_ref is used // with tail calls. diff --git a/js/src/jit-test/tests/wasm/regress/bug1878673.js b/js/src/jit-test/tests/wasm/regress/bug1878673.js new file mode 100644 index 0000000000..edf2e67187 --- /dev/null +++ b/js/src/jit-test/tests/wasm/regress/bug1878673.js @@ -0,0 +1,13 @@ +// Check proper handling of OOM in SIMD loads. + +oomTest(function () { + let x = wasmTextToBinary(`(module + (memory 1 1) + (func + i32.const 16 + v128.load8x8_s + i16x8.abs + drop) + )`); + new WebAssembly.Module(x); +}); diff --git a/js/src/jit-test/tests/wasm/regress/bug1880770.js b/js/src/jit-test/tests/wasm/regress/bug1880770.js new file mode 100644 index 0000000000..0e748137d2 --- /dev/null +++ b/js/src/jit-test/tests/wasm/regress/bug1880770.js @@ -0,0 +1,20 @@ +// Check proper handling of OOM during segments creation. + +var x = {}; +Object.defineProperty(x, "", { + enumerable: true, + get: function () { + new WebAssembly.Instance( + new WebAssembly.Module( + wasmTextToBinary( + '(func $f (result f32) f32.const 0)(table (export "g") 1 funcref) (elem (i32.const 0) $f)' + ) + ) + ).exports.g + .get(0) + .type(WebAssembly, "", WebAssembly.Module, {}); + }, +}); +oomTest(function () { + Object.values(x); +}); diff --git a/js/src/jit-test/tests/wasm/regress/oom-eval.js b/js/src/jit-test/tests/wasm/regress/oom-eval.js index 1ce7c26df1..2f70bf8803 100644 --- a/js/src/jit-test/tests/wasm/regress/oom-eval.js +++ b/js/src/jit-test/tests/wasm/regress/oom-eval.js @@ -1,4 +1,4 @@ -// |jit-test| slow; allow-oom; skip-if: !wasmIsSupported() || !('oomTest' in this) +// |jit-test| slow; allow-oom; skip-if: !wasmIsSupported() function foo() { var g = newGlobal({sameZoneAs: this}); diff --git a/js/src/jit-test/tests/wasm/regress/oom-init.js b/js/src/jit-test/tests/wasm/regress/oom-init.js index f08b088107..4c6d0206b6 100644 --- a/js/src/jit-test/tests/wasm/regress/oom-init.js +++ b/js/src/jit-test/tests/wasm/regress/oom-init.js @@ -1,4 +1,4 @@ -// |jit-test| slow; allow-oom; skip-if: !wasmIsSupported() || !('oomTest' in this) +// |jit-test| slow; allow-oom; skip-if: !wasmIsSupported() || !hasFunction.oomTest Object.getOwnPropertyNames(this); s = newGlobal(); diff --git a/js/src/jit-test/tests/wasm/regress/oom-masm-baseline.js b/js/src/jit-test/tests/wasm/regress/oom-masm-baseline.js index 3f74666d0a..f2026a6788 100644 --- a/js/src/jit-test/tests/wasm/regress/oom-masm-baseline.js +++ b/js/src/jit-test/tests/wasm/regress/oom-masm-baseline.js @@ -1,4 +1,4 @@ -// |jit-test| slow; skip-if: !('oomTest' in this) +// |jit-test| slow // Test baseline compiler only. if (typeof wasmCompileMode === 'undefined' || wasmCompileMode() != 'baseline') diff --git a/js/src/jit-test/tests/wasm/regress/oom-wasm-streaming.js b/js/src/jit-test/tests/wasm/regress/oom-wasm-streaming.js index 5d7e719912..8a3c8e65d4 100644 --- a/js/src/jit-test/tests/wasm/regress/oom-wasm-streaming.js +++ b/js/src/jit-test/tests/wasm/regress/oom-wasm-streaming.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomAfterAllocations' in this) - ignoreUnhandledRejections(); try { diff --git a/js/src/jit-test/tests/wasm/regress/oom-wasmtexttobinary-block.js b/js/src/jit-test/tests/wasm/regress/oom-wasmtexttobinary-block.js index 6f3b666873..aaa7ff121f 100644 --- a/js/src/jit-test/tests/wasm/regress/oom-wasmtexttobinary-block.js +++ b/js/src/jit-test/tests/wasm/regress/oom-wasmtexttobinary-block.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - try { oomTest((function () { wasmTextToBinary("(module(func(loop $label1 $label0)))"); diff --git a/js/src/jit-test/tests/wasm/regress/oom-wrong-argument-number-for-import-call.js b/js/src/jit-test/tests/wasm/regress/oom-wrong-argument-number-for-import-call.js index 2d41b466ea..d4eb2da5a3 100644 --- a/js/src/jit-test/tests/wasm/regress/oom-wrong-argument-number-for-import-call.js +++ b/js/src/jit-test/tests/wasm/regress/oom-wrong-argument-number-for-import-call.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - function f() { // Too many results returned. return [52, 10, 0, 0]; diff --git a/js/src/jit-test/tests/wasm/simd/directives.txt b/js/src/jit-test/tests/wasm/simd/directives.txt index 651282ecb5..aced6c31a7 100644 --- a/js/src/jit-test/tests/wasm/simd/directives.txt +++ b/js/src/jit-test/tests/wasm/simd/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=baseline; test-also=--wasm-compiler=optimizing; test-also=--wasm-test-serialization; test-also=--wasm-compiler=optimizing --no-avx; skip-variant-if: --wasm-compiler=optimizing --no-avx, !getBuildConfiguration("x86") && !getBuildConfiguration("x64") || getBuildConfiguration("simulator"); include:wasm.js +|jit-test| test-also=--wasm-compiler=baseline; test-also=--wasm-compiler=optimizing; test-also=--setpref=wasm_test_serialization=true; test-also=--wasm-compiler=optimizing --no-avx; skip-variant-if: --wasm-compiler=optimizing --no-avx, !getBuildConfiguration("x86") && !getBuildConfiguration("x64") || getBuildConfiguration("simulator"); include:wasm.js diff --git a/js/src/jit-test/tests/wasm/simd/experimental.js b/js/src/jit-test/tests/wasm/simd/experimental.js index 3076cce80b..ded45928e6 100644 --- a/js/src/jit-test/tests/wasm/simd/experimental.js +++ b/js/src/jit-test/tests/wasm/simd/experimental.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-relaxed-simd; skip-if: !wasmRelaxedSimdEnabled() +// |jit-test| --setpref=wasm_relaxed_simd=true; skip-if: !wasmRelaxedSimdEnabled() // Experimental opcodes. We have no text parsing support for these yet. The // tests will be cleaned up and moved into ad-hack.js if the opcodes are @@ -77,7 +77,7 @@ for ( let [opcode, xs, ys, as, operator] of [[F32x4RelaxedMaddCode, fxs, fys, fa body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), ...V128Load(48), - SimdPrefix, varU32(opcode)])]})])])); + SimdPrefix, ...varU32(opcode)])]})])])); var mem = new (k == 4 ? Float32Array : Float64Array)(ins.exports.mem.buffer); set(mem, k, xs); @@ -97,7 +97,7 @@ for ( let [opcode, xs, ys, as, operator] of [[F32x4RelaxedMaddCode, fxs, fys, fa funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(0), ...V128Load(0), - SimdPrefix, varU32(opcode)])]})])]))); + SimdPrefix, ...varU32(opcode)])]})])]))); } // Relaxed swizzle, https://github.com/WebAssembly/relaxed-simd/issues/22 @@ -112,7 +112,7 @@ var ins = wasmValidateAndEval(moduleWithSections([ funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), - SimdPrefix, varU32(I8x16RelaxedSwizzleCode)])]})])])); + SimdPrefix, ...varU32(I8x16RelaxedSwizzleCode)])]})])])); var mem = new Uint8Array(ins.exports.mem.buffer); var test = [1, 4, 3, 7, 123, 0, 8, 222]; set(mem, 16, test); @@ -134,7 +134,7 @@ assertEq(false, WebAssembly.validate(moduleWithSections([ bodySection([ funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), - SimdPrefix, varU32(I8x16RelaxedSwizzleCode)])]})])]))); + SimdPrefix, ...varU32(I8x16RelaxedSwizzleCode)])]})])]))); // Relaxed MIN/MAX, https://github.com/WebAssembly/relaxed-simd/issues/33 @@ -164,11 +164,11 @@ for (let k of [4, 2]) { funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), - SimdPrefix, varU32(minOpcode)])]}), + SimdPrefix, ...varU32(minOpcode)])]}), funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), - SimdPrefix, varU32(maxOpcode)])]})])])); + SimdPrefix, ...varU32(maxOpcode)])]})])])); for (let i = 0; i < minMaxTests.length; i++) { var Ty = k == 4 ? Float32Array : Float64Array; var mem = new Ty(ins.exports.mem.buffer); @@ -198,7 +198,7 @@ for (let k of [4, 2]) { bodySection([ funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(0), - SimdPrefix, varU32(op)])]})])]))); + SimdPrefix, ...varU32(op)])]})])]))); } } @@ -216,16 +216,16 @@ var ins = wasmValidateAndEval(moduleWithSections([ bodySection([ funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), - SimdPrefix, varU32(I32x4RelaxedTruncSSatF32x4Code)])]}), + SimdPrefix, ...varU32(I32x4RelaxedTruncSSatF32x4Code)])]}), funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), - SimdPrefix, varU32(I32x4RelaxedTruncUSatF32x4Code)])]}), + SimdPrefix, ...varU32(I32x4RelaxedTruncUSatF32x4Code)])]}), funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), - SimdPrefix, varU32(I32x4RelaxedTruncSatF64x2SZeroCode)])]}), + SimdPrefix, ...varU32(I32x4RelaxedTruncSatF64x2SZeroCode)])]}), funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), - SimdPrefix, varU32(I32x4RelaxedTruncSatF64x2UZeroCode)])]})])])); + SimdPrefix, ...varU32(I32x4RelaxedTruncSatF64x2UZeroCode)])]})])])); var mem = ins.exports.mem.buffer; set(new Float32Array(mem), 4, [0, 2.3, -3.4, 100000]); @@ -260,7 +260,7 @@ for (let op of [I32x4RelaxedTruncSSatF32x4Code, I32x4RelaxedTruncUSatF32x4Code, exportSection([]), bodySection([ funcBody({locals:[], - body: [...V128StoreExpr(0, [SimdPrefix, varU32(op)])]})])]))); + body: [...V128StoreExpr(0, [SimdPrefix, ...varU32(op)])]})])]))); } // Relaxed blend / laneselect, https://github.com/WebAssembly/relaxed-simd/issues/17 @@ -281,7 +281,7 @@ for (let [k, opcode, AT] of [[1, I8x16RelaxedLaneSelectCode, Int8Array], body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), ...V128Load(48), - SimdPrefix, varU32(opcode)])]})])])); + SimdPrefix, ...varU32(opcode)])]})])])); var mem = ins.exports.mem.buffer; var mem8 = new Uint8Array(mem); @@ -310,7 +310,7 @@ for (let [k, opcode, AT] of [[1, I8x16RelaxedLaneSelectCode, Int8Array], funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(0), ...V128Load(0), - SimdPrefix, varU32(opcode)])]})])]))); + SimdPrefix, ...varU32(opcode)])]})])]))); } @@ -325,7 +325,7 @@ var ins = wasmValidateAndEval(moduleWithSections([ funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), - SimdPrefix, varU32(I16x8RelaxedQ15MulrSCode)])]})])])); + SimdPrefix, ...varU32(I16x8RelaxedQ15MulrSCode)])]})])])); var mem16 = new Int16Array(ins.exports.mem.buffer); for (let [as, bs] of cross([ @@ -355,7 +355,7 @@ var ins = wasmValidateAndEval(moduleWithSections([ funcBody({locals:[], body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), - SimdPrefix, varU32(I16x8DotI8x16I7x16SCode)])]})])])); + SimdPrefix, ...varU32(I16x8DotI8x16I7x16SCode)])]})])])); var mem8 = new Int8Array(ins.exports.mem.buffer); var mem16 = new Int16Array(ins.exports.mem.buffer); var test7bit = [1, 2, 3, 4, 5, 64, 65, 127, 127, 0, 0, @@ -385,7 +385,7 @@ var ins = wasmValidateAndEval(moduleWithSections([ body: [...V128StoreExpr(0, [...V128Load(16), ...V128Load(32), ...V128Load(48), - SimdPrefix, varU32(I32x4DotI8x16I7x16AddSCode)])]})])])); + SimdPrefix, ...varU32(I32x4DotI8x16I7x16AddSCode)])]})])])); var mem8 = new Int8Array(ins.exports.mem.buffer); var mem32 = new Int32Array(ins.exports.mem.buffer); var test7bit = [1, 2, 3, 4, 5, 64, 65, 127, 127, 0, 0, diff --git a/js/src/jit-test/tests/wasm/spec/exception-handling/directives.txt b/js/src/jit-test/tests/wasm/spec/exception-handling/directives.txt index 51f58354cb..77f4127908 100644 --- a/js/src/jit-test/tests/wasm/spec/exception-handling/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/exception-handling/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-exceptions; --wasm-exnref; skip-if: !wasmExceptionsEnabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_exnref=true; skip-if: !wasmExnRefEnabled() \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/extended-const/directives.txt b/js/src/jit-test/tests/wasm/spec/extended-const/directives.txt index 5b3d5f6d83..e93d8c8df0 100644 --- a/js/src/jit-test/tests/wasm/spec/extended-const/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/extended-const/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-extended-const; --no-wasm-gc; skip-if: !wasmExtendedConstEnabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_gc=false \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/function-references/directives.txt b/js/src/jit-test/tests/wasm/spec/function-references/directives.txt index bb76560525..a9cf6401e1 100644 --- a/js/src/jit-test/tests/wasm/spec/function-references/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/function-references/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-function-references; skip-if: !wasmFunctionReferencesEnabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/function-references/return_call_ref.wast.js b/js/src/jit-test/tests/wasm/spec/function-references/return_call_ref.wast.js index 3ea51a8cb0..df24798146 100644 --- a/js/src/jit-test/tests/wasm/spec/function-references/return_call_ref.wast.js +++ b/js/src/jit-test/tests/wasm/spec/function-references/return_call_ref.wast.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-tail-calls; skip-if: !wasmTailCallsEnabled() +// |jit-test| --setpref=wasm_tail_calls=true; skip-if: !wasmTailCallsEnabled() /* Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/js/src/jit-test/tests/wasm/spec/gc/directives.txt b/js/src/jit-test/tests/wasm/spec/gc/directives.txt index c071d8b980..a9cf6401e1 100644 --- a/js/src/jit-test/tests/wasm/spec/gc/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/gc/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-gc; skip-if: !wasmGcEnabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/memory64/directives.txt b/js/src/jit-test/tests/wasm/spec/memory64/directives.txt index bbc47fb788..740ef217b9 100644 --- a/js/src/jit-test/tests/wasm/spec/memory64/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/memory64/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; skip-if: !wasmMemory64Enabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_memory64=true; skip-if: !wasmMemory64Enabled() \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js b/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js index 341742ab86..0af2f021bb 100644 --- a/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js +++ b/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js @@ -27,17 +27,19 @@ let $2 = instantiate(`(module (memory i64 1 256))`); // ./test/core/memory64.wast:6 let $3 = instantiate(`(module (memory i64 0 65536))`); -// ./test/core/memory64.wast:8 -assert_invalid( - () => instantiate(`(module (memory i64 0) (memory i64 0))`), - `multiple memories`, -); - -// ./test/core/memory64.wast:9 -assert_invalid( - () => instantiate(`(module (memory (import "spectest" "memory") i64 0) (memory i64 0))`), - `multiple memories`, -); +if (!wasmMultiMemoryEnabled()) { + // ./test/core/memory64.wast:8 + assert_invalid( + () => instantiate(`(module (memory i64 0) (memory i64 0))`), + `multiple memories`, + ); + + // ./test/core/memory64.wast:9 + assert_invalid( + () => instantiate(`(module (memory (import "spectest" "memory") i64 0) (memory i64 0))`), + `multiple memories`, + ); +} // ./test/core/memory64.wast:11 let $4 = instantiate(`(module (memory i64 (data)) (func (export "memsize") (result i64) (memory.size)))`); diff --git a/js/src/jit-test/tests/wasm/spec/multi-memory/directives.txt b/js/src/jit-test/tests/wasm/spec/multi-memory/directives.txt index 9211583549..7c18d36751 100644 --- a/js/src/jit-test/tests/wasm/spec/multi-memory/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/multi-memory/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-multi-memory; skip-if: !wasmMultiMemoryEnabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_multi_memory=true; skip-if: !wasmMultiMemoryEnabled() \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js b/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js index a96781e8ed..e03b3f35db 100644 --- a/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js +++ b/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js @@ -19,6 +19,15 @@ if (!wasmIsSupported()) { quit(); } +function partialOobWriteMayWritePartialData() { + let arm_native = getBuildConfiguration("arm") && !getBuildConfiguration("arm-simulator"); + let arm64_native = getBuildConfiguration("arm64") && !getBuildConfiguration("arm64-simulator"); + return arm_native || arm64_native; +} + +let native_arm = getBuildConfiguration("arm") && !getBuildConfiguration("arm-simulator"); +let native_arm64 = getBuildConfiguration("arm64") && !getBuildConfiguration("arm64-simulator"); + function bytes(type, bytes) { var typedBuffer = new Uint8Array(bytes); return wasmGlobalFromArrayBuffer(type, typedBuffer.buffer); diff --git a/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js b/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js index ef68a1c0ec..35b8bd5a80 100644 --- a/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js +++ b/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js @@ -562,11 +562,15 @@ assert_trap(() => invoke($0, `i64.load32_u`, [-3]), `out of bounds memory access // ./test/core/multi-memory/memory_trap1.wast:234 assert_trap(() => invoke($0, `i64.load32_u`, [-4]), `out of bounds memory access`); -// ./test/core/multi-memory/memory_trap1.wast:237 -assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 7523094288207667809n)]); +// Bug 1842293 - do not observe the partial store caused by bug 1666747 on +// some native platforms. +if (!partialOobWriteMayWritePartialData()) { + // ./test/core/multi-memory/memory_trap1.wast:237 + assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 7523094288207667809n)]); -// ./test/core/multi-memory/memory_trap1.wast:238 -assert_return(() => invoke($0, `i64.load`, [0]), [value("i64", 7523094288207667809n)]); + // ./test/core/multi-memory/memory_trap1.wast:238 + assert_return(() => invoke($0, `i64.load`, [0]), [value("i64", 7523094288207667809n)]); +} // ./test/core/multi-memory/memory_trap1.wast:242 assert_return(() => invoke($0, `i64.store`, [65528, 0n]), []); @@ -574,14 +578,18 @@ assert_return(() => invoke($0, `i64.store`, [65528, 0n]), []); // ./test/core/multi-memory/memory_trap1.wast:243 assert_trap(() => invoke($0, `i32.store`, [65533, 305419896]), `out of bounds memory access`); -// ./test/core/multi-memory/memory_trap1.wast:244 -assert_return(() => invoke($0, `i32.load`, [65532]), [value("i32", 0)]); +if (!partialOobWriteMayWritePartialData()) { + // ./test/core/multi-memory/memory_trap1.wast:244 + assert_return(() => invoke($0, `i32.load`, [65532]), [value("i32", 0)]); +} // ./test/core/multi-memory/memory_trap1.wast:245 assert_trap(() => invoke($0, `i64.store`, [65529, 1311768467294899695n]), `out of bounds memory access`); -// ./test/core/multi-memory/memory_trap1.wast:246 -assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 0n)]); +if (!partialOobWriteMayWritePartialData()) { + // ./test/core/multi-memory/memory_trap1.wast:246 + assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 0n)]); +} // ./test/core/multi-memory/memory_trap1.wast:247 assert_trap( @@ -589,8 +597,10 @@ assert_trap( `out of bounds memory access`, ); -// ./test/core/multi-memory/memory_trap1.wast:248 -assert_return(() => invoke($0, `f32.load`, [65532]), [value("f32", 0)]); +if (!partialOobWriteMayWritePartialData()) { + // ./test/core/multi-memory/memory_trap1.wast:248 + assert_return(() => invoke($0, `f32.load`, [65532]), [value("f32", 0)]); +} // ./test/core/multi-memory/memory_trap1.wast:249 assert_trap( @@ -598,5 +608,7 @@ assert_trap( `out of bounds memory access`, ); -// ./test/core/multi-memory/memory_trap1.wast:250 -assert_return(() => invoke($0, `f64.load`, [65528]), [value("f64", 0)]); +if (!partialOobWriteMayWritePartialData()) { + // ./test/core/multi-memory/memory_trap1.wast:250 + assert_return(() => invoke($0, `f64.load`, [65528]), [value("f64", 0)]); +} diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt b/js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt index 625758af79..bbeff405b1 100644 --- a/js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-relaxed-simd; skip-if: !wasmRelaxedSimdEnabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_relaxed_simd=true; skip-if: !wasmRelaxedSimdEnabled() \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/spec/directives.txt b/js/src/jit-test/tests/wasm/spec/spec/directives.txt index 9fa4f75347..b26fb254a9 100644 --- a/js/src/jit-test/tests/wasm/spec/spec/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/spec/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; test-also=--no-avx; skip-variant-if: --no-avx, !getBuildConfiguration('x86') && !getBuildConfiguration('x64') || getBuildConfiguration('simulator') \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; test-also=--no-avx; skip-variant-if: --no-avx, !getBuildConfiguration('x86') && !getBuildConfiguration('x64') || getBuildConfiguration('simulator') \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/spec/spec/global.wast.js b/js/src/jit-test/tests/wasm/spec/spec/global.wast.js index e3351d3421..7f2502cc27 100644 --- a/js/src/jit-test/tests/wasm/spec/spec/global.wast.js +++ b/js/src/jit-test/tests/wasm/spec/spec/global.wast.js @@ -1,4 +1,4 @@ -// |jit-test| --no-wasm-gc +// |jit-test| --setpref=wasm_gc=false /* Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js b/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js index 831bb26d69..211f610b69 100644 --- a/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js +++ b/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js @@ -33,14 +33,16 @@ let $4 = instantiate(`(module (memory 1 256))`); // ./test/core/memory.wast:8 let $5 = instantiate(`(module (memory 0 65536))`); -// ./test/core/memory.wast:10 -assert_invalid(() => instantiate(`(module (memory 0) (memory 0))`), `multiple memories`); - -// ./test/core/memory.wast:11 -assert_invalid( - () => instantiate(`(module (memory (import "spectest" "memory") 0) (memory 0))`), - `multiple memories`, -); +if (!wasmMultiMemoryEnabled()) { + // ./test/core/memory.wast:10 + assert_invalid(() => instantiate(`(module (memory 0) (memory 0))`), `multiple memories`); + + // ./test/core/memory.wast:11 + assert_invalid( + () => instantiate(`(module (memory (import "spectest" "memory") 0) (memory 0))`), + `multiple memories`, + ); +} // ./test/core/memory.wast:13 let $6 = instantiate(`(module (memory (data)) (func (export "memsize") (result i32) (memory.size)))`); diff --git a/js/src/jit-test/tests/wasm/spec/tail-call/directives.txt b/js/src/jit-test/tests/wasm/spec/tail-call/directives.txt index 223b6b843a..fbd3639abc 100644 --- a/js/src/jit-test/tests/wasm/spec/tail-call/directives.txt +++ b/js/src/jit-test/tests/wasm/spec/tail-call/directives.txt @@ -1 +1 @@ -|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-tail-calls; skip-if: !wasmTailCallsEnabled() \ No newline at end of file +|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --setpref=wasm_tail_calls=true; skip-if: !wasmTailCallsEnabled() \ No newline at end of file diff --git a/js/src/jit-test/tests/wasm/tail-calls/bug1862473.js b/js/src/jit-test/tests/wasm/tail-calls/bug1862473.js index 57e5ea2118..fd44aa8f26 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/bug1862473.js +++ b/js/src/jit-test/tests/wasm/tail-calls/bug1862473.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-gc; skip-if: !wasmGcEnabled() +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() var ins = wasmEvalText(`(module (func $func1) diff --git a/js/src/jit-test/tests/wasm/tail-calls/bug1865044.js b/js/src/jit-test/tests/wasm/tail-calls/bug1865044.js index 042e641f32..bf984e7b87 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/bug1865044.js +++ b/js/src/jit-test/tests/wasm/tail-calls/bug1865044.js @@ -1,4 +1,4 @@ -// |jit-test| --more-compartments; skip-variant-if: --wasm-test-serialization, true; skip-variant-if: --wasm-compiler=ion, true; skip-if: !wasmGcEnabled() || !('Function' in WebAssembly) +// |jit-test| --more-compartments; skip-variant-if: --setpref=wasm_test_serialization=true, true; skip-variant-if: --wasm-compiler=ion, true; skip-if: !wasmGcEnabled() || !('Function' in WebAssembly) a = newGlobal(); a.b = this; diff --git a/js/src/jit-test/tests/wasm/tail-calls/bug1871605.js b/js/src/jit-test/tests/wasm/tail-calls/bug1871605.js index 84f37a3e42..3403cea102 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/bug1871605.js +++ b/js/src/jit-test/tests/wasm/tail-calls/bug1871605.js @@ -1,4 +1,4 @@ -// |jit-test| --more-compartments; skip-variant-if: --wasm-test-serialization, true; skip-variant-if: --wasm-compiler=ion, true; skip-if: !wasmGcEnabled() +// |jit-test| --more-compartments; skip-variant-if: --setpref=wasm_test_serialization=true, true; skip-variant-if: --wasm-compiler=ion, true; skip-if: !wasmGcEnabled() var dbg = newGlobal() dbg.parent = this diff --git a/js/src/jit-test/tests/wasm/tail-calls/bug1871606.js b/js/src/jit-test/tests/wasm/tail-calls/bug1871606.js index aa520d1f53..ec43665c62 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/bug1871606.js +++ b/js/src/jit-test/tests/wasm/tail-calls/bug1871606.js @@ -1,4 +1,4 @@ -// |jit-test| --more-compartments; skip-variant-if: --wasm-test-serialization, true; skip-variant-if: --wasm-compiler=ion, true +// |jit-test| --more-compartments; skip-variant-if: --setpref=wasm_test_serialization=true, true; skip-variant-if: --wasm-compiler=ion, true dbg = newGlobal(); dbg.b = this; dbg.eval("(" + function() { diff --git a/js/src/jit-test/tests/wasm/tail-calls/bug1871951.js b/js/src/jit-test/tests/wasm/tail-calls/bug1871951.js index 6b3e481d59..6dc8b69548 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/bug1871951.js +++ b/js/src/jit-test/tests/wasm/tail-calls/bug1871951.js @@ -1,4 +1,4 @@ -// |jit-test| skip-variant-if: --wasm-test-serialization, true; skip-if: !wasmGcEnabled() +// |jit-test| skip-variant-if: --setpref=wasm_test_serialization=true, true; skip-if: !wasmGcEnabled() gczeal(18) function a(str, imports) { diff --git a/js/src/jit-test/tests/wasm/tail-calls/directives.txt b/js/src/jit-test/tests/wasm/tail-calls/directives.txt index 66e8161b9d..eac1ba242f 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/directives.txt +++ b/js/src/jit-test/tests/wasm/tail-calls/directives.txt @@ -1 +1 @@ -|jit-test| --wasm-tail-calls; test-also=--wasm-compiler=baseline; test-also=--wasm-compiler=ion; test-also=--wasm-test-serialization; skip-if: !wasmTailCallsEnabled(); include:wasm.js +|jit-test| --setpref=wasm_tail_calls=true; test-also=--wasm-compiler=baseline; test-also=--wasm-compiler=ion; test-also=--setpref=wasm_test_serialization=true; skip-if: !wasmTailCallsEnabled(); include:wasm.js diff --git a/js/src/jit-test/tests/wasm/tail-calls/exceptions.js b/js/src/jit-test/tests/wasm/tail-calls/exceptions.js index fd05f37e53..c4c774a4f3 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/exceptions.js +++ b/js/src/jit-test/tests/wasm/tail-calls/exceptions.js @@ -1,5 +1,3 @@ -// |jit-test| --wasm-exceptions; skip-if: !wasmExceptionsEnabled() - // Simple test with return_call. var ins = wasmEvalText(`(module (tag $exn) diff --git a/js/src/jit-test/tests/wasm/tail-calls/gc.js b/js/src/jit-test/tests/wasm/tail-calls/gc.js index 10e5971e6d..7f4df4c69a 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/gc.js +++ b/js/src/jit-test/tests/wasm/tail-calls/gc.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-function-references; --wasm-gc; skip-if: !wasmGcEnabled() || getBuildConfiguration("simulator") +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() || getBuildConfiguration("simulator") // Tests GC references passed as arguments during return calls. // Similar to js/src/jit-test/tests/wasm/gc/trailers-gc-stress.js diff --git a/js/src/jit-test/tests/wasm/tail-calls/litmus3.js b/js/src/jit-test/tests/wasm/tail-calls/litmus3.js index bdd0918717..4fe367fb29 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/litmus3.js +++ b/js/src/jit-test/tests/wasm/tail-calls/litmus3.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled() +// |jit-test| skip-if: !wasmTailCallsEnabled() // Mutually recursive functions implement a multi-entry loop using tail calls, // with exception handling. diff --git a/js/src/jit-test/tests/wasm/tail-calls/litmus4.js b/js/src/jit-test/tests/wasm/tail-calls/litmus4.js index c16f712aac..6562f76686 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/litmus4.js +++ b/js/src/jit-test/tests/wasm/tail-calls/litmus4.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled() +// |jit-test| skip-if: !wasmTailCallsEnabled() // Mutually recursive functions implement a multi-entry loop using indirect tail // calls, with exception handling. diff --git a/js/src/jit-test/tests/wasm/tail-calls/litmus8.js b/js/src/jit-test/tests/wasm/tail-calls/litmus8.js index 4602664488..126367a0a0 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/litmus8.js +++ b/js/src/jit-test/tests/wasm/tail-calls/litmus8.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled() +// |jit-test| skip-if: !wasmTailCallsEnabled() // Tail-call litmus test with multiple results // diff --git a/js/src/jit-test/tests/wasm/tail-calls/litmus9.js b/js/src/jit-test/tests/wasm/tail-calls/litmus9.js index 3bbde27111..513e5c058e 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/litmus9.js +++ b/js/src/jit-test/tests/wasm/tail-calls/litmus9.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !wasmTailCallsEnabled() || !wasmExceptionsEnabled() +// |jit-test| skip-if: !wasmTailCallsEnabled() // Tail-call litmus test with multiple results // diff --git a/js/src/jit-test/tests/wasm/tail-calls/return_call_ref.js b/js/src/jit-test/tests/wasm/tail-calls/return_call_ref.js index c5f250a41c..947da02ef5 100644 --- a/js/src/jit-test/tests/wasm/tail-calls/return_call_ref.js +++ b/js/src/jit-test/tests/wasm/tail-calls/return_call_ref.js @@ -1,4 +1,4 @@ -// |jit-test| --wasm-gc; skip-if: !wasmGcEnabled() +// |jit-test| --setpref=wasm_gc=true; skip-if: !wasmGcEnabled() var ins = wasmEvalText(`(module (type $t (func (param i64 i64 funcref) (result i64))) (elem declare func $fac-acc $fac-acc-broken) diff --git a/js/src/jit-test/tests/wasm/testing/directives.txt b/js/src/jit-test/tests/wasm/testing/directives.txt new file mode 100644 index 0000000000..01f722ba1e --- /dev/null +++ b/js/src/jit-test/tests/wasm/testing/directives.txt @@ -0,0 +1 @@ +|jit-test| include:wasm.js diff --git a/js/src/jit-test/tests/wasm/testing/global-lossless-invoke.js b/js/src/jit-test/tests/wasm/testing/global-lossless-invoke.js new file mode 100644 index 0000000000..66db0499d9 --- /dev/null +++ b/js/src/jit-test/tests/wasm/testing/global-lossless-invoke.js @@ -0,0 +1,13 @@ +// |jit-test| skip-if: !('wasmLosslessInvoke' in this) + +let bytecode = wasmTextToBinary(`(module + (func (export "f") (result i32) + i32.const 1 + ) +)`); +let g = newGlobal({sameCompartmentAs: wasmLosslessInvoke}); +let m = new g.WebAssembly.Module(bytecode); +let i = new g.WebAssembly.Instance(m); + +assertEq(i.exports.f(), 1); +assertEq(wasmLosslessInvoke(i.exports.f).value, 1); diff --git a/js/src/jit-test/tests/xdr/bug1390856.js b/js/src/jit-test/tests/xdr/bug1390856.js index b1dbbffdfa..bb8940eae6 100644 --- a/js/src/jit-test/tests/xdr/bug1390856.js +++ b/js/src/jit-test/tests/xdr/bug1390856.js @@ -1,4 +1,4 @@ -// |jit-test| skip-if: !('oomTest' in this) || helperThreadCount() === 0 +// |jit-test| skip-if: helperThreadCount() === 0 // Test main thread encode/decode OOM oomTest(function() { diff --git a/js/src/jit-test/tests/xdr/bug1427860.js b/js/src/jit-test/tests/xdr/bug1427860.js index fd6d6f0411..befa6782ae 100644 --- a/js/src/jit-test/tests/xdr/bug1427860.js +++ b/js/src/jit-test/tests/xdr/bug1427860.js @@ -1,4 +1,4 @@ -// |jit-test| --code-coverage; skip-if: !('oomAtAllocation' in this) +// |jit-test| --code-coverage let x = cacheEntry("function inner() { return 3; }; inner()"); evaluate(x, { saveIncrementalBytecode: true }); diff --git a/js/src/jit-test/tests/xdr/incremental-oom.js b/js/src/jit-test/tests/xdr/incremental-oom.js index ef202d112d..a0e1cdb0a0 100644 --- a/js/src/jit-test/tests/xdr/incremental-oom.js +++ b/js/src/jit-test/tests/xdr/incremental-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // Delazify a function while encoding bytecode. oomTest(() => { let code = cacheEntry(` diff --git a/js/src/jit-test/tests/xdr/module-oom.js b/js/src/jit-test/tests/xdr/module-oom.js index 14aef8e0af..951b6212a6 100644 --- a/js/src/jit-test/tests/xdr/module-oom.js +++ b/js/src/jit-test/tests/xdr/module-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - // OOM tests for xdr module parsing. const sa = diff --git a/js/src/jit-test/tests/xdr/stencil-oom.js b/js/src/jit-test/tests/xdr/stencil-oom.js index f57e8f82f8..70b4398f21 100644 --- a/js/src/jit-test/tests/xdr/stencil-oom.js +++ b/js/src/jit-test/tests/xdr/stencil-oom.js @@ -1,5 +1,3 @@ -// |jit-test| skip-if: !('oomTest' in this) - const sa = ` function f(x, y) { return x + y } let a = 10, b = 20; -- cgit v1.2.3