From 8d9f7690f83afd54099c780aa6a9e423180864c8 Mon Sep 17 00:00:00 2001 From: test262-automation Date: Mon, 4 Feb 2019 19:41:14 +0000 Subject: [PATCH 1/2] [v8-test262-automation] Changes from https://github.com/v8/v8.git at sha f85a3554 on Mon Feb 04 2019 19:40:41 GMT+0000 (Coordinated Universal Time) --- .../v8/intl/date-format/check-hc-option.js | 6 +- .../v8/intl/intl.status | 5 + .../v8/intl/list-format/constructor-order.js | 6 +- .../v8/intl/regress-8030.js | 2 - .../intl/relative-time-format/constructor.js | 2 - .../default-locale-fr-CA.js | 1 - .../default-locale-pt-BR.js | 1 - .../format-to-parts-en.js | 14 +- .../format-to-parts-plural.js | 28 -- .../relative-time-format/format-to-parts.js | 82 ---- .../v8/intl/relative-time-format/format.js | 82 ---- .../relative-time-format/resolved-options.js | 164 -------- .../relative-time-format/supported-locale.js | 19 - .../v8/intl/segmenter/check-lb-option.js | 41 -- .../v8/intl/segmenter/constructor-order.js | 23 -- .../v8/intl/segmenter/constructor.js | 0 .../v8/intl/segmenter/segment-iterator.js | 15 - .../intl/segmenter/segment-line-following.js | 38 -- .../intl/segmenter/segment-line-iterable.js | 45 -- .../v8/intl/segmenter/segment-line-next.js | 40 -- .../intl/segmenter/segment-line-preceding.js | 44 -- .../v8/intl/segmenter/segment-line.js | 29 -- .../v8/mjsunit/es6/for-each-in-catch.js | 194 --------- .../v8/mjsunit/es6/proxies-ownkeys.js | 94 ----- .../v8/mjsunit/es6/typedarray-sort.js | 126 ------ .../object-get-own-property-descriptors.js | 234 ----------- .../v8/mjsunit/es8/object-values.js | 291 ------------- .../v8/mjsunit/harmony/array-flat-species.js | 31 -- .../v8/mjsunit/harmony/array-flat.js | 65 --- .../mjsunit/harmony/array-flatMap-species.js | 31 -- .../v8/mjsunit/harmony/array-flatMap.js | 162 -------- .../v8/mjsunit/harmony/weakrefs/basics.js | 214 ---------- ...=> cleanup-doesnt-iterate-all-holdings.js} | 0 .../weakrefs/cleanup-from-different-realm.js | 34 -- .../weakrefs/cleanup-is-a-microtask.js | 56 --- .../cleanup-proxy-from-different-realm.js | 34 -- ...ell.js => cleanupsome-after-unregister.js} | 0 ...cleanupsome-weakcell.js => cleanupsome.js} | 0 .../harmony/weakrefs/clear-called-twice.js | 39 -- .../weakrefs/clear-clears-factory-pointer.js | 49 --- .../harmony/weakrefs/clear-inside-cleanup4.js | 48 --- ...inalization-group-keeps-holdings-alive.js} | 0 ...ef.js => finalizationgroup-and-weakref.js} | 0 ...p-scheduled-for-cleanup-multiple-times.js} | 0 ...-weak-cells.js => iterating-in-cleanup.js} | 0 ... => multiple-dirty-finalization-groups.js} | 0 ...cleanup.js => unregister-after-cleanup.js} | 0 ...leanup.js => unregister-before-cleanup.js} | 0 ...anup1.js => unregister-inside-cleanup1.js} | 0 ...anup2.js => unregister-inside-cleanup2.js} | 0 ...anup3.js => unregister-inside-cleanup3.js} | 0 ...egister-when-cleanup-already-scheduled.js} | 0 .../harmony/weakrefs/weak-cell-basics.js | 36 -- .../v8/mjsunit/regress/regress-3218530.js | 39 -- .../v8/mjsunit/regress/regress-3255.js | 19 - .../v8/mjsunit/regress/regress-336820.js | 38 -- .../v8/mjsunit/regress/regress-5888.js | 76 ---- .../v8/mjsunit/regress/regress-5911.js | 32 -- .../v8/mjsunit/regress/regress-687.js | 75 ---- .../v8/mjsunit/regress/regress-813440.js | 17 - .../v8/mjsunit/regress/regress-863810.js | 19 - .../mjsunit/regress/regress-crbug-715455.js | 25 -- .../mjsunit/regress/regress-crbug-772056.js | 17 - .../mjsunit/regress/wasm/loop-stack-check.js | 19 - .../v8/mjsunit/regress/wasm/regress-5531.js | 22 - .../v8/mjsunit/regress/wasm/regress-5800.js | 56 --- .../v8/mjsunit/regress/wasm/regress-5860.js | 30 -- .../v8/mjsunit/regress/wasm/regress-5884.js | 20 - .../v8/mjsunit/regress/wasm/regress-6164.js | 19 - .../v8/mjsunit/regress/wasm/regress-644682.js | 26 -- .../v8/mjsunit/regress/wasm/regress-651961.js | 24 -- .../v8/mjsunit/regress/wasm/regress-654377.js | 23 -- .../v8/mjsunit/regress/wasm/regress-663994.js | 14 - .../v8/mjsunit/regress/wasm/regress-667745.js | 389 ------------------ .../v8/mjsunit/regress/wasm/regress-684858.js | 34 -- .../v8/mjsunit/regress/wasm/regress-688876.js | 42 -- .../v8/mjsunit/regress/wasm/regress-689450.js | 25 -- .../v8/mjsunit/regress/wasm/regress-6931.js | 30 -- .../v8/mjsunit/regress/wasm/regress-699485.js | 22 - .../v8/mjsunit/regress/wasm/regress-702460.js | 51 --- .../v8/mjsunit/regress/wasm/regress-7033.js | 20 - .../v8/mjsunit/regress/wasm/regress-7035.js | 31 -- .../v8/mjsunit/regress/wasm/regress-7049.js | 54 --- .../v8/mjsunit/regress/wasm/regress-708714.js | 23 -- .../v8/mjsunit/regress/wasm/regress-709684.js | 78 ---- .../v8/mjsunit/regress/wasm/regress-710844.js | 23 -- .../v8/mjsunit/regress/wasm/regress-711203.js | 30 -- .../mjsunit/regress/wasm/regress-715216b.js | 13 - .../v8/mjsunit/regress/wasm/regress-722445.js | 16 - .../v8/mjsunit/regress/wasm/regress-724846.js | 14 - .../v8/mjsunit/regress/wasm/regress-724851.js | 12 - .../v8/mjsunit/regress/wasm/regress-724972.js | 11 - .../v8/mjsunit/regress/wasm/regress-727222.js | 14 - .../v8/mjsunit/regress/wasm/regress-727560.js | 18 - .../v8/mjsunit/regress/wasm/regress-729991.js | 15 - .../v8/mjsunit/regress/wasm/regress-734246.js | 16 - .../v8/mjsunit/regress/wasm/regress-734345.js | 28 -- .../v8/mjsunit/regress/wasm/regress-7353.js | 29 -- .../v8/mjsunit/regress/wasm/regress-7364.js | 31 -- .../v8/mjsunit/regress/wasm/regress-736584.js | 17 - .../v8/mjsunit/regress/wasm/regress-7366.js | 33 -- .../v8/mjsunit/regress/wasm/regress-737069.js | 35 -- .../v8/mjsunit/regress/wasm/regress-739768.js | 33 -- .../v8/mjsunit/regress/wasm/regress-7422.js | 27 -- .../v8/mjsunit/regress/wasm/regress-7499.js | 19 - .../v8/mjsunit/regress/wasm/regress-7508.js | 21 - .../v8/mjsunit/regress/wasm/regress-752423.js | 33 -- .../v8/mjsunit/regress/wasm/regress-7565.js | 20 - .../v8/mjsunit/regress/wasm/regress-757217.js | 20 - .../v8/mjsunit/regress/wasm/regress-7579.js | 62 --- .../v8/mjsunit/regress/wasm/regress-7582.js | 48 --- .../v8/mjsunit/regress/wasm/regress-763439.js | 22 - .../v8/mjsunit/regress/wasm/regress-763697.js | 15 - .../v8/mjsunit/regress/wasm/regress-766003.js | 17 - .../v8/mjsunit/regress/wasm/regress-769637.js | 17 - .../v8/mjsunit/regress/wasm/regress-771243.js | 39 -- .../v8/mjsunit/regress/wasm/regress-772332.js | 33 -- .../v8/mjsunit/regress/wasm/regress-775366.js | 29 -- .../v8/mjsunit/regress/wasm/regress-7785.js | 44 -- .../v8/mjsunit/regress/wasm/regress-778917.js | 20 - .../v8/mjsunit/regress/wasm/regress-782280.js | 33 -- .../v8/mjsunit/regress/wasm/regress-784050.js | 25 -- .../v8/mjsunit/regress/wasm/regress-7914.js | 18 - .../v8/mjsunit/regress/wasm/regress-791810.js | 21 - .../v8/mjsunit/regress/wasm/regress-793551.js | 20 - .../v8/mjsunit/regress/wasm/regress-797846.js | 14 - .../v8/mjsunit/regress/wasm/regress-800756.js | 15 - .../v8/mjsunit/regress/wasm/regress-801785.js | 22 - .../v8/mjsunit/regress/wasm/regress-801850.js | 11 - .../v8/mjsunit/regress/wasm/regress-802244.js | 22 - .../v8/mjsunit/regress/wasm/regress-803427.js | 13 - .../v8/mjsunit/regress/wasm/regress-803788.js | 27 -- .../v8/mjsunit/regress/wasm/regress-8059.js | 42 -- .../v8/mjsunit/regress/wasm/regress-808012.js | 14 - .../v8/mjsunit/regress/wasm/regress-808848.js | 67 --- .../v8/mjsunit/regress/wasm/regress-808980.js | 28 -- .../v8/mjsunit/regress/wasm/regress-8094.js | 30 -- .../v8/mjsunit/regress/wasm/regress-8095.js | 25 -- .../v8/mjsunit/regress/wasm/regress-812005.js | 16 - .../v8/mjsunit/regress/wasm/regress-817380.js | 25 -- .../v8/mjsunit/regress/wasm/regress-819869.js | 12 - .../v8/mjsunit/regress/wasm/regress-820802.js | 21 - .../v8/mjsunit/regress/wasm/regress-824681.js | 20 - .../mjsunit/regress/wasm/regress-825087a.js | 9 - .../mjsunit/regress/wasm/regress-825087b.js | 10 - .../v8/mjsunit/regress/wasm/regress-827806.js | 22 - .../v8/mjsunit/regress/wasm/regress-831463.js | 22 - .../v8/mjsunit/regress/wasm/regress-834619.js | 49 --- .../v8/mjsunit/regress/wasm/regress-834624.js | 30 -- .../v8/mjsunit/regress/wasm/regress-834693.js | 20 - .../v8/mjsunit/regress/wasm/regress-836141.js | 20 - .../v8/mjsunit/regress/wasm/regress-837417.js | 18 - .../v8/mjsunit/regress/wasm/regress-840757.js | 21 - .../v8/mjsunit/regress/wasm/regress-842501.js | 35 -- .../v8/mjsunit/regress/wasm/regress-843563.js | 20 - .../v8/mjsunit/regress/wasm/regress-8505.js | 204 --------- .../v8/mjsunit/regress/wasm/regress-8533.js | 85 ---- .../v8/mjsunit/regress/wasm/regress-854011.js | 47 --- .../v8/mjsunit/regress/wasm/regress-854050.js | 28 -- .../v8/mjsunit/regress/wasm/regress-864509.js | 62 --- .../v8/mjsunit/regress/wasm/regress-875556.js | 19 - .../v8/mjsunit/regress/wasm/regress-894307.js | 16 - .../v8/mjsunit/regress/wasm/regress-894374.js | 20 - .../v8/mjsunit/regress/wasm/regress-910824.js | 37 -- .../v8/mjsunit/regress/wasm/regress-913804.js | 17 - .../v8/mjsunit/regress/wasm/regress-916869.js | 14 - .../v8/mjsunit/tools/compiler-trace-flags.js | 36 -- .../v8/wasm-js/wasm-js.status | 30 -- 168 files changed, 13 insertions(+), 6127 deletions(-) create mode 100644 implementation-contributed/v8/intl/segmenter/constructor.js delete mode 100644 implementation-contributed/v8/intl/segmenter/segment-line-following.js delete mode 100644 implementation-contributed/v8/intl/segmenter/segment-line-iterable.js delete mode 100644 implementation-contributed/v8/intl/segmenter/segment-line-next.js delete mode 100644 implementation-contributed/v8/intl/segmenter/segment-line-preceding.js delete mode 100644 implementation-contributed/v8/intl/segmenter/segment-line.js rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{cleanup-doesnt-iterate-all-cells.js => cleanup-doesnt-iterate-all-holdings.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{cleanupsome-cleared-weakcell.js => cleanupsome-after-unregister.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{cleanupsome-weakcell.js => cleanupsome.js} (100%) delete mode 100644 implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-called-twice.js delete mode 100644 implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js delete mode 100644 implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{weak-factory-keeps-weak-cells-alive.js => finalization-group-keeps-holdings-alive.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{weakcell-and-weakref.js => finalizationgroup-and-weakref.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{factory-scheduled-for-cleanup-multiple-times.js => finalizationgroup-scheduled-for-cleanup-multiple-times.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{iterating-weak-cells.js => iterating-in-cleanup.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{multiple-dirty-weak-factories.js => multiple-dirty-finalization-groups.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{clear-after-cleanup.js => unregister-after-cleanup.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{clear-before-cleanup.js => unregister-before-cleanup.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{clear-inside-cleanup1.js => unregister-inside-cleanup1.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{clear-inside-cleanup2.js => unregister-inside-cleanup2.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{clear-inside-cleanup3.js => unregister-inside-cleanup3.js} (100%) rename implementation-contributed/v8/mjsunit/harmony/weakrefs/{clear-when-cleanup-already-scheduled.js => unregister-when-cleanup-already-scheduled.js} (100%) diff --git a/implementation-contributed/v8/intl/date-format/check-hc-option.js b/implementation-contributed/v8/intl/date-format/check-hc-option.js index 276bfe6a23..7a1e917816 100644 --- a/implementation-contributed/v8/intl/date-format/check-hc-option.js +++ b/implementation-contributed/v8/intl/date-format/check-hc-option.js @@ -26,7 +26,8 @@ let locales = [ ]; invalid_hc.forEach(function(hc) { - let df = new Intl.DateTimeFormat(["en-u-hc-" + hc + "-fo-obar"]); + let df = new Intl.DateTimeFormat( + ["en-u-hc-" + hc + "-fo-obar"], {hour: "2-digit"}); assertEquals("en", df.resolvedOptions().locale); } ); @@ -34,7 +35,8 @@ invalid_hc.forEach(function(hc) { valid_hc.forEach(function(hc) { locales.forEach(function(base) { let l = base + "-u-hc-" + hc; - let df = new Intl.DateTimeFormat([l + "-fo-obar"]); + let df = new Intl.DateTimeFormat( + [l + "-fo-obar"], {hour: "2-digit"}); assertEquals(l, df.resolvedOptions().locale); }); } diff --git a/implementation-contributed/v8/intl/intl.status b/implementation-contributed/v8/intl/intl.status index 83e546db76..4f3387ab22 100644 --- a/implementation-contributed/v8/intl/intl.status +++ b/implementation-contributed/v8/intl/intl.status @@ -46,6 +46,9 @@ # Unable to change locale on Windows: 'default_locale': [SKIP], + + # Unable to change locale and TZ on Windows: + 'regress-7770': [SKIP], }], # system == windows' ['system == android', { @@ -56,5 +59,7 @@ 'relative-time-format/default-locale-fr-CA': [SKIP], 'relative-time-format/default-locale-pt-BR': [SKIP], 'default_locale': [SKIP], + # Unable to change locale and TZ on Android: + 'regress-7770': [SKIP], }], # 'system == android' ] diff --git a/implementation-contributed/v8/intl/list-format/constructor-order.js b/implementation-contributed/v8/intl/list-format/constructor-order.js index 1fc7d99429..97f58436b2 100644 --- a/implementation-contributed/v8/intl/list-format/constructor-order.js +++ b/implementation-contributed/v8/intl/list-format/constructor-order.js @@ -8,13 +8,13 @@ let getCount = 0; new Intl.ListFormat(['en-US'], { - get type() { + get localeMatcher() { assertEquals(0, getCount++); }, - get style() { + get type() { assertEquals(1, getCount++); }, - get localeMatcher() { + get style() { assertEquals(2, getCount++); }, }); diff --git a/implementation-contributed/v8/intl/regress-8030.js b/implementation-contributed/v8/intl/regress-8030.js index eac6b84f81..cf0e1aa2a9 100644 --- a/implementation-contributed/v8/intl/regress-8030.js +++ b/implementation-contributed/v8/intl/regress-8030.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-relative-time-format - var locales = ["tlh", "id", "en"]; var referenceRelativeTimeFormat = new Intl.RelativeTimeFormat(locales); var referenceFormatted = referenceRelativeTimeFormat.format(3, "day"); diff --git a/implementation-contributed/v8/intl/relative-time-format/constructor.js b/implementation-contributed/v8/intl/relative-time-format/constructor.js index ba03e1dd70..f1a4057426 100644 --- a/implementation-contributed/v8/intl/relative-time-format/constructor.js +++ b/implementation-contributed/v8/intl/relative-time-format/constructor.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-relative-time-format - // RelativeTimeFormat constructor can't be called as function. assertThrows(() => Intl.RelativeTimeFormat('sr'), TypeError); diff --git a/implementation-contributed/v8/intl/relative-time-format/default-locale-fr-CA.js b/implementation-contributed/v8/intl/relative-time-format/default-locale-fr-CA.js index 32f64ee02d..9f24329b50 100644 --- a/implementation-contributed/v8/intl/relative-time-format/default-locale-fr-CA.js +++ b/implementation-contributed/v8/intl/relative-time-format/default-locale-fr-CA.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-relative-time-format --harmony-locale // Environment Variables: LC_ALL=fr_CA assertEquals( 'fr-CA', diff --git a/implementation-contributed/v8/intl/relative-time-format/default-locale-pt-BR.js b/implementation-contributed/v8/intl/relative-time-format/default-locale-pt-BR.js index 89f7aa14f0..ea66b6a0e5 100644 --- a/implementation-contributed/v8/intl/relative-time-format/default-locale-pt-BR.js +++ b/implementation-contributed/v8/intl/relative-time-format/default-locale-pt-BR.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-relative-time-format --harmony-locale // Environment Variables: LC_ALL=pt_BR assertEquals( 'pt-BR', diff --git a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js index 689059f4cd..621726155e 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js +++ b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-relative-time-format - // The following test are not part of the comformance. Just some output in // English to verify the format does return something reasonable for English. // It may be changed when we update the CLDR data. @@ -96,14 +94,4 @@ assertEquals('second', parts[3].unit); assertEquals(3, Object.getOwnPropertyNames(parts[4]).length); assertEquals('decimal', parts[4].type); assertEquals('.', parts[4].value); -assertEquals('second', parts[4].unit); -// 5: "78" -assertEquals(3, Object.getOwnPropertyNames(parts[4]).length); -assertEquals('fraction', parts[5].type); -assertEquals('78', parts[5].value); -assertEquals('second', parts[5].unit); -// 6: " seconds" -assertEquals(2, Object.getOwnPropertyNames(parts[6]).length); -assertEquals('literal', parts[6].type); -assertEquals(' seconds', parts[6].value); -assertEquals(undefined, parts[6].unit); +assertEquals('second', pa \ No newline at end of file diff --git a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js index 7e5e1b79a6..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js +++ b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js @@ -1,28 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-relative-time-format - -// Check plural w/ formatToParts -// http://tc39.github.io/proposal-intl-relative-time/ - -let rtf = new Intl.RelativeTimeFormat(); - -// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit ) -function verifyElement(part, expectedUnit) { - assertEquals(true, part.type == 'literal' || part.type == 'integer'); - assertEquals('string', typeof part.value); - if (part.type == 'integer') { - assertEquals('string', typeof part.unit); - assertEquals(expectedUnit, part.unit); - } -}; - -['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'].forEach( - function(unit) { - rtf.formatToParts(100, unit + 's').forEach( - function(part) { - verifyElement(part, unit); - }); - }); diff --git a/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js b/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js index 071c4468c0..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js +++ b/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js @@ -1,82 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-relative-time-format - -// Make sure that RelativeTimeFormat exposes all required properties. Those not specified -// should have undefined value. -// http://tc39.github.io/proposal-intl-relative-time/ - -let rtf = new Intl.RelativeTimeFormat(); - -// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit ) -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'seconds'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'second'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minutes'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minute'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hours'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hour'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'days'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'day'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'weeks'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'week'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'months'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'month'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarters'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarter'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'years'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'year'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'seconds'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'second'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minutes'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minute'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hours'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hour'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'days'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'day'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'weeks'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'week'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'months'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'month'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarters'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarter'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'years'))); -assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'year'))); - -assertThrows(() => rtf.formatToParts(-1, 'decades'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'decade'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'centuries'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'century'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'milliseconds'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'millisecond'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'microseconds'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'microsecond'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'nanoseconds'), RangeError); -assertThrows(() => rtf.formatToParts(-1, 'nanosecond'), RangeError); - -assertThrows(() => rtf.formatToParts(NaN, 'seconds'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'second'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'minutes'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'minute'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'hours'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'hour'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'days'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'day'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'weeks'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'week'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'months'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'month'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'years'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'year'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'quarters'), RangeError); -assertThrows(() => rtf.formatToParts(NaN, 'quarter'), RangeError); - -assertEquals(true, Array.isArray(rtf.formatToParts(100, 'day'))); -rtf.formatToParts(100, 'day').forEach(function(part) { - assertEquals(true, part.type == 'literal' || part.type == 'integer'); - assertEquals('string', typeof part.value); - if (part.type == 'integer') { - assertEquals('string', typeof part.unit); - } -}); diff --git a/implementation-contributed/v8/intl/relative-time-format/format.js b/implementation-contributed/v8/intl/relative-time-format/format.js index 769358423d..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format.js +++ b/implementation-contributed/v8/intl/relative-time-format/format.js @@ -1,82 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-relative-time-format - -// Make sure that RelativeTimeFormat exposes all required properties. Those not specified -// should have undefined value. -// http://tc39.github.io/proposal-intl-relative-time/ - -let rtf = new Intl.RelativeTimeFormat(); - -// Test 1.4.3 Intl.RelativeTimeFormat.prototype.format( value, unit ) -assertEquals('string', typeof rtf.format(-1, 'seconds')); -assertEquals('string', typeof rtf.format(-1, 'second')); -assertEquals('string', typeof rtf.format(-1, 'minutes')); -assertEquals('string', typeof rtf.format(-1, 'minute')); -assertEquals('string', typeof rtf.format(-1, 'hours')); -assertEquals('string', typeof rtf.format(-1, 'hour')); -assertEquals('string', typeof rtf.format(-1, 'days')); -assertEquals('string', typeof rtf.format(-1, 'day')); -assertEquals('string', typeof rtf.format(-1, 'weeks')); -assertEquals('string', typeof rtf.format(-1, 'week')); -assertEquals('string', typeof rtf.format(-1, 'months')); -assertEquals('string', typeof rtf.format(-1, 'month')); -assertEquals('string', typeof rtf.format(-1, 'years')); -assertEquals('string', typeof rtf.format(-1, 'year')); -assertEquals('string', typeof rtf.format(-1, 'quarter')); -assertEquals('string', typeof rtf.format(-1, 'quarters')); - -assertEquals('string', typeof rtf.format(-0, 'seconds')); -assertEquals('string', typeof rtf.format(-0, 'second')); -assertEquals('string', typeof rtf.format(-0, 'minutes')); -assertEquals('string', typeof rtf.format(-0, 'minute')); -assertEquals('string', typeof rtf.format(-0, 'hours')); -assertEquals('string', typeof rtf.format(-0, 'hour')); -assertEquals('string', typeof rtf.format(-0, 'days')); -assertEquals('string', typeof rtf.format(-0, 'day')); -assertEquals('string', typeof rtf.format(-0, 'weeks')); -assertEquals('string', typeof rtf.format(-0, 'week')); -assertEquals('string', typeof rtf.format(-0, 'months')); -assertEquals('string', typeof rtf.format(-0, 'month')); -assertEquals('string', typeof rtf.format(-0, 'years')); -assertEquals('string', typeof rtf.format(-0, 'year')); -assertEquals('string', typeof rtf.format(-0, 'quarter')); -assertEquals('string', typeof rtf.format(-0, 'quarters')); - -assertThrows(() => rtf.format(NaN, 'seconds'), RangeError); -assertThrows(() => rtf.format(NaN, 'second'), RangeError); -assertThrows(() => rtf.format(NaN, 'minutes'), RangeError); -assertThrows(() => rtf.format(NaN, 'minute'), RangeError); -assertThrows(() => rtf.format(NaN, 'hours'), RangeError); -assertThrows(() => rtf.format(NaN, 'hour'), RangeError); -assertThrows(() => rtf.format(NaN, 'days'), RangeError); -assertThrows(() => rtf.format(NaN, 'day'), RangeError); -assertThrows(() => rtf.format(NaN, 'weeks'), RangeError); -assertThrows(() => rtf.format(NaN, 'week'), RangeError); -assertThrows(() => rtf.format(NaN, 'months'), RangeError); -assertThrows(() => rtf.format(NaN, 'month'), RangeError); -assertThrows(() => rtf.format(NaN, 'years'), RangeError); -assertThrows(() => rtf.format(NaN, 'year'), RangeError); -assertThrows(() => rtf.format(NaN, 'quarters'), RangeError); -assertThrows(() => rtf.format(NaN, 'quarter'), RangeError); - -assertThrows(() => rtf.format(-1, 'decades'), RangeError); -assertThrows(() => rtf.format(-1, 'decade'), RangeError); -assertThrows(() => rtf.format(-1, 'centuries'), RangeError); -assertThrows(() => rtf.format(-1, 'century'), RangeError); -assertThrows(() => rtf.format(-1, 'milliseconds'), RangeError); -assertThrows(() => rtf.format(-1, 'millisecond'), RangeError); -assertThrows(() => rtf.format(-1, 'microseconds'), RangeError); -assertThrows(() => rtf.format(-1, 'microsecond'), RangeError); -assertThrows(() => rtf.format(-1, 'nanoseconds'), RangeError); -assertThrows(() => rtf.format(-1, 'nanosecond'), RangeError); - -assertEquals('string', typeof rtf.format(5, 'day')); -assertEquals('string', typeof rtf.format('5', 'day')); -assertEquals('string', typeof rtf.format('-5', 'day')); -assertEquals('string', typeof rtf.format('534', 'day')); -assertEquals('string', typeof rtf.format('-534', 'day')); - -//assertThrows(() => rtf.format('xyz', 'day'), RangeError); diff --git a/implementation-contributed/v8/intl/relative-time-format/resolved-options.js b/implementation-contributed/v8/intl/relative-time-format/resolved-options.js index 391b83ae0a..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/relative-time-format/resolved-options.js +++ b/implementation-contributed/v8/intl/relative-time-format/resolved-options.js @@ -1,164 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-relative-time-format - -let rtf = new Intl.RelativeTimeFormat(); -// Test 1.4.5 Intl.RelativeTimeFormat.prototype.resolvedOptions () -// The default style is 'long' -assertEquals('long', rtf.resolvedOptions().style); - -// The default numeric is 'always' -assertEquals('always', rtf.resolvedOptions().numeric); - -// contains style, numeric and locale key -assertEquals(4, Object.getOwnPropertyNames(rtf.resolvedOptions()).length); - -// contains style, numeric and locale key -assertEquals( - 4, - Object.getOwnPropertyNames( - new Intl.RelativeTimeFormat("en").resolvedOptions() - ).length -); - -assertEquals( - 'short', - (new Intl.RelativeTimeFormat(['sr'], {style: 'short'})) - .resolvedOptions().style); - -assertEquals( - 'always', - (new Intl.RelativeTimeFormat(['sr'], {style: 'short'})) - .resolvedOptions().numeric); - -assertEquals( - 'narrow', - (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow'})) - .resolvedOptions().style); - -assertEquals( - 'always', - (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow'})) - .resolvedOptions().numeric); - -assertEquals( - 'long', - (new Intl.RelativeTimeFormat(['sr'], {style: 'long'})) - .resolvedOptions().style); - -assertEquals( - 'always', - (new Intl.RelativeTimeFormat(['sr'], {style: 'long'})) - .resolvedOptions().numeric); - -assertEquals( - 'auto', - (new Intl.RelativeTimeFormat(['sr'], {numeric: 'auto'})) - .resolvedOptions().numeric); - -assertEquals( - 'long', - (new Intl.RelativeTimeFormat(['sr'], {numeric: 'auto'})) - .resolvedOptions().style); - -assertEquals( - 'always', - (new Intl.RelativeTimeFormat(['sr'], {numeric: 'always'})) - .resolvedOptions().numeric); - -assertEquals( - 'long', - (new Intl.RelativeTimeFormat(['sr'], {numeric: 'always'})) - .resolvedOptions().style); - -assertEquals( - 'long', - (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'auto'})) - .resolvedOptions().style); - -assertEquals( - 'auto', - (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'auto'})) - .resolvedOptions().numeric); - -assertEquals( - 'long', - (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'always'})) - .resolvedOptions().style); - -assertEquals( - 'always', - (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'always'})) - .resolvedOptions().numeric); - -assertEquals( - 'short', - (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'auto'})) - .resolvedOptions().style); - -assertEquals( - 'auto', - (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'auto'})) - .resolvedOptions().numeric); - -assertEquals( - 'short', - (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'always'})) - .resolvedOptions().style); - -assertEquals( - 'always', - (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'always'})) - .resolvedOptions().numeric); - -assertEquals( - 'narrow', - (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'auto'})) - .resolvedOptions().style); - -assertEquals( - 'auto', - (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'auto'})) - .resolvedOptions().numeric); - -assertEquals( - 'narrow', - (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'always'})) - .resolvedOptions().style); - -assertEquals( - 'always', - (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'always'})) - .resolvedOptions().numeric); - -assertEquals( - 'ar', - (new Intl.RelativeTimeFormat(['ar'])).resolvedOptions().locale); - -assertEquals( - 'ar', - (new Intl.RelativeTimeFormat(['ar', 'en'])).resolvedOptions().locale); - -assertEquals( - 'fr', - (new Intl.RelativeTimeFormat(['fr', 'en'])).resolvedOptions().locale); - -assertEquals( - 'ar', - (new Intl.RelativeTimeFormat(['xyz', 'ar'])).resolvedOptions().locale); - -{ - var receiver = 1; - assertThrows(() => - Intl.RelativeTimeFormat.prototype.resolvedOptions.call(receiver), TypeError); - - receiver = {}; - assertThrows(() => - Intl.RelativeTimeFormat.prototype.resolvedOptions.call(receiver), TypeError); -} - -assertEquals( - 'ar', - (new Intl.RelativeTimeFormat(['i-default', 'ar'])).resolvedOptions().locale); diff --git a/implementation-contributed/v8/intl/relative-time-format/supported-locale.js b/implementation-contributed/v8/intl/relative-time-format/supported-locale.js index b24cfb27af..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/relative-time-format/supported-locale.js +++ b/implementation-contributed/v8/intl/relative-time-format/supported-locale.js @@ -1,19 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-relative-time-format -assertEquals(typeof Intl.RelativeTimeFormat.supportedLocalesOf, "function", - "Intl.RelativeTimeFormat.supportedLocalesOf should be a function"); - -var undef = Intl.RelativeTimeFormat.supportedLocalesOf(); -assertEquals([], undef); - -var empty = Intl.RelativeTimeFormat.supportedLocalesOf([]); -assertEquals([], empty); - -var strLocale = Intl.RelativeTimeFormat.supportedLocalesOf('sr'); -assertEquals('sr', strLocale[0]); - -var multiLocale = ['sr-Thai-RS', 'de', 'zh-CN']; -assertEquals(multiLocale, Intl.RelativeTimeFormat.supportedLocalesOf(multiLocale)); diff --git a/implementation-contributed/v8/intl/segmenter/check-lb-option.js b/implementation-contributed/v8/intl/segmenter/check-lb-option.js index b56b76fc95..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/segmenter/check-lb-option.js +++ b/implementation-contributed/v8/intl/segmenter/check-lb-option.js @@ -1,41 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -let invalid_lb = [ - "invalid", - "abce", - "breakall", - "keepall", - "none", - "standard", -]; - -let valid_lb= [ - "strict", - "normal", - "loose", -]; - -let locales = [ - "en", - "ja", - "zh", -]; - -invalid_lb.forEach(function(lb) { - let df = new Intl.Segmenter(["en-u-lb-" + lb + "-fo-obar"]); - assertEquals("en", df.resolvedOptions().locale); -} -); - -valid_lb.forEach(function(lb) { - locales.forEach(function(base) { - let l = base + "-u-lb-" + lb; - let df = new Intl.Segmenter([l + "-fo-obar"]); - assertEquals(l, df.resolvedOptions().locale); - }); -} -); diff --git a/implementation-contributed/v8/intl/segmenter/constructor-order.js b/implementation-contributed/v8/intl/segmenter/constructor-order.js index 09ff8f1fe0..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/segmenter/constructor-order.js +++ b/implementation-contributed/v8/intl/segmenter/constructor-order.js @@ -1,23 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -// Throws only once during construction. -// Check for all getters to prevent regression. -// Preserve the order of getter initialization. -let getCount = 0; - -new Intl.Segmenter(['en-US'], { - get localeMatcher() { - assertEquals(0, getCount++); - }, - get lineBreakStyle() { - assertEquals(1, getCount++); - }, - get granularity() { - assertEquals(2, getCount++); - }, -}); -assertEquals(3, getCount); diff --git a/implementation-contributed/v8/intl/segmenter/constructor.js b/implementation-contributed/v8/intl/segmenter/constructor.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/implementation-contributed/v8/intl/segmenter/segment-iterator.js b/implementation-contributed/v8/intl/segmenter/segment-iterator.js index 531394f636..e69de29bb2 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-iterator.js +++ b/implementation-contributed/v8/intl/segmenter/segment-iterator.js @@ -1,15 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -const text = "Hello World, Test 123! Foo Bar. How are you?"; -for (const granularity of ["grapheme", "word", "sentence", "line"]) { - const segmenter = new Intl.Segmenter("en", { granularity }); - const iter = segmenter.segment(text); - - assertEquals("number", typeof iter.index); - assertEquals(0, iter.index); - assertEquals(undefined, iter.breakType); -} diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-following.js b/implementation-contributed/v8/intl/segmenter/segment-line-following.js deleted file mode 100644 index 77a17a6d49..0000000000 --- a/implementation-contributed/v8/intl/segmenter/segment-line-following.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian - "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic - "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil - "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu - "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai - "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese - "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean - ]) { - const iter = seg.segment(text); - let prev = 0; - let segments = []; - while (!iter.following()) { - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertTrue(iter.index >= 0); - assertTrue(iter.index <= text.length); - assertTrue(iter.index > prev); - segments.push(text.substring(prev, iter.index)); - prev = iter.index; - } - assertEquals(text, segments.join("")); -} diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-iterable.js b/implementation-contributed/v8/intl/segmenter/segment-line-iterable.js deleted file mode 100644 index 262bb669d5..0000000000 --- a/implementation-contributed/v8/intl/segmenter/segment-line-iterable.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian - "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic - "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil - "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu - "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai - "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese - "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean - ]) { - let segments = []; - // Create another %SegmentIterator% to compare with result from the one that - // created in the for of loop. - let iter = seg.segment(text); - let prev = 0; - for (const v of seg.segment(text)) { - assertTrue(["soft", "hard"].includes(v.breakType), v.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); - segments.push(v.segment); - - // manually advance the iter. - assertFalse(iter.following()); - assertEquals(iter.breakType, v.breakType); - assertEquals(text.substring(prev, iter.index), v.segment); - prev = iter.index; - } - assertTrue(iter.following()); - assertEquals(text, segments.join('')); -} diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-next.js b/implementation-contributed/v8/intl/segmenter/segment-line-next.js deleted file mode 100644 index 7bbe9a4491..0000000000 --- a/implementation-contributed/v8/intl/segmenter/segment-line-next.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian - "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic - "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil - "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu - "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai - "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese - "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean - ]) { - const iter = seg.segment(text); - let segments = []; - let oldPos = -1; - for (let result = iter.next(); !result.done; result = iter.next()) { - const v = result.value; - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertEquals("string", typeof v.segment); - assertTrue(v.segment.length > 0); - segments.push(v.segment); - assertEquals("number", typeof v.index); - assertTrue(oldPos < v.index); - oldPos = v.index; - } - assertEquals(text, segments.join('')); -} diff --git a/implementation-contributed/v8/intl/segmenter/segment-line-preceding.js b/implementation-contributed/v8/intl/segmenter/segment-line-preceding.js deleted file mode 100644 index 2e6569cc99..0000000000 --- a/implementation-contributed/v8/intl/segmenter/segment-line-preceding.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian - "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic - "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil - "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu - "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai - "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese - "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean - ]) { - const iter = seg.segment(text); - let prev = text.length; - let segments = []; - iter.preceding(prev) - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertTrue(iter.index >= 0); - assertTrue(iter.index < prev); - segments.push(text.substring(iter.index, prev)); - prev = iter.index; - while (!iter.preceding()) { - assertTrue(["soft", "hard"].includes(iter.breakType), iter.breakType); - assertTrue(iter.index >= 0); - assertTrue(iter.index <= text.length); - assertTrue(iter.index < prev); - segments.push(text.substring(iter.index, prev)); - prev = iter.index; - } - assertEquals(text, segments.reverse().join("")); -} diff --git a/implementation-contributed/v8/intl/segmenter/segment-line.js b/implementation-contributed/v8/intl/segmenter/segment-line.js deleted file mode 100644 index 8ac522e723..0000000000 --- a/implementation-contributed/v8/intl/segmenter/segment-line.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-intl-segmenter - -const seg = new Intl.Segmenter([], {granularity: "line"}) -for (const text of [ - "Hello world!", // English - " Hello world! ", // English with space before/after - " Hello world? Foo bar!", // English - "Jedovatou mambu objevila žena v zahrádkářské kolonii.", // Czech - "Việt Nam: Nhất thể hóa sẽ khác Trung Quốc?", // Vietnamese - "Σοβαρές ενστάσεις Κομισιόν για τον προϋπολογισμό της Ιταλίας", // Greek - "Решение Индии о покупке российских С-400 расценили как вызов США", // Russian - "הרופא שהציל נשים והנערה ששועבדה ע", // Hebrew, - "ترامب للملك سلمان: أنا جاد للغاية.. عليك دفع المزيد", // Arabic - "भारत की एस 400 मिसाइल के मुकाबले पाक की थाड, जानें कौन कितना ताकतवर", // Hindi - "ரெட் அலர்ட் எச்சரிக்கை; புதுச்சேரியில் நாளை அரசு விடுமுறை!", // Tamil - "'ఉత్తర్వులు అందే వరకు ఓటర్ల తుది జాబితాను వెబ్‌సైట్లో పెట్టవద్దు'", // Telugu - "台北》抹黑柯P失敗?朱學恒酸:姚文智氣pupu嗆大老闆", // Chinese - "วัดไทรตีระฆังเบาลงช่วงเข้าพรรษา เจ้าอาวาสเผยคนร้องเรียนรับผลกรรมแล้ว", // Thai - "九州北部の一部が暴風域に入りました(日直予報士 2018年10月06日) - 日本気象協会 tenki.jp", // Japanese - "법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean - ]) { - const iter = seg.segment(text); - assertEquals(undefined, iter.breakType); - assertEquals(0, iter.index); -} diff --git a/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js b/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js index 674cddd047..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js +++ b/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js @@ -1,194 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -function checkIsRedeclarationError(code) { - try { - eval(` -checkIsRedeclarationError : { - break checkIsRedeclarationError; -${code} -} -`); - assertUnreachable(); - } catch(e) { - assertInstanceof(e, SyntaxError ); - assertTrue( e.toString().indexOf("has already been declared") >= 0 ); - } -} - -function checkIsNotRedeclarationError(code) { - assertDoesNotThrow(()=>eval(` -checkIsNotRedeclarationError_label : { - break checkIsNotRedeclarationError_label; -${code} -} -`)); -} - - -let var_e = [ - 'var e', - 'var {e}', - 'var {f, e}', - 'var [e]', - 'var {f:e}', - 'var [[[], e]]' -]; - -let not_var_e = [ - 'var f', - 'var {}', - 'var {e:f}', - 'e', - '{e}', - 'let e', - 'const e', - 'let {e}', - 'const {e}', - 'let [e]', - 'const [e]', - 'let {f:e}', - 'const {f:e}' -]; - -// Check that `for (var ... of ...)` cannot redeclare a simple catch variable -// but `for (var ... in ...)` can. -for (let binding of var_e) { - checkIsRedeclarationError(` -try { - throw 0; -} catch(e) { - for (${binding} of []); -} -`); - - checkIsNotRedeclarationError(` -try { - throw 0; -} catch(e) { - for (${binding} in []); -} -`); -} - -// Check that the above error occurs even for nested catches. -for (let binding of var_e) { - checkIsRedeclarationError(` -try { - throw 0; -} catch(e) { - try { - throw 1; - } catch(f) { - try { - throw 2; - } catch({}) { - for (${binding} of []); - } - } -} -`); - - checkIsNotRedeclarationError(` -try { - throw 0; -} catch(e) { - try { - throw 1; - } catch(f) { - try { - throw 2; - } catch({}) { - for (${binding} in []); - } - } -} -`); -} - -// Check that the above error does not occur if a declaration scope is between -// the catch and the loop. -for (let binding of var_e) { - checkIsNotRedeclarationError(` -try { - throw 0; -} catch(e) { - (()=>{for (${binding} of []);})(); -} -`); - - checkIsNotRedeclarationError(` -try { - throw 0; -} catch(e) { - (function(){for (${binding} of []);})(); -} -`); -} - -// Check that there is no error when not declaring a var named e. -for (let binding of not_var_e) { - checkIsNotRedeclarationError(` -try { - throw 0; -} catch(e) { - for (${binding} of []); -} -`); -} - -// Check that there is an error for both for-in and for-of when redeclaring -// a non-simple catch parameter -for (let binding of var_e) { - checkIsRedeclarationError(` -try { - throw 0; -} catch({e}) { - for (${binding} of []); -} -`); - - checkIsRedeclarationError(` -try { - throw 0; -} catch({e}) { - for (${binding} in []); -} -`); -} - -// Check that the above error occurs even for nested catches. -for (let binding of var_e) { - checkIsRedeclarationError(` -try { - throw 0; -} catch({e}) { - try { - throw 1; - } catch(f) { - try { - throw 2; - } catch({}) { - for (${binding} of []); - } - } -} -`); - - checkIsRedeclarationError(` -try { - throw 0; -} catch({e}) { - try { - throw 1; - } catch(f) { - try { - throw 2; - } catch({}) { - for (${binding} in []); - } - } -} -`); -} diff --git a/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js b/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js index 7cc0a87b68..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js +++ b/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js @@ -1,94 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var target = { - "target_one": 1 -}; -target.__proto__ = { - "target_proto_two": 2 -}; -var handler = { - ownKeys: function(target) { - return ["foo", "bar"]; - } -} - -var proxy = new Proxy(target, handler); - -// Simple case. -assertEquals(["foo", "bar"], Reflect.ownKeys(proxy)); - -// Test interesting steps of the algorithm: - -// Step 6: Fall through to target.[[OwnPropertyKeys]] if the trap is undefined. -handler.ownKeys = undefined; -assertEquals(["target_one"], Reflect.ownKeys(proxy)); - -// Step 7: Throwing traps don't crash. -handler.ownKeys = function(target) { throw 1; }; -assertThrows("Reflect.ownKeys(proxy)"); - -// Step 8: CreateListFromArrayLike error cases: -// Returning a non-Object throws. -var keys = 1; -handler.ownKeys = function(target) { return keys; }; -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = "string"; -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = Symbol("foo"); -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = null; -assertThrows("Reflect.ownKeys(proxy)", TypeError); - -// "length" property is honored. -keys = { 0: "a", 1: "b", 2: "c" }; -keys.length = 0; -assertEquals([], Reflect.ownKeys(proxy)); -keys.length = 1; -assertEquals(["a"], Reflect.ownKeys(proxy)); -keys.length = 3; -assertEquals(["a", "b", "c"], Reflect.ownKeys(proxy)); -// The spec wants to allow lengths up to 2^53, but we can't allocate arrays -// of that size, so we throw even for smaller values. -keys.length = Math.pow(2, 33); -assertThrows("Reflect.ownKeys(proxy)", RangeError); - -// Check that we allow duplicated keys. -keys = ['a', 'a', 'a'] -assertEquals(keys, Reflect.ownKeys(proxy)); - -// Non-Name results throw. -keys = [1]; -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = [{}]; -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = [{toString: function() { return "foo"; }}]; -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = [null]; -assertThrows("Reflect.ownKeys(proxy)", TypeError); - -// Step 17a: The trap result must include all non-configurable keys. -Object.defineProperty(target, "nonconf", {value: 1, configurable: false}); -keys = ["foo"]; -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = ["nonconf"]; -assertEquals(keys, Reflect.ownKeys(proxy)); - -// Check that we allow duplicated keys. -keys = ['nonconf', 'nonconf', 'nonconf'] -assertEquals(keys, Reflect.ownKeys(proxy)); - -// Step 19a: The trap result must all keys of a non-extensible target. -Object.preventExtensions(target); -assertThrows("Reflect.ownKeys(proxy)", TypeError); -keys = ["nonconf", "target_one"]; -assertEquals(keys, Reflect.ownKeys(proxy)); - -// Step 20: The trap result must not add keys to a non-extensible target. -keys = ["nonconf", "target_one", "fantasy"]; -assertThrows("Reflect.ownKeys(proxy)", TypeError); - -// Check that we allow duplicated keys. -keys = ['nonconf', 'target_one', 'nonconf', 'nonconf', 'target_one',] -assertEquals(keys, Reflect.ownKeys(proxy)); diff --git a/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js b/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js index c5c4ff079a..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js +++ b/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js @@ -1,126 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -var typedArrayConstructors = [ - Uint8Array, - Int8Array, - Uint16Array, - Int16Array, - Uint32Array, - Int32Array, - Uint8ClampedArray, - Float32Array, - Float64Array -]; - -function assertArrayLikeEquals(value, expected, type) { - assertEquals(value.__proto__, type.prototype); - // Don't test value.length because we mess with that; - // instead in certain callsites we check that length - // is set appropriately. - for (var i = 0; i < expected.length; ++i) { - // Use Object.is to differentiate between +-0 - assertSame(expected[i], value[i]); - } -} - -for (var constructor of typedArrayConstructors) { - // Test default numerical sorting order - var a = new constructor([100, 7, 45]) - assertEquals(a.sort(), a); - assertArrayLikeEquals(a, [7, 45, 100], constructor); - assertEquals(a.length, 3); - - // For arrays of floats, certain handling of +-0/NaN - if (constructor === Float32Array || constructor === Float64Array) { - var b = new constructor([+0, -0, NaN, -0, NaN, +0]) - b.sort(); - assertArrayLikeEquals(b, [-0, -0, +0, +0, NaN, NaN], constructor); - assertEquals(b.length, 6); - } - - // Custom sort--backwards - a.sort(function(x, y) { return y - x; }); - assertArrayLikeEquals(a, [100, 45, 7], constructor); - - // Basic TypedArray method properties: - // Length field is ignored - Object.defineProperty(a, 'length', {value: 1}); - assertEquals(a.sort(), a); - assertArrayLikeEquals(a, [7, 45, 100], constructor); - assertEquals(a.length, 1); - // Method doesn't work on other objects - assertThrows(function() { a.sort.call([]); }, TypeError); - - // Do not touch elements out of byte offset - var buf = new ArrayBuffer(constructor.BYTES_PER_ELEMENT * 3); - var a = new constructor(buf, constructor.BYTES_PER_ELEMENT); - var b = new constructor(buf); - b[0] = 3; b[1] = 2; b[2] = 1; - a.sort(); - assertArrayLikeEquals(a, [1, 2], constructor); - - // Detached Operation - var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - %ArrayBufferDetach(array.buffer); - assertThrows(() => array.sort(), TypeError); -} - -// The following creates a test for each typed element kind, where the array -// to sort consists of some max/min/zero elements. -// -// When providing a custom compare function, the torque version of -// TypedArray.p.sort needs to convert array elements to "Number"/"BigInt" -// and back. The following test checks the edge cases for that conversion. - -let constructorsWithArrays = [ - {ctor: Uint8Array, array: [255, 254, 4, 3, 2, 1, 0]}, - {ctor: Int8Array, array: [127, 126, 1, 0, -1, -127, -128]}, - {ctor: Uint16Array, array: [2 ** 16 - 1, 2 ** 16 - 2, 4, 3, 2, 1, 0]}, - { - ctor: Int16Array, - array: [2 ** 15 - 1, 2 ** 15 - 2, 1, 0, -1, -(2 ** 15 - 1), -(2 ** 15)] - }, - {ctor: Uint32Array, array: [2 ** 32 - 1, 2 ** 32 - 2, 4, 3, 2, 1, 0]}, - { - ctor: Int32Array, - array: [2 ** 31 - 1, 2 ** 31 - 2, 1, 0, -1, -(2 ** 31 - 1), -(2 ** 31)] - }, - { - ctor: Float32Array, - array: [2 ** 24, 2 ** 24 - 1, 1, 0,-1, -(2 ** 24 - 1), -(2 ** 24)] - }, - { - ctor: Float64Array, - array: [2 ** 53, 2 ** 53 - 1, 1, 0, -1, -(2 ** 53 - 1), -(2 ** 53)] - }, - {ctor: Uint8ClampedArray, array: [255, 254, 4, 3, 2, 1, 0]}, - { - ctor: BigUint64Array, - array: [2n ** 64n - 1n, 2n ** 64n - 2n, 4n, 3n, 2n, 1n, 0n] - }, - { - ctor: BigInt64Array, - array: [2n ** 63n - 1n, 2n ** 63n - 2n, 1n, 0n, - -1n, -(2n ** 63n - 1n), -(2n ** 63n)] - } -]; - -// Compare function needs to return a Number in all cases, and not a BigInt. -// Hence we can not simply return "a - b". -function cmpfn(a, b) { - if (a < b) return -1; - if (b < a) return 1; - return 0; -} - -for (let constructor of constructorsWithArrays) { - let array = new constructor.ctor(constructor.array); - - assertEquals(array.sort(cmpfn), array); - assertArrayLikeEquals(array, constructor.array.reverse(), constructor.ctor); - assertEquals(array.length, constructor.array.length); -} diff --git a/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js b/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js index f88840dba4..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js +++ b/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js @@ -1,234 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -function DataDescriptor(value) { - return { "enumerable": true, "configurable": true, "writable": true, value }; -} - - -function TestMeta() { - assertEquals(1, Object.getOwnPropertyDescriptors.length); - assertEquals(Function.prototype, - Object.getPrototypeOf(Object.getOwnPropertyDescriptors)); - assertEquals( - 'getOwnPropertyDescriptors', Object.getOwnPropertyDescriptors.name); - var desc = Reflect.getOwnPropertyDescriptor( - Object, 'getOwnPropertyDescriptors'); - assertFalse(desc.enumerable); - assertTrue(desc.writable); - assertTrue(desc.configurable); -} -TestMeta(); - - -function TestToObject() { - assertThrows(function() { - Object.getOwnPropertyDescriptors(null); - }, TypeError); - - assertThrows(function() { - Object.getOwnPropertyDescriptors(undefined); - }, TypeError); - - assertThrows(function() { - Object.getOwnPropertyDescriptors(); - }, TypeError); -} -TestToObject(); - - -function TestPrototypeProperties() { - function F() {}; - F.prototype.a = "A"; - F.prototype.b = "B"; - - var F2 = new F(); - Object.defineProperties(F2, { - "b": { - enumerable: false, - configurable: true, - writable: false, - value: "Shadowed 'B'" - }, - "c": { - enumerable: false, - configurable: true, - writable: false, - value: "C" - } - }); - - assertEquals({ - "b": { - enumerable: false, - configurable: true, - writable: false, - value: "Shadowed 'B'" - }, - "c": { - enumerable: false, - configurable: true, - writable: false, - value: "C" - } - }, Object.getOwnPropertyDescriptors(F2)); -} -TestPrototypeProperties(); - - -function TestPrototypeProperties() { - function F() {}; - F.prototype.a = "A"; - F.prototype.b = "B"; - - var F2 = new F(); - Object.defineProperties(F2, { - "b": { - enumerable: false, - configurable: true, - writable: false, - value: "Shadowed 'B'" - }, - "c": { - enumerable: false, - configurable: true, - writable: false, - value: "C" - } - }); - - assertEquals({ - "b": { - enumerable: false, - configurable: true, - writable: false, - value: "Shadowed 'B'" - }, - "c": { - enumerable: false, - configurable: true, - writable: false, - value: "C" - } - }, Object.getOwnPropertyDescriptors(F2)); -} -TestPrototypeProperties(); - - -function TestTypeFilteringAndOrder() { - var log = []; - var sym = Symbol("foo"); - var psym = %CreatePrivateSymbol("private"); - var O = { - 0: 0, - [sym]: 3, - "a": 2, - [psym]: 4, - 1: 1, - }; - var P = new Proxy(O, { - ownKeys(target) { - log.push("ownKeys()"); - return Reflect.ownKeys(target); - }, - getOwnPropertyDescriptor(target, name) { - log.push(`getOwnPropertyDescriptor(${String(name)})`); - return Reflect.getOwnPropertyDescriptor(target, name); - }, - get(target, name) { assertUnreachable(); }, - set(target, name, value) { assertUnreachable(); }, - deleteProperty(target, name) { assertUnreachable(); }, - defineProperty(target, name, desc) { assertUnreachable(); } - }); - - var result1 = Object.getOwnPropertyDescriptors(O); - assertEquals({ - 0: DataDescriptor(0), - 1: DataDescriptor(1), - "a": DataDescriptor(2), - [sym]: DataDescriptor(3) - }, result1); - - var result2 = Object.getOwnPropertyDescriptors(P); - assertEquals([ - "ownKeys()", - "getOwnPropertyDescriptor(0)", - "getOwnPropertyDescriptor(1)", - "getOwnPropertyDescriptor(a)", - "getOwnPropertyDescriptor(Symbol(foo))" - ], log); - assertEquals({ - 0: DataDescriptor(0), - 1: DataDescriptor(1), - "a": DataDescriptor(2), - [sym]: DataDescriptor(3) - }, result2); -} -TestTypeFilteringAndOrder(); - - -function TestDuplicateKeys() { - var i = 0; - var log = []; - var P = new Proxy({}, { - ownKeys() { - log.push(`ownKeys()`); - return ["A", "A"]; - }, - getOwnPropertyDescriptor(t, name) { - log.push(`getOwnPropertyDescriptor(${name})`); - if (i++) return; - return { - configurable: true, - writable: false, - value: "VALUE" - }; - }, - get(target, name) { assertUnreachable(); }, - set(target, name, value) { assertUnreachable(); }, - deleteProperty(target, name) { assertUnreachable(); }, - defineProperty(target, name, desc) { assertUnreachable(); } - }); - - var result = Object.getOwnPropertyDescriptors(P); - assertEquals({ - "A": { - "value": "VALUE", - "writable": false, - "enumerable": false, - "configurable": true - } - }, result); - assertTrue(result.hasOwnProperty("A")); - assertEquals([ - "ownKeys()", - "getOwnPropertyDescriptor(A)", - "getOwnPropertyDescriptor(A)" - ], log); -} -TestDuplicateKeys(); - -function TestFakeProperty() { - var log = []; - var P = new Proxy({}, { - ownKeys() { - log.push(`ownKeys()`); - return ["fakeProperty"]; - }, - getOwnPropertyDescriptor(target, name) { - log.push(`getOwnPropertyDescriptor(${name})`); - return; - } - }); - var result = Object.getOwnPropertyDescriptors(P); - assertEquals({}, result); - assertFalse(result.hasOwnProperty("fakeProperty")); - assertEquals([ - "ownKeys()", - "getOwnPropertyDescriptor(fakeProperty)" - ], log); -} -TestFakeProperty(); diff --git a/implementation-contributed/v8/mjsunit/es8/object-values.js b/implementation-contributed/v8/mjsunit/es8/object-values.js index 23fcaed1bc..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/es8/object-values.js +++ b/implementation-contributed/v8/mjsunit/es8/object-values.js @@ -1,291 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -function TestMeta() { - assertEquals(1, Object.values.length); - assertEquals(Function.prototype, Object.getPrototypeOf(Object.values)); - assertEquals("values", Object.values.name); - - var descriptor = Object.getOwnPropertyDescriptor(Object, "values"); - assertTrue(descriptor.writable); - assertFalse(descriptor.enumerable); - assertTrue(descriptor.configurable); - - assertThrows(() => new Object.values({}), TypeError); -} -TestMeta(); - - -function TestBasic() { - var x = 16; - var O = { - d: 1, - c: 3, - [Symbol.iterator]: void 0, - 0: 123, - 1000: 456, - [x * x]: "ducks", - [`0x${(x * x).toString(16)}`]: "quack" - }; - O.a = 2; - O.b = 4; - Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN }); - assertEquals([123, "ducks", 456, 1, 3, "quack", 2, 4], Object.values(O)); - assertEquals(Object.values(O), Object.keys(O).map(key => O[key])); - - assertTrue(Array.isArray(Object.values({}))); - assertEquals(0, Object.values({}).length); -} -TestBasic(); - - -function TestToObject() { - assertThrows(function() { Object.values(); }, TypeError); - assertThrows(function() { Object.values(null); }, TypeError); - assertThrows(function() { Object.values(void 0); }, TypeError); -} -TestToObject(); - - -function TestOrder() { - var O = { - a: 1, - [Symbol.iterator]: null - }; - O[456] = 123; - Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN }); - var priv = %CreatePrivateSymbol("Secret"); - O[priv] = 56; - - var log = []; - var P = new Proxy(O, { - ownKeys(target) { - log.push("[[OwnPropertyKeys]]"); - return Reflect.ownKeys(target); - }, - get(target, name) { - log.push(`[[Get]](${JSON.stringify(name)})`); - return Reflect.get(target, name); - }, - getOwnPropertyDescriptor(target, name) { - log.push(`[[GetOwnProperty]](${JSON.stringify(name)})`); - return Reflect.getOwnPropertyDescriptor(target, name); - }, - set(target, name, value) { - assertUnreachable(); - } - }); - - assertEquals([123, 1], Object.values(P)); - assertEquals([ - "[[OwnPropertyKeys]]", - "[[GetOwnProperty]](\"456\")", - "[[Get]](\"456\")", - "[[GetOwnProperty]](\"a\")", - "[[Get]](\"a\")", - "[[GetOwnProperty]](\"HIDDEN\")" - ], log); -} -TestOrder(); - - -function TestOrderWithDuplicates() { - var O = { - a: 1, - [Symbol.iterator]: null - }; - O[456] = 123; - Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN }); - O[priv] = 56; - var priv = %CreatePrivateSymbol("private"); - - var log = []; - var P = new Proxy(O, { - ownKeys(target) { - log.push("[[OwnPropertyKeys]]"); - return [ "a", Symbol.iterator, "a", "456", "HIDDEN", "HIDDEN", "456" ]; - }, - get(target, name) { - log.push(`[[Get]](${JSON.stringify(name)})`); - return Reflect.get(target, name); - }, - getOwnPropertyDescriptor(target, name) { - log.push(`[[GetOwnProperty]](${JSON.stringify(name)})`); - return Reflect.getOwnPropertyDescriptor(target, name); - }, - set(target, name, value) { - assertUnreachable(); - } - }); - - assertEquals([1, 1, 123, 123], Object.values(P)); - assertEquals([ - "[[OwnPropertyKeys]]", - "[[GetOwnProperty]](\"a\")", - "[[Get]](\"a\")", - "[[GetOwnProperty]](\"a\")", - "[[Get]](\"a\")", - "[[GetOwnProperty]](\"456\")", - "[[Get]](\"456\")", - "[[GetOwnProperty]](\"HIDDEN\")", - "[[GetOwnProperty]](\"HIDDEN\")", - "[[GetOwnProperty]](\"456\")", - "[[Get]](\"456\")", - ], log); -} -TestOrderWithDuplicates(); - - -function TestPropertyFilter() { - var object = { prop3: 30 }; - object[2] = 40; - object["prop4"] = 50; - Object.defineProperty(object, "prop5", { value: 60, enumerable: true }); - Object.defineProperty(object, "prop6", { value: 70, enumerable: false }); - Object.defineProperty(object, "prop7", { - enumerable: true, get() { return 80; }}); - var sym = Symbol("prop8"); - object[sym] = 90; - - values = Object.values(object); - assertEquals(5, values.length); - assertEquals([40,30,50,60,80], values); -} -TestPropertyFilter(); - - -function TestWithProxy() { - var obj1 = {prop1:10}; - var proxy1 = new Proxy(obj1, { }); - assertEquals([10], Object.values(proxy1)); - - var obj2 = {}; - Object.defineProperty(obj2, "prop2", { value: 20, enumerable: true }); - Object.defineProperty(obj2, "prop3", { - get() { return 30; }, enumerable: true }); - var proxy2 = new Proxy(obj2, { - getOwnPropertyDescriptor(target, name) { - return Reflect.getOwnPropertyDescriptor(target, name); - } - }); - assertEquals([20, 30], Object.values(proxy2)); - - var obj3 = {}; - var count = 0; - var proxy3 = new Proxy(obj3, { - get(target, property, receiver) { - return count++ * 5; - }, - getOwnPropertyDescriptor(target, property) { - return { configurable: true, enumerable: true }; - }, - ownKeys(target) { - return [ "prop0", "prop1", Symbol("prop2"), Symbol("prop5") ]; - } - }); - assertEquals([0, 5], Object.values(proxy3)); -} -TestWithProxy(); - - -function TestMutateDuringEnumeration() { - var aDeletesB = { - get a() { - delete this.b; - return 1; - }, - b: 2 - }; - assertEquals([1], Object.values(aDeletesB)); - - var aRemovesB = { - get a() { - Object.defineProperty(this, "b", { enumerable: false }); - return 1; - }, - b: 2 - }; - assertEquals([1], Object.values(aRemovesB)); - - var aAddsB = { get a() { this.b = 2; return 1; } }; - assertEquals([1], Object.values(aAddsB)); - - var aMakesBEnumerable = {}; - Object.defineProperty(aMakesBEnumerable, "a", { - get() { - Object.defineProperty(this, "b", { enumerable: true }); - return 1; - }, - enumerable: true - }); - Object.defineProperty(aMakesBEnumerable, "b", { - value: 2, configurable:true, enumerable: false }); - assertEquals([1, 2], Object.values(aMakesBEnumerable)); -} -TestMutateDuringEnumeration(); - - -(function TestElementKinds() { - var O1 = { name: "1" }, O2 = { name: "2" }, O3 = { name: "3" }; - var PI = 3.141592653589793; - var E = 2.718281828459045; - function fastSloppyArguments(a, b, c) { - delete arguments[0]; - arguments[0] = a; - return arguments; - } - - function slowSloppyArguments(a, b, c) { - delete arguments[0]; - arguments[0] = a; - Object.defineProperties(arguments, { - 0: { - enumerable: true, - value: a - }, - 9999: { - enumerable: false, - value: "Y" - } - }); - arguments[10000] = "X"; - return arguments; - } - - var element_kinds = { - PACKED_SMI_ELEMENTS: [ [1, 2, 3], [1, 2, 3] ], - HOLEY_SMI_ELEMENTS: [ [, , 3], [ 3 ] ], - PACKED_ELEMENTS: [ [O1, O2, O3], [O1, O2, O3] ], - HOLEY_ELEMENTS: [ [, , O3], [O3] ], - PACKED_DOUBLE_ELEMENTS: [ [E, NaN, PI], [E, NaN, PI] ], - HOLEY_DOUBLE_ELEMENTS: [ [, , NaN], [NaN] ], - - DICTIONARY_ELEMENTS: [ Object.defineProperties({ 10000: "world" }, { - 100: { enumerable: true, value: "hello" }, - 99: { enumerable: false, value: "nope" } - }), [ "hello", "world" ] ], - FAST_SLOPPY_ARGUMENTS_ELEMENTS: [ - fastSloppyArguments("a", "b", "c"), ["a", "b", "c"] ], - SLOW_SLOPPY_ARGUMENTS_ELEMENTS: [ - slowSloppyArguments("a", "b", "c"), [ "a", "b", "c", "X"]], - - FAST_STRING_WRAPPER_ELEMENTS: [ new String("str"), ["s", "t", "r"] ], - SLOW_STRING_WRAPPER_ELEMENTS: [ - Object.defineProperties(new String("str"), { - 10000: { enumerable: false, value: "X" }, - 9999: { enumerable: true, value: "Y" } - }), ["s", "t", "r", "Y"] ], - }; - - for (let [kind, [object, expected]] of Object.entries(element_kinds)) { - let result1 = Object.values(object); - assertEquals(expected, result1, `fast Object.values() with ${kind}`); - - let proxy = new Proxy(object, {}); - let result2 = Object.values(proxy); - assertEquals(result1, result2, `slow Object.values() with ${kind}`); - } -})(); diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js b/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js index d04f8a0875..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js @@ -1,31 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-array-flat - -{ - class MyArray extends Array { - static get [Symbol.species]() { - return Array; - } - } - - const wannabe = new MyArray(); - const flattened = wannabe.flat(Infinity); - assertEquals(false, flattened instanceof MyArray); - assertEquals(true, flattened instanceof Array); -} - -{ - class MyArray extends Array { - static get [Symbol.species]() { - return this; - } - } - - const wannabe = new MyArray(); - const flattened = wannabe.flat(Infinity); - assertEquals(true, flattened instanceof MyArray); - assertEquals(true, flattened instanceof Array); -} diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flat.js b/implementation-contributed/v8/mjsunit/harmony/array-flat.js index 86571e8dce..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flat.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flat.js @@ -1,65 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-array-flat - -assertEquals(Array.prototype.flat.length, 0); -assertEquals(Array.prototype.flat.name, 'flat'); - -{ - const input = [1, [2], [[3]]]; - - assertEquals(input.flat(), [1, 2, [3]]); - assertEquals(input.flat(1), [1, 2, [3]]); - assertEquals(input.flat(true), [1, 2, [3]]); - assertEquals(input.flat(undefined), [1, 2, [3]]); - - assertEquals(input.flat(-Infinity), [1, [2], [[3]]]); - assertEquals(input.flat(-1), [1, [2], [[3]]]); - assertEquals(input.flat(-0), [1, [2], [[3]]]); - assertEquals(input.flat(0), [1, [2], [[3]]]); - assertEquals(input.flat(false), [1, [2], [[3]]]); - assertEquals(input.flat(null), [1, [2], [[3]]]); - assertEquals(input.flat(''), [1, [2], [[3]]]); - assertEquals(input.flat('foo'), [1, [2], [[3]]]); - assertEquals(input.flat(/./), [1, [2], [[3]]]); - assertEquals(input.flat([]), [1, [2], [[3]]]); - assertEquals(input.flat({}), [1, [2], [[3]]]); - assertEquals( - input.flat(new Proxy({}, {})), [1, [2], [[3]]]); - assertEquals(input.flat((x) => x), [1, [2], [[3]]]); - assertEquals( - input.flat(String), [1, [2], [[3]]]); - - assertEquals(input.flat(2), [1, 2, 3]); - assertEquals(input.flat(Infinity), [1, 2, 3]); - - assertThrows(() => { input.flat(Symbol()); }, TypeError); - assertThrows(() => { input.flat(Object.create(null)); }, TypeError); -} - -{ - const input = { 0: 'a', 1: 'b', 2: 'c', length: 'wat' }; - assertEquals(Array.prototype.flat.call(input, Infinity), []); -} - -{ - let count = 0; - const input = { - get length() { ++count; return 0; } - }; - const result = Array.prototype.flat.call(input, Infinity); - assertEquals(count, 1); -} - -{ - const descriptor = Object.getOwnPropertyDescriptor( - Array.prototype, - 'flat' - ); - assertEquals(descriptor.value, Array.prototype.flat); - assertEquals(descriptor.writable, true); - assertEquals(descriptor.enumerable, false); - assertEquals(descriptor.configurable, true); -} diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js b/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js index d4159b4801..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js @@ -1,31 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-array-flat - -{ - class MyArray extends Array { - static get [Symbol.species]() { - return Array; - } - } - - const wannabe = new MyArray(); - const result = wannabe.flatMap(x => [x, x]); - assertEquals(false, result instanceof MyArray); - assertEquals(true, result instanceof Array); -} - -{ - class MyArray extends Array { - static get [Symbol.species]() { - return this; - } - } - - const wannabe = new MyArray(); - const result = wannabe.flatMap(x => [x, x]); - assertEquals(true, result instanceof MyArray); - assertEquals(true, result instanceof Array); -} diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js b/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js index 9f0426fe7f..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js @@ -1,162 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-array-flat --allow-natives-syntax - -assertEquals(Array.prototype.flatMap.length, 1); -assertEquals(Array.prototype.flatMap.name, 'flatMap'); - -assertEquals( - [1, 2, 3, 4].flatMap((element) => [element, element ** 2]), - [1, 1, 2, 4, 3, 9, 4, 16] -); -assertEquals( - [1, 2, 3, 4].flatMap((element) => [[element, element ** 2]]), - [[1, 1], [2, 4], [3, 9], [4, 16]] -); - -{ - const elements = new Set([ - -Infinity, - -1, - -0, - +0, - +1, - Infinity, - null, - undefined, - true, - false, - '', - 'foo', - /./, - [], - {}, - Object.create(null), - new Proxy({}, {}), - Symbol(), - x => x ** 2, - String - ]); - - for (const value of elements) { - assertEquals( - [value].flatMap((element) => [element, element]), - [value, value] - ); - } -} - -{ - const array = [42]; - assertEquals( - [array].flatMap((element) => [element, element]), - [array, array] - ); -} - -{ - const nonCallables = new Set([ - -Infinity, - -1, - -0, - +0, - +1, - Infinity, - null, - undefined, - true, - false, - '', - 'foo', - /./, - [], - {}, - Object.create(null), - new Proxy({}, {}), - Symbol(), - ]); - for (const nonCallable of nonCallables) { - assertThrows(() => { - [].flatMap(nonCallable); - }, TypeError); - } -} - -{ - const object = { - foo: 42, - get length() { - object.foo = 0; - } - }; - const result = [object].flatMap((element) => [element, element]); - %HeapObjectVerify(result); - assertEquals(result, [object, object]); - assertEquals(result[0].foo, 42); -} - -assertThrows(() => { - Array.prototype.flatMap.call(null, (element) => element); -}, TypeError); -assertThrows(() => { - Array.prototype.flatMap.call(undefined, (element) => element); -}, TypeError); - -assertEquals( - Array.prototype.flatMap.call( - { - length: 1, - 0: 'a', - 1: 'b', - }, - (element) => element - ), - ['a'] -); -assertEquals( - Array.prototype.flatMap.call( - { - length: 2, - 0: 'a', - 1: 'b', - }, - (element) => element - ), - ['a', 'b'] -); - -{ - const result = [1, 2, 3].flatMap(function() { - return [this]; - }, 'abc'); - assertEquals(true, result[0] == 'abc'); - assertEquals(true, result[1] == 'abc'); - assertEquals(true, result[2] == 'abc'); -} - -{ - const input = { 0: 'a', 1: 'b', 2: 'c', length: 'wat' }; - assertEquals(Array.prototype.flatMap.call(input, x => [x]), []); -} - -{ - let count = 0; - const input = { - get length() { ++count; return 0; } - }; - const result = Array.prototype.flatMap.call(input, x => [x]); - assertEquals(count, 1); -} - -{ - const descriptor = Object.getOwnPropertyDescriptor( - Array.prototype, - 'flatMap' - ); - assertEquals(descriptor.value, Array.prototype.flatMap); - assertEquals(descriptor.writable, true); - assertEquals(descriptor.enumerable, false); - assertEquals(descriptor.configurable, true); -} diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js index 88fb020101..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js @@ -1,214 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs - -(function TestConstructWeakFactory() { - let wf = new WeakFactory(() => {}); - assertEquals(wf.toString(), "[object WeakFactory]"); - assertNotSame(wf.__proto__, Object.prototype); - assertSame(wf.__proto__.__proto__, Object.prototype); -})(); - -(function TestWeakFactoryConstructorCallAsFunction() { - let caught = false; - let message = ""; - try { - let f = WeakFactory(() => {}); - } catch (e) { - message = e.message; - caught = true; - } finally { - assertTrue(caught); - assertEquals(message, "Constructor WeakFactory requires 'new'"); - } -})(); - -(function TestConstructWeakFactoryCleanupNotCallable() { - let message = "WeakFactory: cleanup must be callable"; - assertThrows(() => { let wf = new WeakFactory(); }, TypeError, message); - assertThrows(() => { let wf = new WeakFactory(1); }, TypeError, message); - assertThrows(() => { let wf = new WeakFactory(null); }, TypeError, message); -})(); - -(function TestConstructWeakFactoryWithCallableProxyAsCleanup() { - let handler = {}; - let obj = () => {}; - let proxy = new Proxy(obj, handler); - let wf = new WeakFactory(proxy); -})(); - -(function TestConstructWeakFactoryWithNonCallableProxyAsCleanup() { - let message = "WeakFactory: cleanup must be callable"; - let handler = {}; - let obj = {}; - let proxy = new Proxy(obj, handler); - assertThrows(() => { let wf = new WeakFactory(proxy); }, TypeError, message); -})(); - -(function TestMakeCell() { - let wf = new WeakFactory(() => {}); - let wc = wf.makeCell({}); - assertEquals(wc.toString(), "[object WeakCell]"); - assertNotSame(wc.__proto__, Object.prototype); - assertSame(wc.__proto__.__proto__, Object.prototype); - assertEquals(wc.holdings, undefined); - - let holdings_desc = Object.getOwnPropertyDescriptor(wc.__proto__, "holdings"); - assertEquals(true, holdings_desc.configurable); - assertEquals(false, holdings_desc.enumerable); - assertEquals("function", typeof holdings_desc.get); - assertEquals(undefined, holdings_desc.set); - - let clear_desc = Object.getOwnPropertyDescriptor(wc.__proto__, "clear"); - assertEquals(true, clear_desc.configurable); - assertEquals(false, clear_desc.enumerable); - assertEquals("function", typeof clear_desc.value); -})(); - -(function TestMakeCellWithHoldings() { - let wf = new WeakFactory(() => {}); - let obj = {a: 1}; - let holdings = {b: 2}; - let wc = wf.makeCell(obj, holdings); - assertSame(wc.holdings, holdings); -})(); - -(function TestMakeCellWithHoldingsSetHoldings() { - let wf = new WeakFactory(() => {}); - let obj = {a: 1}; - let holdings = {b: 2}; - let wc = wf.makeCell(obj, holdings); - assertSame(wc.holdings, holdings); - wc.holdings = 5; - assertSame(wc.holdings, holdings); -})(); - -(function TestMakeCellWithHoldingsSetHoldingsStrict() { - "use strict"; - let wf = new WeakFactory(() => {}); - let obj = {a: 1}; - let holdings = {b: 2}; - let wc = wf.makeCell(obj, holdings); - assertSame(wc.holdings, holdings); - assertThrows(() => { wc.holdings = 5; }, TypeError); - assertSame(wc.holdings, holdings); -})(); - -(function TestMakeCellWithNonObject() { - let wf = new WeakFactory(() => {}); - let message = "WeakFactory.prototype.makeCell: target must be an object"; - assertThrows(() => wf.makeCell(), TypeError, message); - assertThrows(() => wf.makeCell(1), TypeError, message); - assertThrows(() => wf.makeCell(false), TypeError, message); - assertThrows(() => wf.makeCell("foo"), TypeError, message); - assertThrows(() => wf.makeCell(Symbol()), TypeError, message); - assertThrows(() => wf.makeCell(null), TypeError, message); - assertThrows(() => wf.makeCell(undefined), TypeError, message); -})(); - -(function TestMakeCellWithProxy() { - let handler = {}; - let obj = {}; - let proxy = new Proxy(obj, handler); - let wf = new WeakFactory(() => {}); - let wc = wf.makeCell(proxy); -})(); - -(function TestMakeCellTargetAndHoldingsSameValue() { - let wf = new WeakFactory(() => {}); - let obj = {a: 1}; - // SameValue(target, holdings) not ok - assertThrows(() => wf.makeCell(obj, obj), TypeError, - "WeakFactory.prototype.makeCell: target and holdings must not be same"); - let holdings = {a: 1}; - let wc = wf.makeCell(obj, holdings); -})(); - -(function TestMakeCellWithoutWeakFactory() { - assertThrows(() => WeakFactory.prototype.makeCell.call({}, {}), TypeError); - // Does not throw: - let wf = new WeakFactory(() => {}); - WeakFactory.prototype.makeCell.call(wf, {}); -})(); - -(function TestHoldingsWithoutWeakCell() { - let wf = new WeakFactory(() => {}); - let wc = wf.makeCell({}); - let holdings_getter = Object.getOwnPropertyDescriptor(wc.__proto__, "holdings").get; - assertThrows(() => holdings_getter.call({}), TypeError); - // Does not throw: - holdings_getter.call(wc); -})(); - -(function TestClearWithoutWeakCell() { - let wf = new WeakFactory(() => {}); - let wc = wf.makeCell({}); - let clear = Object.getOwnPropertyDescriptor(wc.__proto__, "clear").value; - assertThrows(() => clear.call({}), TypeError); - // Does not throw: - clear.call(wc); -})(); - -(function TestWeakRefConstructor() { - let wr = new WeakRef({}); - assertEquals(wr.toString(), "[object WeakRef]"); - assertNotSame(wr.__proto__, Object.prototype); - - let deref_desc = Object.getOwnPropertyDescriptor(wr.__proto__, "deref"); - assertEquals(true, deref_desc.configurable); - assertEquals(false, deref_desc.enumerable); - assertEquals("function", typeof deref_desc.value); -})(); - -(function TestWeakRefConstructorWithNonObject() { - let message = "WeakRef: target must be an object"; - assertThrows(() => new WeakRef(), TypeError, message); - assertThrows(() => new WeakRef(1), TypeError, message); - assertThrows(() => new WeakRef(false), TypeError, message); - assertThrows(() => new WeakRef("foo"), TypeError, message); - assertThrows(() => new WeakRef(Symbol()), TypeError, message); - assertThrows(() => new WeakRef(null), TypeError, message); - assertThrows(() => new WeakRef(undefined), TypeError, message); -})(); - -(function TestWeakRefConstructorCallAsFunction() { - let caught = false; - let message = ""; - try { - let f = WeakRef({}); - } catch (e) { - message = e.message; - caught = true; - } finally { - assertTrue(caught); - assertEquals(message, "Constructor WeakRef requires 'new'"); - } -})(); - -(function TestWeakRefWithProxy() { - let handler = {}; - let obj = {}; - let proxy = new Proxy(obj, handler); - let wr = new WeakRef(proxy); -})(); - -(function TestCleanupSomeWithoutWeakFactory() { - assertThrows(() => WeakFactory.prototype.cleanupSome.call({}), TypeError); - // Does not throw: - let wf = new WeakFactory(() => {}); - let rv = WeakFactory.prototype.cleanupSome.call(wf); - assertEquals(undefined, rv); -})(); - -(function TestDerefWithoutWeakRef() { - let wf = new WeakFactory(() => {}); - let wc = wf.makeCell({}); - let wr = new WeakRef({}); - let deref = Object.getOwnPropertyDescriptor(wr.__proto__, "deref").value; - assertThrows(() => deref.call({}), TypeError); - assertThrows(() => deref.call(wc), TypeError); - // Does not throw: - deref.call(wr); -})(); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-cells.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-cells.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js index 02f05ac8e2..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js @@ -1,34 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs --expose-gc --noincremental-marking - -let r = Realm.create(); - -let cleanup = Realm.eval(r, "var stored_global; function cleanup() { stored_global = globalThis; } cleanup"); -let realm_global_this = Realm.eval(r, "globalThis"); - -let wf = new WeakFactory(cleanup); - -// Create an object and a WeakCell pointing to it. The object needs to be inside -// a closure so that we can reliably kill them! -let weak_cell; - -(function() { - let object = {}; - weak_cell = wf.makeCell(object); - - // object goes out of scope. -})(); - -gc(); - -// Assert that the cleanup function was called in its Realm. -let timeout_func = function() { - let stored_global = Realm.eval(r, "stored_global;"); - assertNotEquals(stored_global, globalThis); - assertEquals(stored_global, realm_global_this); -} - -setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js index 6a5bcfa821..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js @@ -1,56 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs --expose-gc --noincremental-marking - -// This test asserts that the cleanup function call, scheduled by GC, is a -// microtask and not a normal task. - -// Inside a microtask, cause GC (which should schedule the cleanup as -// microtask). lso schedule another microtask. Assert that the cleanup -// function ran before the other microtask. - -function scheduleMicrotask(func) { - Promise.resolve().then(func); -} - -let log = []; - -let cleanup = (iter) => { - log.push("cleanup"); - for (wc of iter) { } -} - -let wf = new WeakFactory(cleanup); -let o = null; - -(function() { - // Use a closure here to avoid other references to o which might keep it alive - // (e.g., stack frames pointing to it). - o = {}; - wf.makeCell(o); -})(); - -let microtask_after_cleanup = () => { - log.push("microtask_after_cleanup"); -} - -let first_microtask = function() { - log.push("first_microtask"); - - // This schedules the cleanup function as microtask. - o = null; - gc(); - - // Schedule a microtask which should run after the cleanup microtask. - scheduleMicrotask(microtask_after_cleanup); -} - -scheduleMicrotask(first_microtask); - -setTimeout(() => { - // Assert that the functions got called in the right order. - let wanted_log = ["first_microtask", "cleanup", "microtask_after_cleanup"]; - assertEquals(wanted_log, log); -}, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js index 2e46830093..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js @@ -1,34 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs --expose-gc --noincremental-marking - -let r = Realm.create(); - -let cleanup = Realm.eval(r, "var stored_global; let cleanup = new Proxy(function() { stored_global = globalThis;}, {}); cleanup"); -let realm_global_this = Realm.eval(r, "globalThis"); - -let wf = new WeakFactory(cleanup); - -// Create an object and a WeakCell pointing to it. The object needs to be inside -// a closure so that we can reliably kill them! -let weak_cell; - -(function() { - let object = {}; - weak_cell = wf.makeCell(object); - - // object goes out of scope. -})(); - -gc(); - -// Assert that the cleanup function was called in its Realm. -let timeout_func = function() { - let stored_global = Realm.eval(r, "stored_global;"); - assertNotEquals(stored_global, globalThis); - assertEquals(stored_global, realm_global_this); -} - -setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-cleared-weakcell.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-cleared-weakcell.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-weakcell.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-weakcell.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-called-twice.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-called-twice.js deleted file mode 100644 index a5aa537ff2..0000000000 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-called-twice.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs --expose-gc --noincremental-marking - -let cleanup_call_count = 0; -let cleanup = function(iter) { - ++cleanup_call_count; -} - -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside -// a closure so that we can reliably kill them! -let weak_cell; - -(function() { - let object = {}; - weak_cell = wf.makeCell(object); - - // Clear the WeakCell before the GC has a chance to discover it. - weak_cell.clear(); - - // Call clear again (just to assert we handle this gracefully). - weak_cell.clear(); - - // object goes out of scope. -})(); - -// This GC will discover dirty WeakCells. -gc(); -assertEquals(0, cleanup_call_count); - -// Assert that the cleanup function won't be called, since the WeakCell was cleared. -let timeout_func = function() { - assertEquals(0, cleanup_call_count); -} - -setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js deleted file mode 100644 index 98410d5d0e..0000000000 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs --expose-gc --noincremental-marking - -// Test that WeakCell.prototype.clear() also clears the WeakFactory pointer of -// WeakCell. The only way to observe this is to assert that the WeakCell no -// longer keeps its WeakFactory alive after clear() has been called. - -let weak_cell; -let weak_cell_pointing_to_factory; - -let cleanup1_call_count = 0; -let cleanup2_call_count = 0; - -let cleanup1 = function() { - ++cleanup1_call_count; -} - -let cleanup2 = function() { - ++cleanup2_call_count; -} - -let wf1 = new WeakFactory(cleanup1); - -(function(){ - let wf2 = new WeakFactory(cleanup2); - - (function() { - let object = {}; - weak_cell = wf2.makeCell(object); - // object goes out of scope. - })(); - - weak_cell_pointing_to_factory = wf1.makeCell(wf2); - // wf goes out of scope -})(); - -weak_cell.clear(); -gc(); - -// Assert that weak_cell_pointing_to_factory now got cleared. -let timeout_func = function() { - assertEquals(1, cleanup1_call_count); - assertEquals(0, cleanup2_call_count); -} - -setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js deleted file mode 100644 index 794f356119..0000000000 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs --expose-gc --noincremental-marking - -let cleanup_call_count = 0; -let cleanup_weak_cell_count = 0; -let cleanup = function(iter) { - for (wc of iter) { - // See which WeakCell we're iterating over and clear the other one. - if (wc == weak_cell1) { - weak_cell2.clear(); - } else { - assertSame(wc, weak_cell2); - weak_cell1.clear(); - } - ++cleanup_weak_cell_count; - } - ++cleanup_call_count; -} - -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside -// a closure so that we can reliably kill them! -let weak_cell1; -let weak_cell2; - -(function() { - let object1 = {}; - weak_cell1 = wf.makeCell(object1); - let object2 = {}; - weak_cell2 = wf.makeCell(object2); - - // object1 and object2 go out of scope. -})(); - -// This GC will discover dirty WeakCells and schedule cleanup. -gc(); -assertEquals(0, cleanup_call_count); - -// Assert that the cleanup function was called and iterated one WeakCell (but not the other one). -let timeout_func = function() { - assertEquals(1, cleanup_call_count); - assertEquals(1, cleanup_weak_cell_count); -} - -setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-factory-keeps-weak-cells-alive.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-factory-keeps-weak-cells-alive.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/weakcell-and-weakref.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/weakcell-and-weakref.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/factory-scheduled-for-cleanup-multiple-times.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/factory-scheduled-for-cleanup-multiple-times.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-weak-cells.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-in-cleanup.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-weak-cells.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-in-cleanup.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-weak-factories.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-weak-factories.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-after-cleanup.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-after-cleanup.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-after-cleanup.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-after-cleanup.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-before-cleanup.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-before-cleanup.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-before-cleanup.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-before-cleanup.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup1.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup1.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup2.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup2.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup3.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-inside-cleanup3.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-when-cleanup-already-scheduled.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js similarity index 100% rename from implementation-contributed/v8/mjsunit/harmony/weakrefs/clear-when-cleanup-already-scheduled.js rename to implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js index eb365986d7..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js @@ -1,36 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-weak-refs --expose-gc --noincremental-marking - -let cleanup_called = false; -let cleanup = function(iter) { - assertFalse(cleanup_called); - let result = iter.next(); - assertEquals(result.value, wc); - assertFalse(result.done); - result = iter.next(); - assertTrue(result.done); - cleanup_called = true; -} - -let wf = new WeakFactory(cleanup); -let o = {}; -let wc = wf.makeCell(o); - -gc(); -assertFalse(cleanup_called); - -// Drop the last reference to o. -o = null; -// GC will clear the WeakCell; the cleanup function will be called the next time -// we enter the event loop. -gc(); -assertFalse(cleanup_called); - -let timeout_func = function() { - assertTrue(cleanup_called); -} - -setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-3218530.js b/implementation-contributed/v8/mjsunit/regress/regress-3218530.js index 247f3dfe67..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-3218530.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-3218530.js @@ -1,39 +0,0 @@ -// Copyright 2010 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This tests that a global key values are preserved when used in -// an expression which will bail out. - -var m = Math; -var p = "floor"; - -function test() { - var bignumber = 31363200000; - assertDoesNotThrow(assertEquals(m[p](Math.round(bignumber/864E5)/7)+1, 52)); -} - -test(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-3255.js b/implementation-contributed/v8/mjsunit/regress/regress-3255.js index 0c5ee4ff00..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-3255.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-3255.js @@ -1,19 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --enable-slow-asserts - -var arr = []; -var str = new String('x'); - -function f(a,b) { - a[b] = 1; -} - -f(arr, 0); -f(str, 0); -f(str, 0); - -// This is just to trigger elements validation, object already broken. -%SetKeyedProperty(str, 1, 'y', 0); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-336820.js b/implementation-contributed/v8/mjsunit/regress/regress-336820.js index 7423610934..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-336820.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-336820.js @@ -1,38 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Flags: --max-old-space-size=1600 - -assertThrows((function() { - s = "Hello World!\n"; - while (true) { - x = new Array(); - x[0] = s; - x[1000] = s; - x[10000] = s; - s = x.join("::"); - }}), RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-5888.js b/implementation-contributed/v8/mjsunit/regress/regress-5888.js index 0725ac4285..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-5888.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-5888.js @@ -1,76 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(32, 32, false); - builder.addFunction("test", kSig_i_iii) - .addBodyWithEnd([ -// body: -kExprI64Const, 0xb4, 0x42, -kExprI64Const, 0x7a, -kExprI64Const, 0x42, -kExprI64Const, 0x7a, -kExprI64Ior, -kExprI64Ctz, -kExprI64Ctz, -kExprI64Shl, -kExprI64Mul, -kExprI64Const, 0x41, -kExprI64Ctz, -kExprI64Ctz, -kExprI64Shl, -kExprF32SConvertI64, -kExprI64Const, 0x42, -kExprI64Const, 0x02, -kExprI64Const, 0x7a, -kExprI64Mul, -kExprI64Const, 0x42, -kExprI64Ctz, -kExprI64Shl, -kExprI64Const, 0x7a, -kExprI64Ctz, -kExprI64Shl, -kExprI64Mul, -kExprI64Const, 0x41, -kExprI64Ctz, -kExprI64Ctz, -kExprI64Shl, -kExprF32SConvertI64, -kExprUnreachable, -kExprEnd, // @65 - ]) - .exportFunc(); - var module = new WebAssembly.Module(builder.toBuffer()); -})(); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(16, 32, false); - builder.addFunction("test", kSig_i_iii) - .addBodyWithEnd([ - // body: - kExprI64Const, 0x42, - kExprI64Const, 0x7a, - kExprI64Ctz, - kExprI64Mul, - kExprI64Ctz, - kExprI64Const, 0x41, - kExprI64Ctz, - kExprI64Ctz, - kExprI64Shl, - kExprI64Const, 0x41, - kExprI64Ctz, - kExprI64Ctz, - kExprI64Shl, - kExprF32SConvertI64, - kExprUnreachable, - kExprEnd, // @20 - ]) - .exportFunc(); - var module = new WebAssembly.Module(builder.toBuffer()); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-5911.js b/implementation-contributed/v8/mjsunit/regress/regress-5911.js index 0175fd3e2c..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-5911.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-5911.js @@ -1,32 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(32, 32, false); - builder.addFunction("test", kSig_i_iii) - .addBodyWithEnd([ - // body: - kExprI64Const, 0x42, - kExprI64Const, 0x7a, - kExprI64RemU, - kExprI64Const, 0x42, - kExprI64Const, 0x37, - kExprI64Mul, - kExprI64Const, 0x36, - kExprI64Mul, - kExprI64Const, 0x42, - kExprI64Ctz, - kExprI64Ctz, - kExprI64Shl, - kExprF32SConvertI64, - kExprUnreachable, - kExprEnd, // @21 - ]) - .exportFunc(); - var module = new WebAssembly.Module(builder.toBuffer()); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-687.js b/implementation-contributed/v8/mjsunit/regress/regress-687.js index a917a447f2..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-687.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-687.js @@ -1,75 +0,0 @@ -// Copyright 2009 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This regression includes a number of cases where we did not correctly -// update a accessor property to a data property using Object.defineProperty. - -var obj = { get value() {}, set value (v) { throw "Error";} }; -assertDoesNotThrow( - Object.defineProperty(obj, "value", - { value: 5, writable:true, configurable: true })); -var desc = Object.getOwnPropertyDescriptor(obj, "value"); -assertEquals(obj.value, 5); -assertTrue(desc.configurable); -assertTrue(desc.enumerable); -assertTrue(desc.writable); -assertEquals(desc.get, undefined); -assertEquals(desc.set, undefined); - - -var proto = { - get value() {}, - set value(v) { Object.defineProperty(this, "value", {value: v}); } -}; - -var create = Object.create(proto); - -assertEquals(create.value, undefined); -assertDoesNotThrow(create.value = 4); -assertEquals(create.value, 4); - -// These tests where provided in bug 959, but are all related to the this issue. -var obj1 = {}; -Object.defineProperty(obj1, 'p', {get: undefined, set: undefined}); -assertTrue("p" in obj1); -desc = Object.getOwnPropertyDescriptor(obj1, "p"); -assertFalse(desc.configurable); -assertFalse(desc.enumerable); -assertEquals(desc.value, undefined); -assertEquals(desc.get, undefined); -assertEquals(desc.set, undefined); - - -var obj2 = { get p() {}}; -Object.defineProperty(obj2, 'p', {get: undefined}) -assertTrue("p" in obj2); -desc = Object.getOwnPropertyDescriptor(obj2, "p"); -assertTrue(desc.configurable); -assertTrue(desc.enumerable); -assertEquals(desc.value, undefined); -assertEquals(desc.get, undefined); -assertEquals(desc.set, undefined); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-813440.js b/implementation-contributed/v8/mjsunit/regress/regress-813440.js index 8fcb695f5a..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-813440.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-813440.js @@ -1,17 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --invoke-weak-callbacks --omit-quit --expose-wasm --allow-natives-syntax - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -const builder = new WasmModuleBuilder(); -builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, 42]); -const buffer = builder.toBuffer(); -// Start async compilation, but don't wait for it to finish. -const module = WebAssembly.compile(buffer); - -// This create the collator. -'퓛'.localeCompare(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-863810.js b/implementation-contributed/v8/mjsunit/regress/regress-863810.js index 0ee1330310..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-863810.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-863810.js @@ -1,19 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --no-liftoff --no-wasm-tier-up --no-future --debug-code - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction('main', kSig_i_v) - .addBody([ - kExprI64Const, 0xa3, 0x82, 0x83, 0x86, 0x8c, 0xd8, 0xae, 0xb5, 0x40, - kExprI32ConvertI64, - kExprI32Const, 0x00, - kExprI32Sub, - ]).exportFunc(); -const instance = builder.instantiate(); -print(instance.exports.main(1, 2, 3)); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js index 21ec165683..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js @@ -1,25 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -function MODULE() { - "use asm"; - function f() { - bogus_function_table[0 & LIMIT](); - } - return { f:f }; -} - -var bogus_function_table = [ Object ]; -var test_set = [ 0x3fffffff, 0x7fffffff, 0xffffffff ]; -for (var i = 0; i < test_set.length; ++i) { - bogus_function_table[i] = Object; - var src = MODULE.toString(); - src = src.replace(/MODULE/g, "Module" + i); - src = src.replace(/LIMIT/g, test_set[i]); - var module = eval("(" + src + ")"); - assertDoesNotThrow(module(this).f()); - assertFalse(%IsAsmWasmCode(module)); -} diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js index 380bae356d..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js @@ -1,17 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -var builder = new WasmModuleBuilder(); -builder.addImportedTable("x", "table", 1, 10000000); -let module = new WebAssembly.Module(builder.toBuffer()); -let table = new WebAssembly.Table({element: "anyfunc", - initial: 1, maximum:1000000}); -let instance = new WebAssembly.Instance(module, {x: {table:table}}); - -assertThrows(() => table.grow(Infinity), RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js b/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js index a76ad017d9..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js @@ -1,19 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addFunction("foo", kSig_i_ii) - .addBody([ - kExprLoop, 00, - kExprBrTable, 0xfb, 0xff, 0xff, 0xff, - ]) - .exportFunc(); - assertThrows(function() { builder.instantiate(); }); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js index 1363f96264..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js @@ -1,22 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(1, 1, false); - builder.addFunction("foo", kSig_i_v) - .addBody([ - kExprI32Const, 0x00, - kExprI32Const, 0x0b, - kExprI32Const, 0x0f, - kExprBrTable, 0xcb, 0xcb, 0xcb, 0x00, 0x00, 0xcb, 0x00 // entries=1238475 - ]) - .exportFunc(); - assertThrows(function() { builder.instantiate(); }); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js index 2e56da853d..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js @@ -1,56 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function AddTest() { - let builder = new WasmModuleBuilder(); - - builder.addFunction("main", kSig_i_v) - .addBody([ - kExprBlock, kWasmStmt, - kExprI64Const, 0, - // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so - // that the 64-bit constant has a non-zero top half. In this bug, the - // top half was clobbering eax, leading to the function return 1 rather - // than 0. - kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10, - kExprI64Add, - kExprI64Eqz, - kExprBrIf, 0, - kExprI32Const, 0, - kExprReturn, - kExprEnd, - kExprI32Const, 0 - ]) - .exportFunc(); - let module = builder.instantiate(); - assertEquals(0, module.exports.main()); -})(); - -(function SubTest() { - let builder = new WasmModuleBuilder(); - - builder.addFunction("main", kSig_i_v) - .addBody([ - kExprBlock, kWasmStmt, - kExprI64Const, 0, - // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so - // that the 64-bit constant has a non-zero top half. In this bug, the - // top half was clobbering eax, leading to the function return 1 rather - // than 0. - kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10, - kExprI64Sub, - kExprI64Eqz, - kExprBrIf, 0, - kExprI32Const, 0, - kExprReturn, - kExprEnd, - kExprI32Const, 0 - ]) - .exportFunc(); - let module = builder.instantiate(); - assertEquals(0, module.exports.main()); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js index b193323dd1..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js @@ -1,30 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Flags: --expose-wasm - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let module1 = (() => { - let builder = new WasmModuleBuilder(); - builder.addMemory(1, 1); - builder.addFunction('load', kSig_i_i) - .addBody([kExprI32Const, 0, kExprI32LoadMem, 0, 0]) - .exportAs('load'); - return new WebAssembly.Module(builder.toBuffer()); -})(); - -let module2 = (() => { - let builder = new WasmModuleBuilder(); - builder.addMemory(1, 1); - builder.addImport('A', 'load', kSig_i_i); - builder.addExportOfKind('load', kExternalFunction, 0); - return new WebAssembly.Module(builder.toBuffer()); -})(); - -let instance1 = new WebAssembly.Instance(module1); -let instance2 = new WebAssembly.Instance(module2, {A: instance1.exports}); - -assertEquals(0, instance2.exports.load()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js index 8677f105ee..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js @@ -1,20 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(31, 31, false); - builder.addFunction('test', kSig_i_iii) - .addBodyWithEnd([ - // body: - kExprI64Const, 0x41, kExprI64Const, 0x41, kExprI64LtS, kExprI32Const, - 0x01, kExprI32StoreMem, 0x00, 0x41, kExprUnreachable, - kExprEnd, // @60 - ]) - .exportFunc(); - var module = builder.instantiate(); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js index 3035ea5249..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js @@ -1,19 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(31, 31, false); - builder.addFunction('test', kSig_l_v) - .addBodyWithEnd([ -// body: -kExprUnreachable, -kExprEnd, // @374 - ]) - .exportFunc(); - var module = builder.instantiate(); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js index b58c0d9b10..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js @@ -1,26 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { -var builder = new WasmModuleBuilder(); -builder.addFunction("regression_644682", kSig_i_v) - .addBody([ - kExprBlock, // @1 - kExprI32Const, 0x3b, - kExprI32LoadMem, 0x00, 0x00, - kExprI32Const, 0x10, - kExprBrIf, 0x01, 0x00, // arity=1 depth0 - kExprI32Const, 0x45, - kExprI32Const, 0x3b, - kExprI64LoadMem16S, 0x00, 0x3b, - kExprBrIf, 0x01, 0x00 // arity=1 depth0 - ]) - .exportFunc(); -assertThrows(function() { builder.instantiate(); }); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js index bf08200d30..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js @@ -1,24 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(1, 32, false); - builder.addFunction("foo", kSig_i_v) - .addBody([ - kExprMemorySize, kMemoryZero, - kExprI32Const, 0x10, - kExprMemoryGrow, kMemoryZero, - kExprI32Mul, - ]) - .exportFunc(); - var module = builder.instantiate(); - var result = module.exports.foo(); - assertEquals(1, result); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js index 871da72114..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js @@ -1,23 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(1, 1, false); - builder.addFunction("foo", kSig_i_v) - .addBody([ - kExprI32Const, 00, - kExprMemorySize, - kExprBrIf, 00, - kExprMemorySize, - kExprBr, 0xe7, 0xd2, 0xf2, 0xff, 0x1d - ]) - .exportFunc(); - assertThrows(function() { builder.instantiate(); }); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js index da3d7c7771..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js @@ -1,14 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - var module = builder.instantiate(); - assertTrue(typeof(module.exports) != "undefined"); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js index 68c880303b..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js @@ -1,389 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(0, 0, false); - builder.addFunction("test", kSig_i_iii) - .addBody([ -kExprI32Const, 0x0b, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x67, -kExprI32Const, 0x07, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Eq, -kExprI32RemU, -kExprI32Clz, -kExprI32Const, 0x25, -kExprI32Const, 0x82, 0x6c, -kExprI32Add, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Const, 0x70, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x70, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x67, -kExprI32Clz, -kExprI32Clz, -kExprI32GeS, -kExprI32Const, 0x67, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprDrop, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Const, 0x01, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprSelect, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x0e, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Const, 0x01, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprSelect, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x0e, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Const, 0x01, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprSelect, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x0e, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Const, 0x01, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprSelect, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x41, -kExprI32Const, 0x0e, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x4a, -kExprI32Const, 0x41, -kExprI32LtU, -kExprI32Const, 0x67, -kExprI32Clz, -kExprI32GtS, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Ne, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Const, 0x1a, -kExprI32Const, 0x71, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32ShrS, -kExprI32Clz, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprI32Clz, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Const, 0x4a, -kExprI32Const, 0x41, -kExprI32LtU, -kExprI32Const, 0x67, -kExprI32Clz, -kExprI32GtS, -kExprI32Const, 0x41, -kExprI32Const, 0x41, -kExprI32Ne, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Const, 0x41, -kExprI32Const, 0x1a, -kExprI32Const, 0x71, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32And, -kExprI32ShrS, -kExprI32Clz, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprI32Clz, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprI32Clz, -kExprUnreachable, -kExprCallFunction, 0x00, // function #0 -kExprCallFunction, 0x00, // function #0 -kExprNop, -kExprNop, -kExprNop, -kExprNop, -kExprReturn - ]) - .exportFunc(); - var module = builder.instantiate(); - assertTrue(module != undefined); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js index bfef7fcc8e..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js @@ -1,34 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var name = 'regression_684858'; - -function patchNameLength(buffer) { - var count = 0; - var view = new Uint8Array(buffer); - for (var i = 0, e = view.length - name.length; i <= e; ++i) { - var subs = String.fromCharCode.apply(null, view.slice(i, i + name.length)); - if (subs != name) continue; - ++count; - // One byte before this name, its length is encoded. - // Patch this to 127, making it out of bounds. - if (view.length >= 127) throw Error('cannot patch reliably'); - if (view[i - 1] != name.length) throw Error('unexpected length'); - view[i - 1] = 0x7f; - } - if (count != 1) throw Error('did not find name'); -} - -var builder = new WasmModuleBuilder(); -builder.addFunction(name, kSig_i_v) - .addBody([kExprI32Const, 2, kExprI32Const, 0, kExprI32DivU]) - .exportAs('main'); -var buffer = builder.toBuffer(); -patchNameLength(buffer); -var module = new WebAssembly.Module(buffer); -var instance = new WebAssembly.Instance(module); -assertThrows(() => instance.exports.main(), WebAssembly.RuntimeError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js index 02932b4812..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js @@ -1,42 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(16, 32, false); - builder.addFunction('test', kSig_i_i) - .addBodyWithEnd([ - kExprI32Const, 0x41, - kExprI32Const, 0x45, - kExprI32Const, 0x41, - kExprI32DivU, - kExprI32LoadMem8S, 0x00, 0x3a, - kExprI32Const, 0x75, - kExprI32Const, 0x75, - kExprI32Const, 0x6e, - kExprI32Eqz, - kExprI32LoadMem8S, 0x00, 0x3a, - kExprI32Add, - kExprI32DivU, - kExprI32LoadMem8S, 0x00, 0x74, - kExprI32And, - kExprI32Eqz, - kExprI32And, -kExprMemoryGrow, 0x00, - kExprI32Const, 0x55, - kExprI32LoadMem8S, 0x00, 0x3a, - kExprI32LoadMem16U, 0x00, 0x71, - kExprI32Const, 0x00, - kExprI32RemU, - kExprI32And, -kExprI32Eqz, -kExprEnd, // @44 - ]) - .exportFunc(); - var module = builder.instantiate(); - assertThrows(() => {module.exports.test(1);}); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js index 9a4989c633..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js @@ -1,25 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(16, 32, false); - builder.addFunction('test', kSig_i_i) - .addBodyWithEnd([ - kExprGetLocal, 0x00, - kExprI32Const, 0x29, - kExprI32Shl, - kExprI32Const, 0x18, - kExprI32ShrS, - kExprI32Const, 0x18, - kExprI32Shl, - kExprEnd, - ]) - .exportFunc(); - var module = builder.instantiate(); - assertEquals(0, module.exports.test(16)); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js index 364e95a680..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js @@ -1,30 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - - -// This test checks for accidental sign extension. The Wasm spec says we do -// arbitrary precision unsigned arithmetic to compute the memory address, -// meaning this test should do 0xfffffffc + 8, which is 0x100000004 and out of -// bounds. However, if we interpret 0xfffffffc as -4, then the result is 4 and -// succeeds erroneously. - - -(function() { - let builder = new WasmModuleBuilder(); - builder.addMemory(1, 1, false); - builder.addFunction('test', kSig_v_v) - .addBody([ - kExprI32Const, 0x7c, // address = -4 - kExprI32Const, 0, - kExprI32StoreMem, 0, 8, // align = 0, offset = 8 - ]) - .exportFunc(); - let module = builder.instantiate(); - - assertTraps(kTrapMemOutOfBounds, module.exports.test); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js index a44b14b031..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js @@ -1,22 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { -"use asm"; -var builder = new WasmModuleBuilder(); -builder.addMemory(0, 5, false); -builder.addFunction("regression_699485", kSig_i_v) - .addBody([ - kExprI32Const, 0x04, - kExprNop, - kExprMemoryGrow, 0x00, - ]).exportFunc(); -let module = builder.instantiate(); -assertEquals(0, module.exports.regression_699485()); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js index 44e60330b4..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js @@ -1,51 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -// Non-standard opcodes. -let kSig_s_v = makeSig([], [kWasmS128]); -let kExprS128LoadMem = 0xc0; - -(function() { -"use asm"; - var builder = new WasmModuleBuilder(); - builder.addFunction("regression_702460", kSig_i_v) - .addBody([ - kExprI32Const, 0x52, - kExprI32Const, 0x41, - kExprI32Const, 0x3c, - kExprI32Const, 0xdc, 0x01, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprSetLocal, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprMemoryGrow, 0x00, - kExprS128LoadMem, 0x00, 0x40, - kExprUnreachable, - kExprMemoryGrow, 0x00 - ]).exportFunc(); - assertThrows(() => builder.instantiate()); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js index 17d79c896f..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js @@ -1,20 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_i_iii) - .addBodyWithEnd([ - kExprI32Const, 0x07, // i32.const 7 - kExprI32Const, 0x00, // i32.const 0 - kExprI32Const, 0x00, // i32.const 0 - kExprI32And, // i32.and - kExprI32And, // i32.and - kExprEnd, // - - ]) - .exportFunc(); -var module = builder.instantiate(); -assertEquals(0, module.exports.test()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js index cd69c7d1b4..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js @@ -1,31 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_i_iii) - .addBodyWithEnd([ - kExprI32Const, 0x00, // i32.const 0 - kExprI32Const, 0x00, // i32.const 0 - kExprI32Add, // i32.add -> 0 - kExprI32Const, 0x00, // i32.const 0 - kExprI32Const, 0x00, // i32.const 0 - kExprI32Add, // i32.add -> 0 - kExprI32Add, // i32.add -> 0 - kExprI32Const, 0x01, // i32.const 1 - kExprI32Const, 0x00, // i32.const 0 - kExprI32Add, // i32.add -> 1 - kExprBlock, 0x7f, // @39 i32 - kExprI32Const, 0x00, // i32.const 0 - kExprBr, 0x00, // depth=0 - kExprEnd, // @90 - kExprI32Add, // i32.add -> 1 - kExprI32Add, // i32.add -> 1 - kExprEnd - ]) - .exportFunc(); -var module = builder.instantiate(); -assertEquals(1, module.exports.test()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js index b9ad1a0be4..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js @@ -1,54 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --expose-gc - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// Build two instances, instance 2 is interpreted, and calls instance 1 (via -// C_WASM_ENTRY), instance 1 then calls JS, which triggers GC. - -let builder1 = new WasmModuleBuilder(); - -function call_gc() { - print('Triggering GC.'); - gc(); - print('Survived GC.'); -} -let func1_sig = makeSig(new Array(8).fill(kWasmI32), [kWasmI32]); -let imp = builder1.addImport('q', 'gc', kSig_v_v); -let func1 = builder1.addFunction('func1', func1_sig) - .addBody([ - kExprGetLocal, 0, // - - kExprCallFunction, imp - ]) - .exportFunc(); -let instance1 = builder1.instantiate({q: {gc: call_gc}}); - -let builder2 = new WasmModuleBuilder(); - -let func1_imp = builder2.addImport('q', 'func1', func1_sig); -let func2 = builder2.addFunction('func2', kSig_i_i) - .addBody([ - kExprGetLocal, 0, // 1 - kExprGetLocal, 0, // 2 - kExprGetLocal, 0, // 3 - kExprGetLocal, 0, // 4 - kExprGetLocal, 0, // 5 - kExprGetLocal, 0, // 6 - kExprGetLocal, 0, // 7 - kExprGetLocal, 0, // 8 - kExprCallFunction, func1_imp - ]) - .exportFunc(); - -let instance2 = builder2.instantiate({q: {func1: instance1.exports.func1}}); - -%RedirectToWasmInterpreter( - instance2, parseInt(instance2.exports.func2.name)); - -// Call with 1. This will be passed by the C_WASM_ENTRY via the stack, and the -// GC will try to dereference it (before the bug fix). -instance2.exports.func2(1); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js index 10cd67ad8d..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js @@ -1,23 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -var builder = new WasmModuleBuilder(); - -builder.addExplicitSection([kFunctionSectionCode, - // length - 7, - // functions count - 1, - // signature index (invalid LEB) - 0xff, 0xff, 0xff, 0xff, 0xff]); -builder.addExplicitSection([kStartSectionCode, - // length - 1, - // index - 0]); - -assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js index 1ca0cb63fd..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js @@ -1,78 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --allow-natives-syntax - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let importingModuleBinary1 = (() => { - var builder = new WasmModuleBuilder(); - builder.addImport('', 'f', kSig_i_v); - return new Int8Array(builder.toBuffer()); -})(); - -let importingModuleBinary2 = (() => { - var builder = new WasmModuleBuilder(); - builder.addImport('', 'f', kSig_i_v); - builder.addFunction('g', kSig_v_v) - .addBody([kExprNop]); - return new Int8Array(builder.toBuffer()); -})(); - -let importingModuleBinary3 = (() => { - var builder = new WasmModuleBuilder(); - builder.addImport('', 'f', kSig_i_v); - builder.addImport('', 'f2', kSig_i_v); - builder.addFunction('g', kSig_v_v) - .addBody([kExprNop]); - return new Int8Array(builder.toBuffer()); -})(); - -let importingModuleBinary4 = (() => { - var builder = new WasmModuleBuilder(); - builder.addFunction('g', kSig_v_v) - .addBody([kExprNop]); - return new Int8Array(builder.toBuffer()); -})(); - -const complexImportingModuleBinary1 = (() => { - let builder = new WasmModuleBuilder(); - - builder.addImport('a', 'b', kSig_v_v); - builder.addImportedMemory('c', 'd', 1); - builder.addImportedTable('e', 'f', 1); - builder.addImportedGlobal('g', '⚡', kWasmI32); - builder.addFunction('g', kSig_v_v) - .addBody([kExprNop]); - return builder.toBuffer(); -})(); - -const complexImportingModuleBinary2 = (() => { - let builder = new WasmModuleBuilder(); - - builder.addImport('a', 'b', kSig_v_v); - builder.addImportedMemory('c', 'd', 1); - builder.addImportedTable('e', 'f', 1); - builder.addImportedGlobal('g', '⚡', kWasmI32); - builder.addFunction('g', kSig_v_v) - .addBody([kExprNop]); - return builder.toBuffer(); -})(); - -var tests = [ - importingModuleBinary1, - importingModuleBinary2, - importingModuleBinary3, - importingModuleBinary4, - complexImportingModuleBinary1, - complexImportingModuleBinary2 -]; - -for (var index in tests) { - assertPromiseResult( - WebAssembly.compile(tests[index]), - m => assertTrue(m instanceof WebAssembly.Module), - assertUnreachable); -} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js index 20c8154e4a..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js @@ -1,23 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - "use asm"; - var builder = new WasmModuleBuilder(); - builder.addMemory(0, 5, true); - builder.addFunction("regression_710844", kSig_v_v) - .addBody([ - kExprI32Const, 0x03, - kExprNop, - kExprMemoryGrow, 0x00, - kExprI32Const, 0x13, - kExprNop, - kExprI32StoreMem8, 0x00, 0x10 - ]).exportFunc(); - let instance = builder.instantiate(); - instance.exports.regression_710844(); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js index 46f274a8b0..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js @@ -1,30 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function() { - var builder = new WasmModuleBuilder(); - builder.addMemory(16, 32, false); - builder.addFunction("test", kSig_i_iii) - .addBodyWithEnd([ - // body: - kExprI64Const, 0, - kExprI64Const, 0x1, - kExprI64Clz, - kExprI64Sub, - kExprI64Const, 0x10, - kExprI64Const, 0x1b, - kExprI64Shl, - kExprI64Sub, - kExprI64Popcnt, - kExprI32ConvertI64, - kExprEnd, // @207 - ]) - .exportFunc(); - var module = builder.instantiate(); - const result = module.exports.test(1, 2, 3); - assertEquals(58, result); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js index 0954f807dd..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js @@ -1,13 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-interpret-all --wasm-lazy-compilation - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -var builder = new WasmModuleBuilder(); -builder.addFunction('f', kSig_v_v).addBody([]); -builder.addFunction('g', kSig_v_v).addBody([]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js index f6a96dc60d..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js @@ -1,16 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addFunction('f', kSig_v_v).addBody([ - kExprI32Const, 0, kExprBrTable, - // 0x80000000 in LEB: - 0x80, 0x80, 0x80, 0x80, 0x08, - // First break target. Creation of this node triggered the bug. - 0 -]); -assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js index 628d58f294..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js @@ -1,14 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// Flags: --wasm-max-mem-pages=49152 - -let builder = new WasmModuleBuilder(); -const num_pages = 49152; -builder.addMemory(num_pages, num_pages); -// num_pages * 64k (page size) > kMaxInt. -assertThrows(() => builder.instantiate(), RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js index 18834795d2..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js @@ -1,12 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let builder = new WasmModuleBuilder(); -builder.addFunction('f', kSig_i_v).addBody([kExprReturn]); -assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js index 2af403ce20..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js @@ -1,11 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addMemory(0, 0, true); -var instance = builder.instantiate(); -instance.exports.memory.buffer; diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js index 6b3f2faf5f..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js @@ -1,14 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addMemory(0, 0, false); -builder.addFunction('f', kSig_i_v) - .addBody([kExprMemorySize, kMemoryZero]) - .exportFunc(); -var instance = builder.instantiate(); -instance.exports.f(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js index f92d879a2e..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js @@ -1,18 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -{ - let builder = new WasmModuleBuilder(); - builder.addMemory(); - builder.exportMemoryAs("exported_mem"); - i1 = builder.instantiate(); -} -{ - let builder = new WasmModuleBuilder(); - builder.addImportedMemory("fil", "imported_mem"); - i2 = builder.instantiate({fil: {imported_mem: i1.exports.exported_mem}}); -} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js index 85a9ae7231..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js @@ -1,15 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let builder = new WasmModuleBuilder(); -builder.addCustomSection('BBBB', []); -builder.addCustomSection('AAAA', new Array(32).fill(0)); -let buffer = builder.toBuffer(); -// Shrink the buffer by 30 bytes (content of the unknown section named 'AAAA'). -buffer = buffer.slice(0, buffer.byteLength - 30); -// Instantiation should fail on the truncated buffer. -assertThrows(() => new WebAssembly.Module(buffer), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js index 57f98949f8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js @@ -1,16 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let builder = new WasmModuleBuilder(); -builder.addExplicitSection([ - kUnknownSectionCode, - // section length - 0x0f, - // name length: 0xffffffff - 0xf9, 0xff, 0xff, 0xff, 0x0f -]); -assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js index f55a06288e..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js @@ -1,28 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-gc - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -builder1 = new WasmModuleBuilder(); -builder1.addFunction('exp1', kSig_v_v).addBody([kExprUnreachable]).exportFunc(); - -builder2 = new WasmModuleBuilder(); -builder2.addImport('imp', 'imp', kSig_v_v); -builder2.addFunction('call_imp', kSig_v_v) - .addBody([kExprCallFunction, 0]) - .exportFunc(); - -export1 = builder1.instantiate().exports.exp1; -export2 = builder2.instantiate({imp: {imp: export1}}).exports.call_imp; -export1 = undefined; - -let a = [0]; -for (i = 0; i < 10; ++i) { - a = a.concat(new Array(i).fill(i)); - assertThrows(() => export2(), WebAssembly.RuntimeError); - gc(); -} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js index 748c74139f..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js @@ -1,29 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32); -builder.addFunction('grow', kSig_i_i).addBody([ - kExprGetLocal, 0, - kExprMemoryGrow, 0, -]).exportFunc(); -builder.addFunction('main', kSig_i_i).addBody([ - ...wasmI32Const(0x41), - kExprSetLocal, 0, - // Enter loop, such that values are spilled to the stack. - kExprLoop, kWasmStmt, - kExprEnd, - // Reload value. This must be loaded as 32 bit value. - kExprGetLocal, 0, - kExprI32LoadMem, 0, 0, -]).exportFunc(); -const instance = builder.instantiate(); -// Execute grow, such that the stack contains garbage data afterwards. -instance.exports.grow(1); -instance.exports.main(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js index 8e66295b70..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js @@ -1,31 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const exportingModuleBinary = (() => { - const builder = new WasmModuleBuilder(); - builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, 42]).exportFunc(); - return builder.toBuffer(); -})(); - -const exportingModule = new WebAssembly.Module(exportingModuleBinary); -const exportingInstance = new WebAssembly.Instance(exportingModule); - -const reExportingModuleBinary = (() => { - const builder = new WasmModuleBuilder(); - const gIndex = builder.addImport('a', 'g', kSig_i_v); - builder.addExport('y', gIndex); - return builder.toBuffer(); -})(); - -const module = new WebAssembly.Module(reExportingModuleBinary); -const imports = { - a: {g: exportingInstance.exports.f}, -}; -const instance = new WebAssembly.Instance(module, imports); - -// Previously exported Wasm functions are re-exported with the same value -assertEquals(instance.exports.y, exportingInstance.exports.f); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js index 033732f368..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js @@ -1,17 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let mem = new WebAssembly.Memory({initial: 0}); -let builder = new WasmModuleBuilder(); -builder.addImportedMemory("mod", "imported_mem"); -builder.addFunction('mem_size', kSig_i_v) - .addBody([kExprMemorySize, kMemoryZero]) - .exportFunc(); -let instance = builder.instantiate({mod: {imported_mem: mem}}); -instance.exports.mem_size(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js index 41f758efb1..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js @@ -1,33 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction(undefined, kSig_i_iii).addBody([ - // Return the sum of all arguments. - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kExprI32Add, kExprI32Add -]); -const sig = builder.addType(kSig_i_iii); -builder.addFunction(undefined, kSig_i_iii) - .addBody([ - ...wasmI32Const(1), // i32.const 0x1 - kExprSetLocal, 0, // set_local 0 - ...wasmI32Const(4), // i32.const 0x1 - kExprSetLocal, 1, // set_local 1 - ...wasmI32Const(16), // i32.const 0x1 - kExprSetLocal, 2, // set_local 2 - kExprLoop, kWasmStmt, // loop - kExprEnd, // end - kExprGetLocal, 0, // get_local 0 - kExprGetLocal, 1, // get_local 1 - kExprGetLocal, 2, // get_local 2 - kExprI32Const, 0, // i32.const 0 (func index) - kExprCallIndirect, sig, 0, // call indirect - ]) - .exportAs('main'); -builder.appendToTable([0]); -const instance = builder.instantiate(); -assertEquals(21, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js index c68d10f06d..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js @@ -1,35 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -let binary = new Binary; - -binary.emit_header(); -binary.emit_section(kTypeSectionCode, section => { - section.emit_u32v(1); // number of types - section.emit_u8(kWasmFunctionTypeForm); - section.emit_u32v(0); // number of parameters - section.emit_u32v(0); // number of returns -}); -binary.emit_section(kFunctionSectionCode, section => { - section.emit_u32v(1); // number of functions - section.emit_u32v(0); // type index -}); - -binary.emit_u8(kCodeSectionCode); -binary.emit_u8(0x02); // section length -binary.emit_u8(0x01); // number of functions -binary.emit_u8(0x40); // function body size -// Function body is missing here. - -let buffer = new ArrayBuffer(binary.length); -let view = new Uint8Array(buffer); -for (let i = 0; i < binary.length; i++) { - view[i] = binary[i] | 0; -} -WebAssembly.validate(buffer); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js index 52985c3297..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js @@ -1,33 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// Flags: --wasm-lazy-compilation - -let builder0 = new WasmModuleBuilder(); -builder0.setName('module_0'); -let sig_index = builder0.addType(kSig_i_v); -builder0.addFunction('main', kSig_i_i) - .addBody([ - kExprGetLocal, 0, // -- - kExprCallIndirect, sig_index, kTableZero - ]) // -- - .exportAs('main'); -builder0.setTableBounds(3, 3); -builder0.addExportOfKind('table', kExternalTable); -let module0 = new WebAssembly.Module(builder0.toBuffer()); -let instance0 = new WebAssembly.Instance(module0); - -let builder1 = new WasmModuleBuilder(); -builder1.setName('module_1'); -builder1.addFunction('main', kSig_i_v).addBody([kExprUnreachable]); -builder1.addImportedTable('z', 'table'); -builder1.addElementSegment(0, false, [0], true); -let module1 = new WebAssembly.Module(builder1.toBuffer()); -let instance1 = - new WebAssembly.Instance(module1, {z: {table: instance0.exports.table}}); -assertThrows( - () => instance0.exports.main(0), WebAssembly.RuntimeError, 'unreachable'); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js index 87896b4c35..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js @@ -1,27 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -sig = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -builder.addFunction(undefined, sig).addBody([kExprGetLocal, 4]); -builder.addMemory(16, 32); -builder.addFunction('main', sig) - .addBody([ - kExprI32Const, 0, kExprSetLocal, 0, - // Compute five arguments to the function call. - kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, - kExprGetLocal, 4, kExprI32Const, 1, kExprI32Add, - // Now some intermediate computation to force the arguments to be spilled - // to the stack: - kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add, kExprGetLocal, 1, - kExprGetLocal, 1, kExprI32Add, kExprI32Add, kExprDrop, - // Now call the function. - kExprCallFunction, 0 - ]) - .exportFunc(); -var instance = builder.instantiate(); -assertEquals(11, instance.exports.main(2, 4, 6, 8, 10)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js index 71f246decf..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js @@ -1,19 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32); -builder.addFunction(undefined, kSig_v_v).addBody([ - kExprI32Const, 0, // i32.const 0 - kExprI64LoadMem, 0, 0xff, 0xff, 0xff, 0xff, - 0x0f, // i64.load align=0 offset=0xffffffff - kExprDrop, // drop -]); -builder.addExport('main', 0); -const module = builder.instantiate(); -assertThrows( - () => module.exports.main(), WebAssembly.RuntimeError, /out of bounds/); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js index 7c07d2d7e3..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js @@ -1,21 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction(undefined, kSig_v_v).addLocals({i64_count: 1}).addBody([ - kExprI64Const, 0xeb, 0xd7, 0xaf, 0xdf, - 0xbe, 0xfd, 0xfa, 0xf5, 0x6b, // i64.const - kExprI32Const, 0, // i32.const - kExprIf, kWasmI32, // if i32 - kExprI32Const, 0, // i32.const - kExprElse, // else - kExprI32Const, 0, // i32.const - kExprEnd, // end - kExprBrIf, 0, // br_if depth=0 - kExprSetLocal, 0, // set_local 0 -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js index 15ee9a6c34..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js @@ -1,33 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -'use strict'; - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -var builder = new WasmModuleBuilder(); -builder.addImportedTable("x", "table", 1, 10000000); -builder.addFunction("main", kSig_i_i) - .addBody([ - kExprI32Const, 0, - kExprGetLocal, 0, - kExprCallIndirect, 0, kTableZero]) - .exportAs("main"); -let module = new WebAssembly.Module(builder.toBuffer()); -let table = new WebAssembly.Table({element: "anyfunc", - initial: 1, maximum:1000000}); -let instance = new WebAssembly.Instance(module, {x: {table:table}}); - -table.grow(0x40001); - -let instance2 = new WebAssembly.Instance(module, {x: {table:table}}); - -try { - instance2.exports.main(402982); // should be OOB -} catch (e) { - print("Correctly caught: ", e); -} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js index 055bfc0c59..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js @@ -1,20 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -sig0 = makeSig([], [kWasmI32]); -builder.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([ - kExprLoop, kWasmI32, // loop i32 - kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const 0 --> f32:0 - kExprGetLocal, 0x00, // get_local 0 --> i64:0 - kExprF32SConvertI64, // f32.sconvert/i64 --> f32:0 - kExprF32Ge, // f32.ge --> i32:1 - kExprEnd, // end -]); -builder.addExport('main', 0); -const module = builder.instantiate(); -assertEquals(1, module.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js index 218b090c45..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js @@ -1,20 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let builder = new WasmModuleBuilder(); -builder.addImport('','f', kSig_v_v); -builder.addExport('a', 0); -builder.addExport('b', 0); -var bytes = builder.toBuffer(); - -var m = new WebAssembly.Module(bytes); -assertTrue(m instanceof WebAssembly.Module); - -assertPromiseResult( - WebAssembly.compile(bytes) - .then(async_result => assertTrue(async_result instanceof WebAssembly.Module), - assertUnreachable)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js index 40cf12317f..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js @@ -1,62 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -// Generate function 1 (out of 2). -sig0 = makeSig([], [kWasmI32]); -builder.addFunction(undefined, sig0) - .addBody([ - kExprI64Const, 0xc8, 0xda, 0x9c, 0xbc, 0xf8, 0xf0, 0xe1, 0xc3, 0x87, 0x7f, - kExprLoop, kWasmF64, - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - kExprCallFunction, 0x01, - ...wasmF64Const(0), - kExprEnd, - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - ...wasmF64Const(0), - kExprCallFunction, 0x01, - kExprI64Const, 0xb9, 0xf2, 0xe4, 0x01, - kExprI64LtS]); -// Generate function 2 (out of 2). -sig1 = makeSig(new Array(12).fill(kWasmF64), []); -builder.addFunction(undefined, sig1).addBody([]); -builder.addExport('main', 0); -const instance = builder.instantiate(); -assertEquals(1, instance.exports.main()); - -const builder2 = new WasmModuleBuilder(); -sig0 = makeSig([], [kWasmI32]); -builder2.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([ - kExprLoop, kWasmI32, // loop i32 - kExprGetLocal, 0, // get_local 3 - kExprF32SConvertI64, // f32.sconvert/i64 - kExprI32ReinterpretF32, // i32.reinterpret/f32 - kExprEnd // end -]); -builder2.addExport('main', 0); -const instance2 = builder2.instantiate(); -assertEquals(0, instance2.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js index 476a0e18e8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js @@ -1,48 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addGlobal(kWasmI32, 1); -sig0 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -builder.addFunction(undefined, sig0) - .addBody([ -kExprF32Const, 0x01, 0x00, 0x00, 0x00, -kExprF32Const, 0x00, 0x00, 0x00, 0x00, -kExprF32Eq, // --> i32:0 -kExprF32Const, 0xc9, 0xc9, 0x69, 0xc9, -kExprF32Const, 0xc9, 0xc9, 0xc9, 0x00, -kExprF32Eq, // --> i32:0 i32:0 -kExprIf, kWasmF32, - kExprF32Const, 0x00, 0x00, 0x00, 0x00, -kExprElse, // @32 - kExprF32Const, 0x00, 0x00, 0x00, 0x00, - kExprEnd, // --> i32:0 f32:0 -kExprF32Const, 0xc9, 0x00, 0x00, 0x00, -kExprF32Const, 0xc9, 0xc9, 0xc9, 0x00, -kExprF32Const, 0xc9, 0xc9, 0xa0, 0x00, // --> i32:0 f32:0 f32 f32 f32 -kExprF32Eq, // --> i32:0 f32:0 f32 i32:0 -kExprIf, kWasmF32, - kExprF32Const, 0x00, 0x00, 0x00, 0x00, -kExprElse, - kExprF32Const, 0x00, 0x00, 0x00, 0x00, - kExprEnd, // --> i32:0 f32:0 f32 f32:0 -kExprF32Eq, // --> i32:0 f32:0 i32:0 -kExprIf, kWasmF32, - kExprF32Const, 0x00, 0x00, 0x00, 0x00, -kExprElse, - kExprF32Const, 0x00, 0x00, 0x00, 0x00, - kExprEnd, // --> i32:0 f32:0 f32:0 -kExprF32Const, 0xc9, 0xc9, 0xff, 0xff, // --> i32:0 f32:0 f32:0 f32 -kExprF32Eq, // --> i32:0 f32:0 i32:0 -kExprDrop, -kExprDrop, // --> i32:0 -kExprI32Const, 1, // --> i32:0 i32:1 -kExprI32GeU, // --> i32:0 - ]); -builder.addExport('main', 0); -const instance = builder.instantiate(); -assertEquals(0, instance.exports.main(1, 2, 3)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js index 1f90e0a017..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js @@ -1,22 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addMemory(0, 1234, false); -builder.addFunction('f', kSig_i_v) - .addBody([ - kExprI32Const, 0x1d, // -- - kExprMemoryGrow, 0x00, // -- - kExprI32LoadMem, 0x00, 0xff, 0xff, 0x45, // -- - ]) - .exportFunc(); - -var module = new WebAssembly.Module(builder.toBuffer()); -var instance1 = new WebAssembly.Instance(module); -instance1.exports.f(); -var instance2 = new WebAssembly.Instance(module); -instance2.exports.f(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js index faf74e1cff..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js @@ -1,15 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --no-experimental-wasm-simd - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let builder = new WasmModuleBuilder(); - builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0]) - .addLocals({s128_count: 1}); - - assertFalse(WebAssembly.validate(builder.toBuffer())); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js index d8a1ea1ebf..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js @@ -1,17 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --wasm-interpret-all - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - - __v_6 = new WasmModuleBuilder(); -__v_6.addFunction('exp1', kSig_i_i).addBody([kExprUnreachable]).exportFunc(); - __v_7 = new WasmModuleBuilder(); - __v_7.addImport('__v_11', '__v_11', kSig_i_i); -try { -; } catch(e) {; } - __v_8 = __v_6.instantiate().exports.exp1; - __v_9 = __v_7.instantiate({__v_11: {__v_11: __v_8}}).exports.call_imp; diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js index c2e783014a..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js @@ -1,17 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let builder = new WasmModuleBuilder(); -builder - .addMemory() - .addFunction("main", kSig_v_v) - .addBody([kExprI32Const, 4, - kExprI32Const, 8, - kExprI32StoreMem, 0, 16]) - .exportAs("main"); -let instance = builder.instantiate(); -assertTraps(kTrapMemOutOfBounds, instance.exports.main); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js index e1581fcdd8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js @@ -1,39 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --wasm-interpret-all - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -assertThrows(() => { - __v_29 = 0; -function __f_1() { - __v_19 = new WasmModuleBuilder(); - if (__v_25) { - __v_23 = __v_19.addImport('__v_24', '__v_30', __v_25); - } - if (__v_18) { - __v_19.addMemory(); - __v_19.addFunction('load', kSig_i_i) - .addBody([ 0]) - .exportFunc(); - } - return __v_19; -} - (function TestExternalCallBetweenTwoWasmModulesWithoutAndWithMemory() { - __v_21 = __f_1(__v_18 = false, __v_25 = kSig_i_i); - __v_21.addFunction('plus_one', kSig_i_i) - .addBody([ - kExprGetLocal, 0, // - - kExprCallFunction, __v_29 ]) - .exportFunc(); - __v_32 = - __f_1(__v_18 = true, __v_25 = undefined); - __v_31 = __v_32.instantiate(); try { __v_32[__getRandomProperty()] = __v_0; delete __v_18[__getRandomProperty()]; delete __v_34[__getRandomProperty()]; } catch(e) {; }; - __v_20 = __v_21.instantiate( - {__v_24: {__v_30: __v_31.exports.load}}); - __v_20.exports.plus_one(); __v_33 = __v_43; -})(); -}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js index 56e6f2ceb8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js @@ -1,33 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --wasm-interpret-all - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -assertThrows(() => { -let __v_50315 = 0; -function __f_15356(__v_50316, __v_50317) { - let __v_50318 = new WasmModuleBuilder(); - if (__v_50317) { - let __v_50319 = __v_50318.addImport('import_module', 'other_module_fn', kSig_i_i); - } - __v_50318.addMemory(); - __v_50318.addFunction('load', kSig_i_i).addBody([ 0, 0, 0]).exportFunc(); - return __v_50318; -} - (function __f_15357() { - let __v_50320 = __f_15356(__v_50350 = false, __v_50351 = kSig_i_i); - __v_50320.addFunction('plus_one', kSig_i_i).addBody([kExprGetLocal, 0, kExprCallFunction, __v_50315, kExprI32Const, kExprI32Add, kExprReturn]).exportFunc(); - let __v_50321 = __f_15356(); - let __v_50324 = __v_50321.instantiate(); - let __v_50325 = __v_50320.instantiate({ - import_module: { - other_module_fn: __v_50324.exports.load - } - }); - __v_50325.exports.plus_one(); - })(); -}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js index e8db923896..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js @@ -1,29 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); - -(function BadTypeSection() { - var data = bytes( - kWasmH0, - kWasmH1, - kWasmH2, - kWasmH3, - - kWasmV0, - kWasmV1, - kWasmV2, - kWasmV3, - - kTypeSectionCode, - 5, - 2, - 0x60, - 0, - 0, - 13 - ); - - assertFalse(WebAssembly.validate(data)); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js index 12d7e6b5da..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js @@ -1,44 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --experimental-wasm-anyref - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function testAnyRefNull() { - const builder = new WasmModuleBuilder(); - builder.addFunction('main', kSig_r_v) - .addBody([kExprRefNull]) - .exportFunc(); - - var wire_bytes = builder.toBuffer(); - var module = new WebAssembly.Module(wire_bytes); - var buffer = %SerializeWasmModule(module); - module = %DeserializeWasmModule(buffer, wire_bytes); - var instance = new WebAssembly.Instance(module); - - assertEquals(null, instance.exports.main()); -})(); - -(function testAnyRefIsNull() { - const builder = new WasmModuleBuilder(); - builder.addFunction('main', kSig_i_r) - .addBody([kExprGetLocal, 0, kExprRefIsNull]) - .exportFunc(); - - var wire_bytes = builder.toBuffer(); - var module = new WebAssembly.Module(wire_bytes); - var buffer = %SerializeWasmModule(module); - module = %DeserializeWasmModule(buffer, wire_bytes); - var instance = new WebAssembly.Instance(module); - - assertEquals(0, instance.exports.main({'hello' : 'world'})); - assertEquals(0, instance.exports.main(1234)); - assertEquals(0, instance.exports.main(0)); - assertEquals(0, instance.exports.main(123.4)); - assertEquals(0, instance.exports.main(undefined)); - assertEquals(1, instance.exports.main(null)); - assertEquals(0, instance.exports.main(print)); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js index 083f1d12e3..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js @@ -1,20 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --wasm-interpret-all - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - - -const builder = new WasmModuleBuilder(); - -const index = builder.addFunction("huge_frame", kSig_v_v) - .addBody([kExprCallFunction, 0]) - .addLocals({f64_count: 49555}).exportFunc().index; -// We assume above that the function we added has index 0. -assertEquals(0, index); - -const module = builder.instantiate(); -assertThrows(module.exports.huge_frame, RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js index a94f061c2b..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js @@ -1,33 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_i_iii) - .addBodyWithEnd([ - kExprI32Const, 0, // 0 - kExprI32Const, 0, // 0, 0 - kExprI32Add, // 0 + 0 -> 0 - kExprI32Const, 0, // 0, 0 - kExprI32Const, 0, // 0, 0, 0 - kExprI32Add, // 0, 0 + 0 -> 0 - kExprDrop, // 0 - kExprDrop, // - - kExprI32Const, 0, // 0 - kExprI32Const, 0, // 0, 0 - kExprI32Add, // 0 + 0 -> 0 - kExprI32Const, 0, // 0, 0 - kExprI32Const, 1, // 0, 0, 1 - kExprI32Add, // 0, 0 + 1 -> 1 - kExprBlock, kWasmStmt, // 0, 1 - kExprBr, 0, // 0, 1 - kExprEnd, // 0, 1 - kExprI32Add, // 0 + 1 -> 1 - kExprEnd - ]) - .exportFunc(); -var module = builder.instantiate(); -assertEquals(1, module.exports.test()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js index 8f1a79002c..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js @@ -1,25 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_v_v) - .addBodyWithEnd([ - kExprI32Const, 0x0, // const 0 - kExprI32Const, 0x0, // const 0 - kExprBrIf, 0x00, // br depth=0 - kExprLoop, 0x7f, // loop i32 - kExprBlock, 0x7f, // block i32 - kExprI32Const, 0x0, // const 0 - kExprBr, 0x00, // br depth=0 - kExprEnd, // end - kExprBr, 0x00, // br depth=0 - kExprEnd, // end - kExprUnreachable, // unreachable - kExprEnd, // end - ]) - .exportFunc(); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js index ede4668d08..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js @@ -1,18 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32, false); -builder.addFunction('main', kSig_i_v) - .addBody([ - ...wasmI32Const(10000), // i32.const 10000 - kExprMemoryGrow, 0, // grow_memory --> -1 - kExprI32Popcnt, // i32.popcnt --> 32 - ]) - .exportFunc(); -const instance = builder.instantiate(); -assertEquals(32, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js index cd6c4e2728..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js @@ -1,21 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_i_i) - .addBody([ - kExprGetLocal, 0x00, // get_local 0 - kExprBlock, kWasmStmt, // block - kExprBr, 0x00, // br depth=0 - kExprEnd, // end - kExprBlock, kWasmStmt, // block - kExprBr, 0x00, // br depth=0 - kExprEnd, // end - kExprBr, 0x00, // br depth=0 - ]) - .exportFunc(); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js index 8aa0241923..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js @@ -1,20 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_i_i) - .addBody([ - // body: - kExprGetLocal, 0, // get_local 0 - kExprGetLocal, 0, // get_local 0 - kExprLoop, kWasmStmt, // loop - kExprBr, 0, // br depth=0 - kExprEnd, // end - kExprUnreachable, // unreachable - ]) - .exportFunc(); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js index 6a4fd5c5f7..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js @@ -1,14 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// We need a module with one valid function. -const builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_v_v).addBody([]); - -const buffer = builder.toBuffer(); -assertPromiseResult( - WebAssembly.compile(buffer), _ => Realm.createAllowCrossRealmAccess()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js index 2d29997cef..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js @@ -1,15 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32); -builder.addFunction(undefined, kSig_i_iii).addBody([ - kExprI32Const, 0, // i32.const 0 - kExprI32LoadMem8S, 0, 0, // i32.load8_s offset=0 align=0 - kExprI32Eqz, // i32.eqz -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js index 1870d7e8f1..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js @@ -1,22 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// Flags: --print-wasm-code - -const builder = new WasmModuleBuilder(); -builder.addMemory(8, 16); -builder.addFunction(undefined, kSig_i_i).addBody([ - // wasm to wasm call. - kExprGetLocal, 0, kExprCallFunction, 0x1 -]); -builder.addFunction(undefined, kSig_i_i).addBody([ - // load from to create trap code. - kExprGetLocal, 0, kExprI32LoadMem, 0, - // unreachable to create a runtime call. - kExprUnreachable -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js index b56af694a9..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js @@ -1,11 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -let module = new WebAssembly.Module(builder.toBuffer()); -var worker = new Worker('onmessage = function() {};', {type: 'string'}); -worker.postMessage(module) diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js index 0b8decb637..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js @@ -1,22 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction(undefined, kSig_v_iii).addBody([ - kExprI32Const, 0x41, // i32.const 0x41 - kExprLoop, 0x7c, // loop f64 - kExprGetLocal, 0x00, // get_local 0 - kExprGetLocal, 0x01, // get_local 1 - kExprBrIf, 0x01, // br_if depth=1 - kExprGetLocal, 0x00, // get_local 0 - kExprI32Rol, // i32.rol - kExprBrIf, 0x00, // br_if depth=0 - kExprUnreachable, // unreachable - kExprEnd, // end - kExprUnreachable, // unreachable -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js index d3ab31b4c9..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js @@ -1,13 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -let module = new WebAssembly.Module(builder.toBuffer()); -var worker = new Worker('onmessage = function() {};', {type: 'string'}); -worker.postMessage(module) diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js index e7fa3aaa8f..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js @@ -1,27 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -let q_table = builder.addImportedTable("q", "table") -let q_base = builder.addImportedGlobal("q", "base", kWasmI32); -let q_fun = builder.addImport("q", "fun", kSig_v_v); -builder.addType(kSig_i_ii); -builder.addElementSegment(q_base, true, [ q_fun ]) -let module = new WebAssembly.Module(builder.toBuffer()); -let table = new WebAssembly.Table({ - element: "anyfunc", - initial: 10, -}); -let instance = new WebAssembly.Instance(module, { - q: { - base: 0, - table: table, - fun: () => (0) - } -}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js index c30ed152f8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js @@ -1,42 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --no-wasm-disable-structured-cloning - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function TestPostModule() { - let builder = new WasmModuleBuilder(); - builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) - .exportFunc(); - - let module = builder.toModule(); - - let workerScript = ` - onmessage = function(module) { - try { - let instance = new WebAssembly.Instance(module); - let result = instance.exports.add(40, 2); - postMessage(result); - } catch(e) { - postMessage('ERROR: ' + e); - } - } - `; - - let realm = Realm.create(); - Realm.shared = { m:module, s:workerScript }; - - let realmScript = ` - let worker = new Worker(Realm.shared.s, {type: 'string'}); - worker.postMessage(Realm.shared.m); - let message = worker.getMessage(); - worker.terminate(); - message; - `; - let message = Realm.eval(realm, realmScript); - assertEquals(42, message); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js index ae613ceb54..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js @@ -1,14 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction('test', kSig_i_i).addBody([kExprUnreachable]); -let module = new WebAssembly.Module(builder.toBuffer()); -var worker = new Worker('onmessage = function() {};', {type: 'string'}); -worker.postMessage(module); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js index bcf8469a14..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js @@ -1,67 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// The number of locals must be greater than the constant defined here: -// https://cs.chromium.org/chromium/src/v8/src/compiler/x64/code-generator-x64.cc?l=3146 -const kNumLocals = 128; - -function varuint32(val) { - let bytes = []; - for (let i = 0; i < 4; ++i) { - bytes.push(0x80 | ((val >> (7 * i)) & 0x7f)); - } - bytes.push((val >> (7 * 4)) & 0x7f); - return bytes; -} - -// Generate a function that calls the "get" import `kNumLocals` times, and -// stores each result in a local, then calls the "call" import `kNumLocals` -// times with the stored local values. -// -// The intention is to create a function that has a large stack frame. -let body = []; - -for (let i = 0; i < kNumLocals; ++i) { - body.push(kExprCallFunction, 0, kExprSetLocal, ...varuint32(i)); -} - -for (let i = 0; i < kNumLocals; ++i) { - body.push(kExprGetLocal, ...varuint32(i), kExprCallFunction, 1); -} - -let builder = new WasmModuleBuilder(); -builder.addImport('mod', 'get', kSig_i_v); -builder.addImport('mod', 'call', kSig_v_i); -builder. - addFunction('main', kSig_v_v). - addLocals({i32_count: kNumLocals}). - addBody(body). - exportAs('main'); -let m1_bytes = builder.toBuffer(); -let m1 = new WebAssembly.Module(m1_bytes); - -// Serialize the module and postMessage it to another thread. -let serialized_m1 = %SerializeWasmModule(m1); - -let worker_onmessage = function(msg) { - let {serialized_m1, m1_bytes} = msg; - - let m1_clone = %DeserializeWasmModule(serialized_m1, m1_bytes); - let imports = {mod: {get: () => 3, call: () => {}}}; - let i2 = new WebAssembly.Instance(m1_clone, imports); - i2.exports.main(); - postMessage('done'); -} -let workerScript = "onmessage = " + worker_onmessage.toString(); - -let worker = new Worker(workerScript, {type: 'string'}); -worker.postMessage({serialized_m1, m1_bytes}); - -// Wait for worker to finish. -print(worker.getMessage()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js index ecf6476c37..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js @@ -1,28 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --throws - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); -let kTableSize = 3; - -var builder = new WasmModuleBuilder(); -var sig_index1 = builder.addType(kSig_i_v); -builder.addFunction('main', kSig_i_ii).addBody([ - kExprGetLocal, - 0, - kExprCallIndirect, - sig_index1, - kTableZero -]).exportAs('main'); -builder.setTableBounds(kTableSize, kTableSize); -var m1_bytes = builder.toBuffer(); -var m1 = new WebAssembly.Module(m1_bytes); - -var serialized_m1 = %SerializeWasmModule(m1); -var m1_clone = %DeserializeWasmModule(serialized_m1, m1_bytes); -var i1 = new WebAssembly.Instance(m1_clone); - -i1.exports.main(123123); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js index a35d583a4a..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js @@ -1,30 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --experimental-wasm-eh - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -// Instantiate a throwing module. -var builder = new WasmModuleBuilder(); -builder.addException(kSig_v_v); -builder.addFunction("propel", kSig_v_v) - .addBody([kExprThrow, 0]) - .exportFunc(); -var instance = builder.instantiate(); - -// Catch the exception. -var exception; -try { - instance.exports.propel(); -} catch (e) { - exception = e; -} - -// Check that the exception is an instance of the correct error function and -// that no extraneous properties exist. Setting such properties could be -// observable by JavaScript and could break compatibility. -assertInstanceof(exception, WebAssembly.RuntimeError); -assertArrayEquals(["stack", "message"], Object.getOwnPropertyNames(exception)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js index 66ffc0d4b7..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js @@ -1,25 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --experimental-wasm-eh - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -// Prepare a special error object to throw. -var error = new Error("my error"); -error.__proto__ = new Proxy(new Error(), { - has(target, property, receiver) { - assertUnreachable(); - } -}); - -// Throw it through a WebAssembly module. -var builder = new WasmModuleBuilder(); -builder.addImport('mod', 'fun', kSig_v_v); -builder.addFunction("funnel", kSig_v_v) - .addBody([kExprCallFunction, 0]) - .exportFunc(); -var instance = builder.instantiate({ mod: {fun: function() { throw error }}}); -assertThrows(instance.exports.funnel, Error); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js index 979b769bbc..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js @@ -1,16 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction(undefined, kSig_d_v).addBody([ - ...wasmF64Const(0), // f64.const 0 - ...wasmF64Const(0), // f64.const 0 - ...wasmI32Const(0), // i32.const 0 - kExprBrIf, 0x00, // br_if depth=0 - kExprF64Add // f64.add -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js index 2cf50892fc..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js @@ -1,25 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder1 = new WasmModuleBuilder(); -builder1.addFunction('mul', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Mul]) - .exportFunc(); -const mul = builder1.instantiate().exports.mul; -const table = new WebAssembly.Table({ - element: 'anyfunc', - initial: 10, -}); -const builder2 = new WasmModuleBuilder(); -const mul_import = builder2.addImport('q', 'wasm_mul', kSig_i_ii); -builder2.addImportedTable('q', 'table'); -const glob_import = builder2.addImportedGlobal('q', 'glob', kWasmI32); -builder2.addElementSegment(glob_import, true, [mul_import]); -builder2.instantiate( - {q: {glob: 0, js_div: i => i, wasm_mul: mul, table: table}}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js index f2606fb610..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js @@ -1,12 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -var builder = new WasmModuleBuilder(); -builder.addFunction(undefined, kSig_i_i) - .addLocals({i32_count: 0xffffffff}) - .addBody([]); -assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js index 224a2260f5..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js @@ -1,21 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32); -builder.addGlobal(kWasmI32, 0); -const sig0 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -builder.addFunction(undefined, sig0).addBody([ - kExprI32Const, 1, // i32.const 1 - kExprI32Const, 0, // i32.const 0 - kExprI32Const, 3, // i32.const 3 - kExprI32GeU, // i32.ge_u - kExprI32Rol, // i32.rol -]); -builder.addExport('main', 0); -const instance = builder.instantiate(); -assertEquals(1, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js index 18ca3d0b5d..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js @@ -1,20 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -let chain = Promise.resolve(); -const builder = new WasmModuleBuilder(); -for (let i = 0; i < 50; ++i) { - builder.addFunction('fun' + i, kSig_i_v) - .addBody([...wasmI32Const(i)]) - .exportFunc(); -} -const buffer = builder.toBuffer(); -for (let i = 0; i < 100; ++i) { - chain = chain.then(() => WebAssembly.instantiate(buffer)); -} -chain.then(({module, instance}) => instance.exports.fun1155()) - .then(res => print('Result of executing fun1155: ' + res)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js index a1f9a1bea8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js @@ -1,9 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -PAGES = 10; -memory = new WebAssembly.Memory({initial: PAGES}); -buffer = memory.buffer; -memory.grow(); -WebAssembly.validate(buffer); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js index 699549d429..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js @@ -1,10 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -PAGES = 10; -memory = new WebAssembly.Memory({initial: PAGES}); -buffer = memory.buffer; -buffer = new Uint8Array(buffer); -memory.grow(); -WebAssembly.validate(buffer); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js index c06e0fae96..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js @@ -1,22 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -try { - (function () { - let m = new WasmModuleBuilder(); - m.addFunction("sub", kSig_i_ii) - m.instantiate(); - })(); -} catch (e) { - console.info("caught exception"); - console.info(e); -} -for (let i = 0; i < 150; i++) { - var m = new WasmModuleBuilder(); - m.addMemory(2); - m.instantiate(); -} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js index 65d1213dd0..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js @@ -1,22 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-interpret-all - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -const builder = new WasmModuleBuilder(); -const sig = builder.addType(kSig_i_i); -builder.addFunction('call', kSig_i_v) - .addBody([ - kExprI32Const, 0, kExprI32Const, 0, kExprCallIndirect, sig, kTableZero - ]) - .exportAs('call'); -builder.addImportedTable('imp', 'table'); -const table = new WebAssembly.Table({element: 'anyfunc', initial: 1}); -const instance = builder.instantiate({imp: {table: table}}); -assertThrows( - () => instance.exports.call(), WebAssembly.RuntimeError, - /function signature mismatch/); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js index 378e38e03c..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js @@ -1,49 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-lazy-compilation - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -(function ExportedFunctionsImportedOrder() { - print(arguments.callee.name); - - let i1 = (() => { - let builder = new WasmModuleBuilder(); - builder.addFunction("f1", kSig_i_v) - .addBody( - [kExprI32Const, 1]) - .exportFunc(); - builder.addFunction("f2", kSig_i_v) - .addBody( - [kExprI32Const, 2]) - .exportFunc(); - return builder.instantiate(); - })(); - - let i2 = (() => { - let builder = new WasmModuleBuilder(); - builder.addImport("q", "f2", kSig_i_v); - builder.addImport("q", "f1", kSig_i_v); - builder.addFunction("main", kSig_i_i) - .addBody([ - kExprGetLocal, 0, - kExprCallIndirect, 0, kTableZero - ]) - .exportFunc(); - builder.addElementSegment(0, false, [0, 1, 1, 0]); - - return builder.instantiate({q: {f2: i1.exports.f2, f1: i1.exports.f1}}); - })(); - - print("--->calling 0"); - assertEquals(2, i2.exports.main(0)); - print("--->calling 1"); - assertEquals(1, i2.exports.main(1)); - print("--->calling 2"); - assertEquals(1, i2.exports.main(2)); - print("--->calling 3"); - assertEquals(2, i2.exports.main(3)); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js index 9161f098e0..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js @@ -1,30 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-interpret-all - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -let instance; -(function DoTest() { - function call_main() { - instance.exports.main(); - } - let module = new WasmModuleBuilder(); - module.addImport('mod', 'func', kSig_v_i); - module.addFunction('main', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) - .exportFunc(); - instance = module.instantiate({ - mod: { - func: call_main - } - }); - try { - instance.exports.main(); - } catch (e) { - // ignore - } -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js index dac0e8578d..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js @@ -1,20 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// flags: --wasm-lazy-compilation - -load("test/mjsunit/wasm/wasm-constants.js"); -load("test/mjsunit/wasm/wasm-module-builder.js"); - -var module = new WasmModuleBuilder(); -module.addMemory(); -module.addFunction("main", kSig_v_v) - .addBody([ - kExprI32Const, 20, - kExprI32Const, 29, - kExprMemoryGrow, kMemoryZero, - kExprI32StoreMem, 0, 0xFF, 0xFF, 0x7A]) - .exportAs("main"); -var instance = module.instantiate(); -assertTraps(kTrapMemOutOfBounds, instance.exports.main); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js index b37dbea628..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js @@ -1,20 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32); -builder.addFunction("test", kSig_i_v).addBody([ - kExprI32Const, 12, // i32.const 0 -]); - -let module = new WebAssembly.Module(builder.toBuffer()); -module.then = () => { - // Use setTimeout to get out of the promise chain. - setTimeout(assertUnreachable); -}; - -WebAssembly.instantiate(module); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js index 9dcc299ecf..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js @@ -1,18 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32); -builder.addFunction("test", kSig_i_v).addBody([ - kExprI32Const, 12, // i32.const 12 -]); - -WebAssembly.Module.prototype.then = resolve => { - assertUnreachable(); -}; - -WebAssembly.instantiate(builder.toBuffer()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js index 0887401336..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js @@ -1,21 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// Also enable predictable mode. Otherwise, concurrent recompilation will be -// enabled, and the code generator will not try to print the InliningStack -// (see CodeGenerator::AssembleSourcePosition). -// These preconditions make this test quite fragile, but it's the only way -// currently to reproduce the crash. -// Flags: --code-comments --predictable --print-wasm-code - -const builder = new WasmModuleBuilder(); -// Add a call instruction, because the segfault happens when processing source -// positions. -builder.addFunction('foo', kSig_v_v).addBody([]); -builder.addFunction('test', kSig_v_v).addBody([kExprCallFunction, 0]); - -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js index 83f5c9d4b8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js @@ -1,35 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --no-wasm-trap-handler - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -(function() { - const builder = new WasmModuleBuilder(); - builder.addMemory(16, 32); - // Generate function 1 (out of 1). - sig1 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); - builder.addFunction(undefined, sig1) - .addBodyWithEnd([ - // signature: i_iii - // body: - kExprI32Const, 0xe1, 0xc8, 0xd5, 0x01, - kExprI32Const, 0xe2, 0xe4, 0x00, - kExprI32Sub, - kExprF32Const, 0x00, 0x00, 0x00, 0x00, - kExprF32Const, 0xc9, 0xc9, 0xc9, 0x00, - kExprF32Eq, - kExprI32LoadMem, 0x01, 0xef, 0xec, 0x95, 0x93, 0x07, - kExprI32Add, - kExprIf, kWasmStmt, // @30 - kExprEnd, // @32 - kExprI32Const, 0xc9, 0x93, 0xdf, 0xcc, 0x7c, - kExprEnd, // @39 - ]); - builder.addExport('main', 0); - const instance = builder.instantiate(); - assertTraps(kTrapMemOutOfBounds, _ => instance.exports.main(1, 2, 3)); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js index 8c18cfa7a9..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js @@ -1,20 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -sig1 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -const imp_idx = builder.addImport('q', 'imp', kSig_i_i); -builder.addExport('exp', imp_idx); -const module = builder.toModule(); - -function bad(a, b, c, d, e, f, g, h) { - print(JSON.stringify([a, b, c, d, e, f, g, h])); -} -const instance1 = new WebAssembly.Instance(module, {q: {imp: bad}}); -const instance2 = new WebAssembly.Instance(module, {q: {imp: i => i}}); - -print(instance1.exports.exp(5)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js index ebc97a95b4..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js @@ -1,204 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm --wasm-math-intrinsics --validate-asm --allow-natives-syntax - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -function verbose(args) { - // print(...args); -} - -//============================================= -// Global count of failures -//============================================= -let numFailures = 0; - -function reportFailure(name, vals, m, w) { - print(" error: " + name + "(" + vals + ") == " + w + ", expected " + m); - numFailures++; -} - -let global_imports = {Math: Math}; - -let inputs = [ - 1 / 0, - -1 / 0, - 0 / 0, - -2.70497e+38, - -1.4698e+37, - -1.22813e+35, - -1.34584e+34, - -1.0079e+32, - -6.49364e+26, - -3.06077e+25, - -1.46821e+25, - -1.17658e+23, - -1.9617e+22, - -2.7357e+20, - -9223372036854775808.0, // INT64_MIN - -1.48708e+13, - -1.89633e+12, - -4.66622e+11, - -2.22581e+11, - -1.45381e+10, - -2147483904.0, // First float32 after INT32_MIN - -2147483648.0, // INT32_MIN - -2147483520.0, // Last float32 before INT32_MIN - -1.3956e+09, - -1.32951e+09, - -1.30721e+09, - -1.19756e+09, - -9.26822e+08, - -5.09256e+07, - -964300.0, - -192446.0, - -28455.0, - -27194.0, - -20575.0, - -17069.0, - -9167.0, - -960.178, - -113.0, - -62.0, - -15.0, - -7.0, - -1.0, - -0.0256635, - -4.60374e-07, - -3.63759e-10, - -4.30175e-14, - -5.27385e-15, - -1.5707963267948966, - -1.48084e-15, - -2.220446049250313e-16, - -1.05755e-19, - -3.2995e-21, - -1.67354e-23, - -1.11885e-23, - -1.78506e-30, - -1.43718e-34, - -1.27126e-38, - -0.0, - 3e-88, - -2e66, - 0.0, - 2e66, - 1.17549e-38, - 1.56657e-37, - 4.08512e-29, - 6.25073e-22, - 4.1723e-13, - 1.44343e-09, - 1.5707963267948966, - 5.27004e-08, - 9.48298e-08, - 5.57888e-07, - 4.89988e-05, - 0.244326, - 1.0, - 12.4895, - 19.0, - 47.0, - 106.0, - 538.324, - 564.536, - 819.124, - 7048.0, - 12611.0, - 19878.0, - 20309.0, - 797056.0, - 1.77219e+09, - 2147483648.0, // INT32_MAX + 1 - 4294967296.0, // UINT32_MAX + 1 - 1.51116e+11, - 4.18193e+13, - 3.59167e+16, - 9223372036854775808.0, // INT64_MAX + 1 - 18446744073709551616.0, // UINT64_MAX + 1 - 3.38211e+19, - 2.67488e+20, - 1.78831e+21, - 9.20914e+21, - 8.35654e+23, - 1.4495e+24, - 5.94015e+25, - 4.43608e+30, - 2.44502e+33, - 1.38178e+37, - 1.71306e+37, - 3.31899e+38, - 3.40282e+38, -]; - -function assertBinop(name, math_func, wasm_func) { - let inputs2 = [ 1, 0.5, -1, -0.5, 0, -0, 1/0, -1/0, 0/0 ]; - for (val of inputs) { - verbose(" ", val); - for (val2 of inputs2) { - verbose(" ", val2); - let m = math_func(val, val2); - let w = wasm_func(val, val2); - if (!deepEquals(m, w)) reportFailure(name, [val, val2], m, w); - m = math_func(val2, val); - w = wasm_func(val2, val); - if (!deepEquals(m, w)) reportFailure(name, [val2, val], m, w); - } - } -} - -let stdlib = this; -function Module_exp(stdlib) { - "use asm"; - - var Stdlib = stdlib.Math.exp; - - function NAME(a, b) { - a = +a; - b = +b; - return +Stdlib(a, b); - } - - return {exp: exp}; -} - -function wasmBinop(name, sig) { - var builder = new WasmModuleBuilder(); - - var sig_index = builder.addType(sig); - builder.addImport('Math', name, sig_index); - builder.addFunction('main', sig_index) - .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- - kExprCallFunction, 0 - ]) // -- - .exportAs('main'); - - return builder.instantiate(global_imports).exports.main; -} - -function asmBinop(name) { - let instance = Module_exp(stdlib); - assertTrue(%IsAsmWasmCode(Module_exp)); - - let asm_func = instance[name]; - if (typeof asm_func != "function") throw "asm[" + full_name + "] not found"; - return asm_func; -} - -(function TestF64() { - let name = 'exp'; - let math_func = Math[name]; - - let wasm_func = wasmBinop(name, kSig_d_dd); - assertBinop("(f64)" + name, math_func, wasm_func); - - let asm_func = asmBinop(name); - assertBinop("(f64)" + name, math_func, asm_func); -})(); - -assertEquals(0, numFailures); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js index 5d782b747c..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js @@ -1,85 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --wasm-shared-engine --no-wasm-disable-structured-cloning --allow-natives-syntax --experimental-wasm-threads - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - - -// In this test we start a worker which enters wasm and stays there in a loop. -// The main thread stays in JS and checks that its thread-in-wasm flag is not -// set. The main thread calls setTimeout after every check to give the worker a -// chance to be scheculed. -const sync_address = 12; -(function TestPostModule() { - let builder = new WasmModuleBuilder(); - let sig_index = builder.addType(kSig_v_v); - let import_id = builder.addImport('m', 'func', sig_index); - builder.addFunction('wait', kSig_v_v) - .addBody([ - // Calling the imported function sets the thread-in-wasm flag of the - // main thread. - kExprCallFunction, import_id, // -- - kExprLoop, kWasmStmt, // -- - kExprI32Const, sync_address, // -- - kExprI32LoadMem, 0, 0, // -- - kExprI32Eqz, - kExprBrIf, 0, // -- - kExprEnd, - ]) - .exportFunc(); - - builder.addFunction('signal', kSig_v_v) - .addBody([ - kExprI32Const, sync_address, // -- - kExprI32Const, 1, // -- - kExprI32StoreMem, 0, 0, // -- - ]) - .exportFunc(); - builder.addImportedMemory("m", "imported_mem", 0, 1, "shared"); - - let module = builder.toModule(); - let memory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true}); - - let workerScript = ` - onmessage = function(msg) { - try { - let worker_instance = new WebAssembly.Instance(msg.module, - {m: {imported_mem: msg.memory, - func: _ => 5}}); - postMessage("start running"); - worker_instance.exports.wait(); - postMessage("finished"); - } catch(e) { - postMessage('ERROR: ' + e); - } - } - `; - - let worker = new Worker(workerScript, {type: 'string'}); - worker.postMessage({module: module, memory: memory}); - - let main_instance = new WebAssembly.Instance( - module, {m: {imported_mem: memory, func: _ => 7}}); - - let counter = 0; - function CheckThreadNotInWasm() { - // We check the thread-in-wasm flag many times and reschedule ourselves in - // between to increase the chance that we read the flag set by the worker. - assertFalse(%IsThreadInWasm()); - counter++; - if (counter < 100) { - setTimeout(CheckThreadNotInWasm, 0); - } else { - main_instance.exports.signal(sync_address); - assertEquals('finished', worker.getMessage()); - worker.terminate(); - } - } - - assertFalse(%IsThreadInWasm()); - assertEquals('start running', worker.getMessage()); - CheckThreadNotInWasm(); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js index 11863368f3..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js @@ -1,47 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction('main', kSig_d_d) - .addBody([ - // Call with param 0 (converted to i64), to fill the stack with non-zero - // values. - kExprGetLocal, 0, kExprI64SConvertF64, // arg 0 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 1 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 2 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 3 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 4 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 5 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 6 - kExprGetLocal, 0, kExprI64SConvertF64, // arg 7 - kExprCallFunction, 1, // call #1 - // Now call with 0 constants. - // The bug was that they were written out as i32 values, thus the upper 32 - // bit were the previous values on that stack memory. - kExprI64Const, 0, // i64.const 0 [0] - kExprI64Const, 0, // i64.const 0 [1] - kExprI64Const, 0, // i64.const 0 [2] - kExprI64Const, 0, // i64.const 0 [3] - kExprI64Const, 0, // i64.const 0 [4] - kExprI64Const, 0, // i64.const 0 [5] - kExprI64Const, 0, // i64.const 0 [6] - kExprI64Const, 0, // i64.const 0 [7] - kExprCallFunction, 1, // call #1 - // Return the sum of the two returned values. - kExprF64Add - ]) - .exportFunc(); -builder.addFunction(undefined, makeSig(new Array(8).fill(kWasmI64), [kWasmF64])) - .addBody([ - kExprGetLocal, 7, // get_local 7 (last parameter) - kExprF64SConvertI64, // f64.convert_s/i64 - ]); -const instance = builder.instantiate(); -const big_num_1 = 2 ** 48; -const big_num_2 = 2 ** 56 / 3; -assertEquals(big_num_1, instance.exports.main(big_num_1)); -assertEquals(big_num_2, instance.exports.main(big_num_2)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js index e2146ca365..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js @@ -1,28 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], [])) - .addLocals({i32_count: 7}) - .addBody([ - kExprGetLocal, 0, // get_local - kExprI32Const, 0, // i32.const 0 - kExprIf, kWasmStmt, // if - kExprUnreachable, // unreachable - kExprEnd, // end if - kExprGetLocal, 4, // get_local - kExprTeeLocal, 8, // tee_local - kExprBrIf, 0, // br_if depth=0 - kExprTeeLocal, 7, // tee_local - kExprTeeLocal, 0, // tee_local - kExprTeeLocal, 2, // tee_local - kExprTeeLocal, 8, // tee_local - kExprDrop, // drop - kExprLoop, kWasmStmt, // loop - kExprEnd, // end loop - ]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js index 822c06750a..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js @@ -1,62 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --liftoff --no-wasm-tier-up --no-future --wasm-tier-mask-for-testing=2 - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(1, 1); -// First function is Liftoff. The first parameter is used as memory offset. -builder.addFunction(undefined, kSig_v_i).addBody([ - kExprGetLocal, 0, // get_local 0 - kExprI32Const, 0, // i32.const 0 - kExprI32StoreMem, 0, 0, // i32.store offset=0 -]); -// Second function is Turbofan. It loads the sixth parameter from the stack -// into a register for the first argument. Even though it's a 32-bit value, it -// is loaded as 64-bit value on x64. -builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), [])) - .addBody([ - kExprGetLocal, 5, // get_local 5 - kExprCallFunction, 0 // call 0 - ]); -// The third function is Liftoff again. A value is spilled on the stack as i32, -// then used as a call argument, passed via the stack. The full 64-bit are -// copied on the stack, even though just 32-bit were written before. Hence, the -// stack slot is not zero-extended. -const gen_i32_code = [ - kExprTeeLocal, 0, // tee_local 0 - kExprGetLocal, 0, // get_local 0 - kExprI32Const, 1, // i32.const 1 - kExprI32Add // i32.add --> 2nd param -]; -builder.addFunction(undefined, kSig_v_v).addLocals({i32_count: 1}).addBody([ - // Generate six values on the stack, then six more to force the other six on - // the stack. - ...wasmI32Const(0), // i32.const 0 - ...wasmI32Const(1), // i32.const 1 - kExprI32Add, // i32.add --> 1st param - ...gen_i32_code, // --> 2nd param - ...gen_i32_code, // --> 3rd param - ...gen_i32_code, // --> 4th param - ...gen_i32_code, // --> 5th param - ...gen_i32_code, // --> 6th param - ...gen_i32_code, // --> garbage - ...gen_i32_code, // --> garbage - ...gen_i32_code, // --> garbage - ...gen_i32_code, // --> garbage - ...gen_i32_code, // --> garbage - ...gen_i32_code, // --> garbage - kExprDrop, // drop garbage - kExprDrop, // drop garbage - kExprDrop, // drop garbage - kExprDrop, // drop garbage - kExprDrop, // drop garbage - kExprDrop, // drop garbage - kExprCallFunction, 1 // call 1 -]).exportAs('three'); -const instance = builder.instantiate(); -instance.exports.three(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js index e1ea426f87..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js @@ -1,19 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// Flags: --expose-wasm --experimental-wasm-mv - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -(function() { - const builder = new WasmModuleBuilder(); - // Generate function 1 (out of 2). - sig1 = makeSig([kWasmI32], []); - builder.addFunction("main", sig1).addBodyWithEnd([ - // signature: v_i - // body: - kExprBlock, - ]); - assertThrows(function() { builder.instantiate(); }, WebAssembly.CompileError); -})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js index 5aef9eba86..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js @@ -1,16 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -const sig = makeSig([kWasmI32, kWasmI64, kWasmI64], [kWasmI64]); -builder.addFunction(undefined, sig) - .addBody([ - kExprGetLocal, 2, - kExprGetLocal, 1, - kExprI64Shl, -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js index fb9cb3b4fe..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js @@ -1,20 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addMemory(16, 32, false); -const sig = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -builder.addFunction(undefined, sig) - .addBodyWithEnd([ - kExprMemorySize, 0, - kExprI32Const, 0, - kExprI64Const, 0, - kExprI64StoreMem8, 0, 0, - kExprEnd, - ]); -builder.addExport('main', 0); -builder.instantiate(); // shouldn't crash diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js index 7c8f154496..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js @@ -1,37 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addGlobal(kWasmI32, 1); -builder.addGlobal(kWasmF32, 1); -builder.addType(makeSig([kWasmI32, kWasmF32, kWasmF32, kWasmF64], [kWasmI32])); -builder.addFunction(undefined, 0 /* sig */) - .addLocals({i32_count: 504}) - .addBody([ -kExprGetGlobal, 0x00, -kExprSetLocal, 0x04, -kExprGetLocal, 0x04, -kExprI32Const, 0x01, -kExprI32Sub, -kExprGetGlobal, 0x00, -kExprI32Const, 0x00, -kExprI32Eqz, -kExprGetGlobal, 0x00, -kExprI32Const, 0x01, -kExprI32Const, 0x01, -kExprI32Sub, -kExprGetGlobal, 0x00, -kExprI32Const, 0x00, -kExprI32Eqz, -kExprGetGlobal, 0x00, -kExprI32Const, 0x00, -kExprI32Const, 0x01, -kExprI32Sub, -kExprGetGlobal, 0x01, -kExprUnreachable, -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js index c12013c9f8..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js @@ -1,17 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -builder.addFunction('main', kSig_v_v).addBody([ - kExprLoop, kWasmStmt, // loop - /**/ kExprBr, 0x01, // br depth=1 - /**/ kExprBlock, kWasmStmt, // block - /**/ /**/ kExprBr, 0x02, // br depth=2 - /**/ /**/ kExprEnd, // end [block] - /**/ kExprEnd // end [loop] -]); -builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js index 6acd5d68d7..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js @@ -1,14 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -const builder = new WasmModuleBuilder(); -const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32])); -builder.addFunction('main', sig) - .addBody([kExprI32Const, 0x01, kExprI32SExtendI8]) - .exportFunc(); -const instance = builder.instantiate(); -assertEquals(1, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js b/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js index 491aad8c1e..e69de29bb2 100644 --- a/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js +++ b/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js @@ -1,36 +0,0 @@ -// Copyright 2018 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --trace-turbo --trace-turbo-graph -// Flags: --trace-turbo-cfg-file=test/mjsunit/tools/turbo.cfg -// Flags: --trace-turbo-path=test/mjsunit/tools - -load('test/mjsunit/wasm/wasm-constants.js'); -load('test/mjsunit/wasm/wasm-module-builder.js'); - -// The idea behind this test is to make sure we do not crash when using the -// --trace-turbo flag given different sort of inputs, JS or WASM. - -(function testOptimizedJS() { - function add(a, b) { - return a + b; - } - - add(21, 21); - %OptimizeFunctionOnNextCall(add); - add(20, 22); -})(); - -(function testWASM() { - let builder = new WasmModuleBuilder(); - - builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, - kExprI32Add]) - .exportFunc(); - - let instance = builder.instantiate(); - instance.exports.add(21, 21); -})(); diff --git a/implementation-contributed/v8/wasm-js/wasm-js.status b/implementation-contributed/v8/wasm-js/wasm-js.status index 856a50aed0..e69de29bb2 100644 --- a/implementation-contributed/v8/wasm-js/wasm-js.status +++ b/implementation-contributed/v8/wasm-js/wasm-js.status @@ -1,30 +0,0 @@ -# Copyright 2018 the V8 project authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -[ -[ALWAYS, { - # https://bugs.chromium.org/p/v8/issues/detail?id=8319 - 'memory/grow': [FAIL], - 'table/grow': [FAIL], - 'table/get-set': [FAIL], - 'module/customSections': [FAIL], -}], # ALWAYS - -[ALWAYS, { - # https://bugs.chromium.org/p/v8/issues/detail?id=8633 - 'limits': [SKIP], -}], # ALWAYS - -['arch == s390 or arch == s390x or system == aix', { - # https://bugs.chromium.org/p/v8/issues/detail?id=8402 - 'instance/constructor': [SKIP], -}], # 'arch == s390 or arch == s390x or system == aix' - -############################################################################## -['lite_mode', { - # TODO(v8:7777): Re-enable once wasm is supported in jitless mode. - '*': [SKIP], -}], # lite_mode - -] From 39d5434ab161a37fe61d5d41016c02148aaf5ecd Mon Sep 17 00:00:00 2001 From: test262-automation Date: Mon, 4 Feb 2019 19:41:17 +0000 Subject: [PATCH 2/2] [v8-test262-automation] Updated curation log with latest revision sha's from export and changed files. sourceRevisionAtLastExport: f85a3554 targetRevisionAtLastExport: 6bb8f41e0a --- .../curation_logs/v8.json | 4 +- .../v8/intl/bigint/tolocalestring.js | 61 + .../constructor-date-style-order.js | 108 ++ .../constructor-date-time-style-order.js | 109 ++ .../constructor-date-time-style.js | 33 + .../date-format/constructor-no-style-order.js | 114 ++ .../constructor-time-style-order.js | 108 ++ .../property-override-date-style.js | 54 + .../property-override-date-time-style.js | 59 + .../property-override-time-style.js | 54 + .../v8/intl/regress-7770.js | 8 + .../v8/intl/regress-925216.js | 10 + .../v8/intl/relative-time-format/format-en.js | 2 - .../format-to-parts-en.js | 12 +- .../format-to-parts-plural.js | 26 + .../relative-time-format/format-to-parts.js | 80 + .../v8/intl/relative-time-format/format.js | 80 + .../relative-time-format/resolved-options.js | 162 ++ .../relative-time-format/supported-locale.js | 18 + .../v8/intl/segmenter/check-lb-option.js | 29 + .../v8/intl/segmenter/constructor-order.js | 20 + .../v8/intl/segmenter/constructor.js | 190 +++ .../v8/intl/segmenter/segment-iterator.js | 15 + .../v8/mjsunit/array-sort.js | 21 + .../v8/mjsunit/compiler/regress-924151.js | 28 + .../v8/mjsunit/es6/for-each-in-catch.js | 196 +++ .../v8/mjsunit/es6/proxies-ownkeys.js | 94 ++ .../v8/mjsunit/es6/typedarray-sort.js | 151 ++ .../v8/mjsunit/es8/object-entries.js | 24 +- .../object-get-own-property-descriptors.js | 220 +++ .../v8/mjsunit/es8/object-values.js | 278 ++++ .../mjsunit/for-of-in-catch-duplicate-decl.js | 5 + .../v8/mjsunit/harmony/array-flat-species.js | 29 + .../v8/mjsunit/harmony/array-flat.js | 63 + .../mjsunit/harmony/array-flatMap-species.js | 29 + .../v8/mjsunit/harmony/array-flatMap.js | 162 ++ .../v8/mjsunit/harmony/weakrefs/basics.js | 140 ++ .../cleanup-doesnt-iterate-all-holdings.js | 49 +- .../weakrefs/cleanup-from-different-realm.js | 34 + .../weakrefs/cleanup-is-a-microtask.js | 56 + .../cleanup-proxy-from-different-realm.js | 34 + .../weakrefs/cleanupsome-after-unregister.js | 22 +- .../mjsunit/harmony/weakrefs/cleanupsome.js | 23 +- ...finalization-group-keeps-holdings-alive.js | 21 +- .../weakrefs/finalizationgroup-and-weakref.js | 19 +- ...up-scheduled-for-cleanup-multiple-times.js | 38 +- .../harmony/weakrefs/iterating-in-cleanup.js | 30 +- .../multiple-dirty-finalization-groups.js | 24 +- .../harmony/weakrefs/undefined-holdings.js | 39 + .../weakrefs/unregister-after-cleanup.js | 30 +- .../weakrefs/unregister-before-cleanup.js | 19 +- .../weakrefs/unregister-called-twice.js | 40 + .../weakrefs/unregister-inside-cleanup1.js | 24 +- .../weakrefs/unregister-inside-cleanup2.js | 20 +- .../weakrefs/unregister-inside-cleanup3.js | 27 +- .../weakrefs/unregister-inside-cleanup4.js | 48 + .../harmony/weakrefs/unregister-many.js | 50 + ...register-when-cleanup-already-scheduled.js | 14 +- .../harmony/weakrefs/weak-cell-basics.js | 37 + .../v8/mjsunit/integrity-level-map-update.js | 166 +++ .../v8/mjsunit/messages.js | 7 - .../v8/mjsunit/mjsunit.js | 44 +- .../v8/mjsunit/mjsunit.status | 1162 +++++++++++++++ .../v8/mjsunit/regress/regress-3218530.js | 39 + .../v8/mjsunit/regress/regress-3255.js | 19 + .../v8/mjsunit/regress/regress-336820.js | 37 + .../v8/mjsunit/regress/regress-5888.js | 75 + .../v8/mjsunit/regress/regress-5911.js | 31 + .../v8/mjsunit/regress/regress-6711.js | 21 + .../v8/mjsunit/regress/regress-687.js | 74 + .../v8/mjsunit/regress/regress-813440.js | 16 + .../v8/mjsunit/regress/regress-863810.js | 18 + .../v8/mjsunit/regress/regress-8708.js | 10 + .../v8/mjsunit/regress/regress-923723.js | 14 + .../v8/mjsunit/regress/regress-926036.js | 5 + .../mjsunit/regress/regress-crbug-715455.js | 25 + .../mjsunit/regress/regress-crbug-772056.js | 16 + .../mjsunit/regress/regress-crbug-923264.js | 27 + .../mjsunit/regress/regress-crbug-923265.js | 9 + .../mjsunit/regress/regress-crbug-923705.js | 15 + .../mjsunit/regress/regress-crbug-926819.js | 5 + .../mjsunit/regress/regress-crbug-926856.js | 18 + .../mjsunit/regress/wasm/loop-stack-check.js | 18 + .../v8/mjsunit/regress/wasm/regress-02256.js | 1 - .../v8/mjsunit/regress/wasm/regress-5531.js | 21 + .../v8/mjsunit/regress/wasm/regress-5800.js | 55 + .../v8/mjsunit/regress/wasm/regress-5860.js | 29 + .../v8/mjsunit/regress/wasm/regress-5884.js | 19 + .../v8/mjsunit/regress/wasm/regress-6054.js | 1 - .../v8/mjsunit/regress/wasm/regress-6164.js | 18 + .../v8/mjsunit/regress/wasm/regress-644682.js | 25 + .../v8/mjsunit/regress/wasm/regress-648079.js | 1 - .../v8/mjsunit/regress/wasm/regress-651961.js | 23 + .../v8/mjsunit/regress/wasm/regress-654377.js | 22 + .../v8/mjsunit/regress/wasm/regress-663994.js | 13 + .../v8/mjsunit/regress/wasm/regress-667745.js | 388 +++++ .../v8/mjsunit/regress/wasm/regress-684858.js | 33 + .../v8/mjsunit/regress/wasm/regress-688876.js | 41 + .../v8/mjsunit/regress/wasm/regress-689450.js | 24 + .../v8/mjsunit/regress/wasm/regress-6931.js | 29 + .../v8/mjsunit/regress/wasm/regress-699485.js | 21 + .../v8/mjsunit/regress/wasm/regress-702460.js | 50 + .../v8/mjsunit/regress/wasm/regress-7033.js | 19 + .../v8/mjsunit/regress/wasm/regress-7035.js | 30 + .../v8/mjsunit/regress/wasm/regress-7049.js | 53 + .../v8/mjsunit/regress/wasm/regress-708714.js | 22 + .../v8/mjsunit/regress/wasm/regress-709684.js | 77 + .../v8/mjsunit/regress/wasm/regress-710844.js | 22 + .../v8/mjsunit/regress/wasm/regress-711203.js | 29 + .../mjsunit/regress/wasm/regress-715216b.js | 12 + .../v8/mjsunit/regress/wasm/regress-722445.js | 15 + .../v8/mjsunit/regress/wasm/regress-724846.js | 13 + .../v8/mjsunit/regress/wasm/regress-724851.js | 11 + .../v8/mjsunit/regress/wasm/regress-724972.js | 10 + .../v8/mjsunit/regress/wasm/regress-727222.js | 13 + .../v8/mjsunit/regress/wasm/regress-727560.js | 17 + .../v8/mjsunit/regress/wasm/regress-729991.js | 14 + .../v8/mjsunit/regress/wasm/regress-734246.js | 15 + .../v8/mjsunit/regress/wasm/regress-734345.js | 27 + .../v8/mjsunit/regress/wasm/regress-7353.js | 28 + .../v8/mjsunit/regress/wasm/regress-7364.js | 30 + .../v8/mjsunit/regress/wasm/regress-736584.js | 16 + .../v8/mjsunit/regress/wasm/regress-7366.js | 32 + .../v8/mjsunit/regress/wasm/regress-737069.js | 34 + .../v8/mjsunit/regress/wasm/regress-739768.js | 32 + .../v8/mjsunit/regress/wasm/regress-7422.js | 26 + .../v8/mjsunit/regress/wasm/regress-7499.js | 18 + .../v8/mjsunit/regress/wasm/regress-7508.js | 20 + .../v8/mjsunit/regress/wasm/regress-752423.js | 32 + .../v8/mjsunit/regress/wasm/regress-7565.js | 19 + .../v8/mjsunit/regress/wasm/regress-757217.js | 19 + .../v8/mjsunit/regress/wasm/regress-7579.js | 61 + .../v8/mjsunit/regress/wasm/regress-7582.js | 47 + .../v8/mjsunit/regress/wasm/regress-763439.js | 21 + .../v8/mjsunit/regress/wasm/regress-763697.js | 14 + .../v8/mjsunit/regress/wasm/regress-766003.js | 16 + .../v8/mjsunit/regress/wasm/regress-769637.js | 16 + .../v8/mjsunit/regress/wasm/regress-771243.js | 38 + .../v8/mjsunit/regress/wasm/regress-772332.js | 32 + .../v8/mjsunit/regress/wasm/regress-775366.js | 29 + .../v8/mjsunit/regress/wasm/regress-7785.js | 43 + .../v8/mjsunit/regress/wasm/regress-778917.js | 19 + .../v8/mjsunit/regress/wasm/regress-782280.js | 32 + .../v8/mjsunit/regress/wasm/regress-784050.js | 24 + .../v8/mjsunit/regress/wasm/regress-7914.js | 17 + .../v8/mjsunit/regress/wasm/regress-791810.js | 20 + .../v8/mjsunit/regress/wasm/regress-793551.js | 19 + .../v8/mjsunit/regress/wasm/regress-797846.js | 13 + .../v8/mjsunit/regress/wasm/regress-800756.js | 14 + .../v8/mjsunit/regress/wasm/regress-801785.js | 21 + .../v8/mjsunit/regress/wasm/regress-801850.js | 10 + .../v8/mjsunit/regress/wasm/regress-802244.js | 21 + .../v8/mjsunit/regress/wasm/regress-803427.js | 12 + .../v8/mjsunit/regress/wasm/regress-803788.js | 26 + .../v8/mjsunit/regress/wasm/regress-8059.js | 41 + .../v8/mjsunit/regress/wasm/regress-808012.js | 13 + .../v8/mjsunit/regress/wasm/regress-808848.js | 66 + .../v8/mjsunit/regress/wasm/regress-808980.js | 27 + .../v8/mjsunit/regress/wasm/regress-8094.js | 29 + .../v8/mjsunit/regress/wasm/regress-8095.js | 24 + .../v8/mjsunit/regress/wasm/regress-812005.js | 15 + .../v8/mjsunit/regress/wasm/regress-817380.js | 24 + .../v8/mjsunit/regress/wasm/regress-819869.js | 11 + .../v8/mjsunit/regress/wasm/regress-820802.js | 20 + .../v8/mjsunit/regress/wasm/regress-824681.js | 19 + .../mjsunit/regress/wasm/regress-825087a.js | 9 + .../mjsunit/regress/wasm/regress-825087b.js | 10 + .../v8/mjsunit/regress/wasm/regress-827806.js | 21 + .../v8/mjsunit/regress/wasm/regress-831463.js | 21 + .../v8/mjsunit/regress/wasm/regress-834619.js | 48 + .../v8/mjsunit/regress/wasm/regress-834624.js | 29 + .../v8/mjsunit/regress/wasm/regress-834693.js | 19 + .../v8/mjsunit/regress/wasm/regress-836141.js | 19 + .../v8/mjsunit/regress/wasm/regress-837417.js | 17 + .../v8/mjsunit/regress/wasm/regress-840757.js | 20 + .../v8/mjsunit/regress/wasm/regress-842501.js | 34 + .../v8/mjsunit/regress/wasm/regress-843563.js | 19 + .../v8/mjsunit/regress/wasm/regress-8505.js | 203 +++ .../v8/mjsunit/regress/wasm/regress-8533.js | 84 ++ .../v8/mjsunit/regress/wasm/regress-854011.js | 46 + .../v8/mjsunit/regress/wasm/regress-854050.js | 27 + .../v8/mjsunit/regress/wasm/regress-864509.js | 61 + .../v8/mjsunit/regress/wasm/regress-875556.js | 18 + .../v8/mjsunit/regress/wasm/regress-894307.js | 15 + .../v8/mjsunit/regress/wasm/regress-894374.js | 19 + .../v8/mjsunit/regress/wasm/regress-910824.js | 36 + .../v8/mjsunit/regress/wasm/regress-913804.js | 16 + .../v8/mjsunit/regress/wasm/regress-916869.js | 13 + .../v8/mjsunit/regress/wasm/regress-922670.js | 31 + .../v8/mjsunit/regress/wasm/regress-922933.js | 51 + .../v8/mjsunit/regress/wasm/regress-924843.js | 16 + .../v8/mjsunit/regress/wasm/regress-924905.js | 17 + .../v8/mjsunit/regress/wasm/regress-925671.js | 12 + .../v8/mjsunit/tools/compiler-trace-flags.js | 35 + .../v8/mjsunit/ubsan-fuzzerbugs.js | 19 + .../v8/test262/test262.status | 1326 +++++++++++++++++ .../v8/test262/testcfg.py | 3 - .../v8/wasm-js/wasm-js.status | 23 + 198 files changed, 9831 insertions(+), 244 deletions(-) create mode 100644 implementation-contributed/v8/intl/bigint/tolocalestring.js create mode 100644 implementation-contributed/v8/intl/date-format/constructor-date-style-order.js create mode 100644 implementation-contributed/v8/intl/date-format/constructor-date-time-style-order.js create mode 100644 implementation-contributed/v8/intl/date-format/constructor-date-time-style.js create mode 100644 implementation-contributed/v8/intl/date-format/constructor-no-style-order.js create mode 100644 implementation-contributed/v8/intl/date-format/constructor-time-style-order.js create mode 100644 implementation-contributed/v8/intl/date-format/property-override-date-style.js create mode 100644 implementation-contributed/v8/intl/date-format/property-override-date-time-style.js create mode 100644 implementation-contributed/v8/intl/date-format/property-override-time-style.js create mode 100644 implementation-contributed/v8/intl/regress-7770.js create mode 100644 implementation-contributed/v8/intl/regress-925216.js create mode 100644 implementation-contributed/v8/mjsunit/compiler/regress-924151.js create mode 100644 implementation-contributed/v8/mjsunit/for-of-in-catch-duplicate-decl.js create mode 100644 implementation-contributed/v8/mjsunit/harmony/weakrefs/undefined-holdings.js create mode 100644 implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-called-twice.js create mode 100644 implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js create mode 100644 implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-many.js create mode 100644 implementation-contributed/v8/mjsunit/integrity-level-map-update.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-6711.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-8708.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-923723.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-926036.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-crbug-923264.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-crbug-923265.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-crbug-923705.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-crbug-926819.js create mode 100644 implementation-contributed/v8/mjsunit/regress/regress-crbug-926856.js create mode 100644 implementation-contributed/v8/mjsunit/regress/wasm/regress-922670.js create mode 100644 implementation-contributed/v8/mjsunit/regress/wasm/regress-922933.js create mode 100644 implementation-contributed/v8/mjsunit/regress/wasm/regress-924843.js create mode 100644 implementation-contributed/v8/mjsunit/regress/wasm/regress-924905.js create mode 100644 implementation-contributed/v8/mjsunit/regress/wasm/regress-925671.js create mode 100644 implementation-contributed/v8/mjsunit/ubsan-fuzzerbugs.js diff --git a/implementation-contributed/curation_logs/v8.json b/implementation-contributed/curation_logs/v8.json index b7e11fb57a..6aac27be26 100644 --- a/implementation-contributed/curation_logs/v8.json +++ b/implementation-contributed/curation_logs/v8.json @@ -1,5 +1,5 @@ { - "sourceRevisionAtLastExport": "f85a3554", - "targetRevisionAtLastExport": "6bb8f41e0a", + "sourceRevisionAtLastExport": "ddf72e4b", + "targetRevisionAtLastExport": "8d9f7690f8", "curatedFiles": {} } \ No newline at end of file diff --git a/implementation-contributed/v8/intl/bigint/tolocalestring.js b/implementation-contributed/v8/intl/bigint/tolocalestring.js new file mode 100644 index 0000000000..d0b6792ea8 --- /dev/null +++ b/implementation-contributed/v8/intl/bigint/tolocalestring.js @@ -0,0 +1,61 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-bigint + +var locales = [ + "en", // "1,234,567,890,123,456" + "de", // "1.234.567.890.123.456" + "fr", // "1 234 567 890 123 456" + "hi", // "1,23,45,67,89,01,23,456" + "fa", // "۱٬۲۳۴٬۵۶۷٬۸۹۰٬۱۲۳٬۴۵۶" + "th-u-nu-thai", // "๑,๒๓๔,๕๖๗,๘๙๐,๑๒๓,๔๕๖" +]; + +var data = [ + Number.MAX_SAFE_INTEGER, + -Number.MAX_SAFE_INTEGER, + Math.floor(Number.MAX_SAFE_INTEGER / 2), + 0, + /// -0, // this case is broken now. +]; + +for (var locale of locales) { + let nf = new Intl.NumberFormat(locale); + + let percentOption = {style: "percent"}; + let nfPercent = new Intl.NumberFormat(locale, percentOption); + for (var n of data) { + let bigint = BigInt(n); + // Test NumberFormat w/ number output the same as + // BigInt.prototype.toLocaleString() + assertEquals(nf.format(n), bigint.toLocaleString(locale)); + + // Test NumberFormat output the same regardless pass in as number or BigInt + assertEquals(nf.format(n), nf.format(bigint)); + + // Test formatToParts + assertEquals(nf.formatToParts(n), nf.formatToParts(bigint)); + + // Test output with option + // Test NumberFormat w/ number output the same as + // BigInt.prototype.toLocaleString() + assertEquals(nfPercent.format(n), + bigint.toLocaleString(locale, percentOption)); + + // Test NumberFormat output the same regardless pass in as number or BigInt + assertEquals(nfPercent.format(n), nfPercent.format(bigint)); + assertEquals(nfPercent.formatToParts(n), nfPercent.formatToParts(bigint)); + } + + // Test very big BigInt + let veryBigInt = BigInt(Number.MAX_SAFE_INTEGER) * + BigInt(Number.MAX_SAFE_INTEGER) * + BigInt(Number.MAX_SAFE_INTEGER); + assertEquals(nf.format(veryBigInt), veryBigInt.toLocaleString(locale)); + // It should output different than toString + assertFalse(veryBigInt.toLocaleString(locale) == veryBigInt.toString()); + assertTrue(veryBigInt.toLocaleString(locale).length > + veryBigInt.toString().length); +} diff --git a/implementation-contributed/v8/intl/date-format/constructor-date-style-order.js b/implementation-contributed/v8/intl/date-format/constructor-date-style-order.js new file mode 100644 index 0000000000..8e601b48d3 --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/constructor-date-style-order.js @@ -0,0 +1,108 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; +let weekday = new Array(); +let year = new Array(); +let month = new Array(); +let day = new Array(); +let hour = new Array(); +let minute = new Array(); +let second = new Array(); +let localeMatcher = new Array(); +let hour12 = new Array(); +let hourCycle = new Array(); +let dateStyle = new Array(); +let timeStyle = new Array(); +let timeZone = new Array(); +let era = new Array(); +let timeZoneName = new Array(); +let formatMatcher = new Array(); + +new Intl.DateTimeFormat(['en-US'], { + get weekday() { + weekday.push(++getCount); + }, + get year() { + year.push(++getCount); + }, + get month() { + month.push(++getCount); + }, + get day() { + day.push(++getCount); + }, + get hour() { + hour.push(++getCount); + }, + get minute() { + minute.push(++getCount); + }, + get second() { + second.push(++getCount); + }, + get localeMatcher() { + localeMatcher.push(++getCount); + }, + get hour12() { + hour12.push(++getCount); + }, + get hourCycle() { + hourCycle.push(++getCount); + }, + get timeZone() { + timeZone.push(++getCount); + }, + get dateStyle() { + dateStyle.push(++getCount); + return "full"; + }, + get timeStyle() { + timeStyle.push(++getCount); + }, + get era() { + era.push(++getCount); + }, + get timeZoneName() { + timeZoneName.push(++getCount); + }, + get formatMatcher() { + formatMatcher.push(++getCount); + } +}); + +assertEquals(1, weekday.length); +assertEquals(1, weekday[0]); +assertEquals(1, year.length); +assertEquals(2, year[0]); +assertEquals(1, month.length); +assertEquals(3, month[0]); +assertEquals(1, day.length); +assertEquals(4, day[0]); +assertEquals(1, hour.length); +assertEquals(5, hour[0]); +assertEquals(1, minute.length); +assertEquals(6, minute[0]); +assertEquals(1, second.length); +assertEquals(7, second[0]); +assertEquals(1, localeMatcher.length); +assertEquals(8, localeMatcher[0]); +assertEquals(1, hour12.length); +assertEquals(9, hour12[0]); +assertEquals(1, hourCycle.length); +assertEquals(10, hourCycle[0]); +assertEquals(1, timeZone.length); +assertEquals(11, timeZone[0]); +assertEquals(1, dateStyle.length); +assertEquals(12, dateStyle[0]); +assertEquals(1, timeStyle.length); +assertEquals(13, timeStyle[0]); +assertEquals(0, era.length); +assertEquals(0, timeZoneName.length); +assertEquals(0, formatMatcher.length); diff --git a/implementation-contributed/v8/intl/date-format/constructor-date-time-style-order.js b/implementation-contributed/v8/intl/date-format/constructor-date-time-style-order.js new file mode 100644 index 0000000000..d4d114662f --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/constructor-date-time-style-order.js @@ -0,0 +1,109 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; +let weekday = new Array(); +let year = new Array(); +let month = new Array(); +let day = new Array(); +let hour = new Array(); +let minute = new Array(); +let second = new Array(); +let localeMatcher = new Array(); +let hour12 = new Array(); +let hourCycle = new Array(); +let dateStyle = new Array(); +let timeStyle = new Array(); +let timeZone = new Array(); +let era = new Array(); +let timeZoneName = new Array(); +let formatMatcher = new Array(); + +new Intl.DateTimeFormat(['en-US'], { + get weekday() { + weekday.push(++getCount); + }, + get year() { + year.push(++getCount); + }, + get month() { + month.push(++getCount); + }, + get day() { + day.push(++getCount); + }, + get hour() { + hour.push(++getCount); + }, + get minute() { + minute.push(++getCount); + }, + get second() { + second.push(++getCount); + }, + get localeMatcher() { + localeMatcher.push(++getCount); + }, + get hour12() { + hour12.push(++getCount); + }, + get hourCycle() { + hourCycle.push(++getCount); + }, + get timeZone() { + timeZone.push(++getCount); + }, + get dateStyle() { + dateStyle.push(++getCount); + return "full"; + }, + get timeStyle() { + timeStyle.push(++getCount); + return "full"; + }, + get era() { + era.push(++getCount); + }, + get timeZoneName() { + timeZoneName.push(++getCount); + }, + get formatMatcher() { + formatMatcher.push(++getCount); + } +}); + +assertEquals(1, weekday.length); +assertEquals(1, weekday[0]); +assertEquals(1, year.length); +assertEquals(2, year[0]); +assertEquals(1, month.length); +assertEquals(3, month[0]); +assertEquals(1, day.length); +assertEquals(4, day[0]); +assertEquals(1, hour.length); +assertEquals(5, hour[0]); +assertEquals(1, minute.length); +assertEquals(6, minute[0]); +assertEquals(1, second.length); +assertEquals(7, second[0]); +assertEquals(1, localeMatcher.length); +assertEquals(8, localeMatcher[0]); +assertEquals(1, hour12.length); +assertEquals(9, hour12[0]); +assertEquals(1, hourCycle.length); +assertEquals(10, hourCycle[0]); +assertEquals(1, timeZone.length); +assertEquals(11, timeZone[0]); +assertEquals(1, dateStyle.length); +assertEquals(12, dateStyle[0]); +assertEquals(1, timeStyle.length); +assertEquals(13, timeStyle[0]); +assertEquals(0, era.length); +assertEquals(0, timeZoneName.length); +assertEquals(0, formatMatcher.length); diff --git a/implementation-contributed/v8/intl/date-format/constructor-date-time-style.js b/implementation-contributed/v8/intl/date-format/constructor-date-time-style.js new file mode 100644 index 0000000000..f4bc40b396 --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/constructor-date-time-style.js @@ -0,0 +1,33 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +var validStyle = ["full", "long", "medium", "short", undefined]; +var invalidStyle = ["narrow", "numeric"]; + +validStyle.forEach(function(dateStyle) { + validStyle.forEach(function(timeStyle) { + assertDoesNotThrow(() => + new Intl.DateTimeFormat("en", {dateStyle, timeStyle})); + }); + + invalidStyle.forEach(function(timeStyle) { + assertThrows(() => + new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError); + }); +} +); + +invalidStyle.forEach(function(dateStyle) { + validStyle.forEach(function(timeStyle) { + assertThrows(() => + new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError); + }); + invalidStyle.forEach(function(timeStyle) { + assertThrows(() => + new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError); + }); +} +); diff --git a/implementation-contributed/v8/intl/date-format/constructor-no-style-order.js b/implementation-contributed/v8/intl/date-format/constructor-no-style-order.js new file mode 100644 index 0000000000..bd4bc4cc37 --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/constructor-no-style-order.js @@ -0,0 +1,114 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; +let weekday = new Array(); +let year = new Array(); +let month = new Array(); +let day = new Array(); +let hour = new Array(); +let minute = new Array(); +let second = new Array(); +let localeMatcher = new Array(); +let hour12 = new Array(); +let hourCycle = new Array(); +let dateStyle = new Array(); +let timeStyle = new Array(); +let timeZone = new Array(); +let era = new Array(); +let timeZoneName = new Array(); +let formatMatcher = new Array(); + +new Intl.DateTimeFormat(['en-US'], { + get weekday() { + weekday.push(++getCount); + }, + get year() { + year.push(++getCount); + }, + get month() { + month.push(++getCount); + }, + get day() { + day.push(++getCount); + }, + get hour() { + hour.push(++getCount); + }, + get minute() { + minute.push(++getCount); + }, + get second() { + second.push(++getCount); + }, + get localeMatcher() { + localeMatcher.push(++getCount); + }, + get hour12() { + hour12.push(++getCount); + }, + get hourCycle() { + hourCycle.push(++getCount); + }, + get timeZone() { + timeZone.push(++getCount); + }, + get dateStyle() { + dateStyle.push(++getCount); + }, + get timeStyle() { + timeStyle.push(++getCount); + }, + get era() { + era.push(++getCount); + }, + get timeZoneName() { + timeZoneName.push(++getCount); + }, + get formatMatcher() { + formatMatcher.push(++getCount); + } +}); + +assertEquals(2, weekday.length); +assertEquals(1, weekday[0]); +assertEquals(1, year.length); +assertEquals(2, year[0]); +assertEquals(1, month.length); +assertEquals(3, month[0]); +assertEquals(1, day.length); +assertEquals(4, day[0]); +assertEquals(2, hour.length); +assertEquals(5, hour[0]); +assertEquals(2, minute.length); +assertEquals(6, minute[0]); +assertEquals(2, second.length); +assertEquals(7, second[0]); +assertEquals(1, localeMatcher.length); +assertEquals(8, localeMatcher[0]); +assertEquals(1, hour12.length); +assertEquals(9, hour12[0]); +assertEquals(1, hourCycle.length); +assertEquals(10, hourCycle[0]); +assertEquals(1, timeZone.length); +assertEquals(11, timeZone[0]); +assertEquals(1, dateStyle.length); +assertEquals(12, dateStyle[0]); +assertEquals(1, timeStyle.length); +assertEquals(13, timeStyle[0]); +assertEquals(14, weekday[1]); +assertEquals(1, era.length); +assertEquals(15, era[0]); +assertEquals(16, hour[1]); +assertEquals(17, minute[1]); +assertEquals(18, second[1]); +assertEquals(1, timeZoneName.length); +assertEquals(19, timeZoneName[0]); +assertEquals(1, formatMatcher.length); +assertEquals(20, formatMatcher[0]); diff --git a/implementation-contributed/v8/intl/date-format/constructor-time-style-order.js b/implementation-contributed/v8/intl/date-format/constructor-time-style-order.js new file mode 100644 index 0000000000..d35f21a196 --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/constructor-time-style-order.js @@ -0,0 +1,108 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; +let weekday = new Array(); +let year = new Array(); +let month = new Array(); +let day = new Array(); +let hour = new Array(); +let minute = new Array(); +let second = new Array(); +let localeMatcher = new Array(); +let hour12 = new Array(); +let hourCycle = new Array(); +let dateStyle = new Array(); +let timeStyle = new Array(); +let timeZone = new Array(); +let era = new Array(); +let timeZoneName = new Array(); +let formatMatcher = new Array(); + +new Intl.DateTimeFormat(['en-US'], { + get weekday() { + weekday.push(++getCount); + }, + get year() { + year.push(++getCount); + }, + get month() { + month.push(++getCount); + }, + get day() { + day.push(++getCount); + }, + get hour() { + hour.push(++getCount); + }, + get minute() { + minute.push(++getCount); + }, + get second() { + second.push(++getCount); + }, + get localeMatcher() { + localeMatcher.push(++getCount); + }, + get hour12() { + hour12.push(++getCount); + }, + get hourCycle() { + hourCycle.push(++getCount); + }, + get timeZone() { + timeZone.push(++getCount); + }, + get dateStyle() { + dateStyle.push(++getCount); + }, + get timeStyle() { + timeStyle.push(++getCount); + return "full"; + }, + get era() { + era.push(++getCount); + }, + get timeZoneName() { + timeZoneName.push(++getCount); + }, + get formatMatcher() { + formatMatcher.push(++getCount); + } +}); + +assertEquals(1, weekday.length); +assertEquals(1, weekday[0]); +assertEquals(1, year.length); +assertEquals(2, year[0]); +assertEquals(1, month.length); +assertEquals(3, month[0]); +assertEquals(1, day.length); +assertEquals(4, day[0]); +assertEquals(1, hour.length); +assertEquals(5, hour[0]); +assertEquals(1, minute.length); +assertEquals(6, minute[0]); +assertEquals(1, second.length); +assertEquals(7, second[0]); +assertEquals(1, localeMatcher.length); +assertEquals(8, localeMatcher[0]); +assertEquals(1, hour12.length); +assertEquals(9, hour12[0]); +assertEquals(1, hourCycle.length); +assertEquals(10, hourCycle[0]); +assertEquals(1, timeZone.length); +assertEquals(11, timeZone[0]); +assertEquals(1, dateStyle.length); +assertEquals(12, dateStyle[0]); +assertEquals(1, timeStyle.length); +assertEquals(13, timeStyle[0]); +assertEquals(0, era.length); +assertEquals(0, timeZoneName.length); +assertEquals(0, formatMatcher.length); diff --git a/implementation-contributed/v8/intl/date-format/property-override-date-style.js b/implementation-contributed/v8/intl/date-format/property-override-date-style.js new file mode 100644 index 0000000000..67d9bc5361 --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/property-override-date-style.js @@ -0,0 +1,54 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +// Checks for security holes introduced by Object.property overrides. +// For example: +// Object.defineProperty(Array.prototype, 'locale', { +// set: function(value) { +// throw new Error('blah'); +// }, +// configurable: true, +// enumerable: false +// }); +// +// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us'). +// +// First get supported properties. +// Some of the properties are optional, so we request them. +var properties = []; +var options = Intl.DateTimeFormat( + 'en-US', {dateStyle: 'full'}).resolvedOptions(); +for (var prop in options) { + if (options.hasOwnProperty(prop)) { + properties.push(prop); + } +} + +// In the order of Table 6 of +// ecma402 #sec-intl.datetimeformat.prototype.resolvedoptions +var expectedProperties = [ + 'locale', + 'calendar', + 'numberingSystem', + 'timeZone', + 'hourCycle', + 'hour12', + 'weekday', + 'year', + 'month', + 'day', + 'dateStyle', +]; + +assertEquals(expectedProperties.length, properties.length); + +properties.forEach(function(prop) { + assertFalse(expectedProperties.indexOf(prop) === -1); +}); + +taintProperties(properties); + +var locale = Intl.DateTimeFormat().resolvedOptions().locale; diff --git a/implementation-contributed/v8/intl/date-format/property-override-date-time-style.js b/implementation-contributed/v8/intl/date-format/property-override-date-time-style.js new file mode 100644 index 0000000000..f51d6f31a6 --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/property-override-date-time-style.js @@ -0,0 +1,59 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +// Checks for security holes introduced by Object.property overrides. +// For example: +// Object.defineProperty(Array.prototype, 'locale', { +// set: function(value) { +// throw new Error('blah'); +// }, +// configurable: true, +// enumerable: false +// }); +// +// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us'). + +// First get supported properties. +// Some of the properties are optional, so we request them. +var properties = []; +var options = Intl.DateTimeFormat( + 'en-US', {dateStyle: 'full', timeStyle: 'full'}).resolvedOptions(); +for (var prop in options) { + if (options.hasOwnProperty(prop)) { + properties.push(prop); + } +} + +// In the order of Table 6 of +// ecma402 #sec-intl.datetimeformat.prototype.resolvedoptions +var expectedProperties = [ + 'locale', + 'calendar', + 'numberingSystem', + 'timeZone', + 'hourCycle', + 'hour12', + 'weekday', + 'year', + 'month', + 'day', + 'hour', + 'minute', + 'second', + 'timeZoneName', + 'dateStyle', + 'timeStyle', +]; + +assertEquals(expectedProperties.length, properties.length); + +properties.forEach(function(prop) { + assertFalse(expectedProperties.indexOf(prop) === -1); +}); + +taintProperties(properties); + +var locale = Intl.DateTimeFormat().resolvedOptions().locale; diff --git a/implementation-contributed/v8/intl/date-format/property-override-time-style.js b/implementation-contributed/v8/intl/date-format/property-override-time-style.js new file mode 100644 index 0000000000..1b93ac633f --- /dev/null +++ b/implementation-contributed/v8/intl/date-format/property-override-time-style.js @@ -0,0 +1,54 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-datetime-style + +// Checks for security holes introduced by Object.property overrides. +// For example: +// Object.defineProperty(Array.prototype, 'locale', { +// set: function(value) { +// throw new Error('blah'); +// }, +// configurable: true, +// enumerable: false +// }); +// +// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us'). + +// First get supported properties. +// Some of the properties are optional, so we request them. +var properties = []; +var options = Intl.DateTimeFormat( + 'en-US', {timeStyle: 'full'}).resolvedOptions(); +for (var prop in options) { + if (options.hasOwnProperty(prop)) { + properties.push(prop); + } +} + +// In the order of Table 6 of +// ecma402 #sec-intl.datetimeformat.prototype.resolvedoptions +var expectedProperties = [ + 'locale', + 'calendar', + 'numberingSystem', + 'timeZone', + 'hourCycle', + 'hour12', + 'hour', + 'minute', + 'second', + 'timeZoneName', + 'timeStyle', +]; + +assertEquals(expectedProperties.length, properties.length); + +properties.forEach(function(prop) { + assertFalse(expectedProperties.indexOf(prop) === -1); +}); + +taintProperties(properties); + +var locale = Intl.DateTimeFormat().resolvedOptions().locale; diff --git a/implementation-contributed/v8/intl/regress-7770.js b/implementation-contributed/v8/intl/regress-7770.js new file mode 100644 index 0000000000..2e7c2ce22d --- /dev/null +++ b/implementation-contributed/v8/intl/regress-7770.js @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Environment Variables: TZ=Indian/Kerguelen LANG=uk +assertEquals( + "Fri Feb 01 2019 00:00:00 GMT+0500 (за часом на Французьких Південних і Антарктичних територіях)", + new Date(2019, 1,1).toString()); diff --git a/implementation-contributed/v8/intl/regress-925216.js b/implementation-contributed/v8/intl/regress-925216.js new file mode 100644 index 0000000000..f9683dfc77 --- /dev/null +++ b/implementation-contributed/v8/intl/regress-925216.js @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertTrue(new Intl.DateTimeFormat( + "en", { timeZone: 'UTC', hour: 'numeric'}).resolvedOptions().hour12); +assertFalse(new Intl.DateTimeFormat( + "fr", { timeZone: 'UTC', hour: 'numeric'}).resolvedOptions().hour12); +assertFalse(new Intl.DateTimeFormat( + "de", { timeZone: 'UTC', hour: 'numeric'}).resolvedOptions().hour12); diff --git a/implementation-contributed/v8/intl/relative-time-format/format-en.js b/implementation-contributed/v8/intl/relative-time-format/format-en.js index 2af755dcbf..a365749f0a 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format-en.js +++ b/implementation-contributed/v8/intl/relative-time-format/format-en.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-relative-time-format - // The following test are not part of the comformance. Just some output in // English to verify the format does return something reasonable for English. // It may be changed when we update the CLDR data. diff --git a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js index 621726155e..7c2076b312 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js +++ b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-en.js @@ -94,4 +94,14 @@ assertEquals('second', parts[3].unit); assertEquals(3, Object.getOwnPropertyNames(parts[4]).length); assertEquals('decimal', parts[4].type); assertEquals('.', parts[4].value); -assertEquals('second', pa \ No newline at end of file +assertEquals('second', parts[4].unit); +// 5: "78" +assertEquals(3, Object.getOwnPropertyNames(parts[4]).length); +assertEquals('fraction', parts[5].type); +assertEquals('78', parts[5].value); +assertEquals('second', parts[5].unit); +// 6: " seconds" +assertEquals(2, Object.getOwnPropertyNames(parts[6]).length); +assertEquals('literal', parts[6].type); +assertEquals(' seconds', parts[6].value); +assertEquals(undefined, parts[6].unit); diff --git a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js index e69de29bb2..bd70f75421 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js +++ b/implementation-contributed/v8/intl/relative-time-format/format-to-parts-plural.js @@ -0,0 +1,26 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Check plural w/ formatToParts +// http://tc39.github.io/proposal-intl-relative-time/ + +let rtf = new Intl.RelativeTimeFormat(); + +// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit ) +function verifyElement(part, expectedUnit) { + assertEquals(true, part.type == 'literal' || part.type == 'integer'); + assertEquals('string', typeof part.value); + if (part.type == 'integer') { + assertEquals('string', typeof part.unit); + assertEquals(expectedUnit, part.unit); + } +}; + +['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second'].forEach( + function(unit) { + rtf.formatToParts(100, unit + 's').forEach( + function(part) { + verifyElement(part, unit); + }); + }); diff --git a/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js b/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js index e69de29bb2..ccc9170225 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js +++ b/implementation-contributed/v8/intl/relative-time-format/format-to-parts.js @@ -0,0 +1,80 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Make sure that RelativeTimeFormat exposes all required properties. Those not specified +// should have undefined value. +// http://tc39.github.io/proposal-intl-relative-time/ + +let rtf = new Intl.RelativeTimeFormat(); + +// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit ) +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'seconds'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'second'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minutes'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minute'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hours'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hour'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'days'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'day'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'weeks'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'week'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'months'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'month'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarters'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarter'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'years'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'year'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'seconds'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'second'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minutes'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minute'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hours'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hour'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'days'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'day'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'weeks'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'week'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'months'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'month'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarters'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarter'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'years'))); +assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'year'))); + +assertThrows(() => rtf.formatToParts(-1, 'decades'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'decade'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'centuries'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'century'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'milliseconds'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'millisecond'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'microseconds'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'microsecond'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'nanoseconds'), RangeError); +assertThrows(() => rtf.formatToParts(-1, 'nanosecond'), RangeError); + +assertThrows(() => rtf.formatToParts(NaN, 'seconds'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'second'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'minutes'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'minute'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'hours'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'hour'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'days'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'day'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'weeks'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'week'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'months'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'month'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'years'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'year'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'quarters'), RangeError); +assertThrows(() => rtf.formatToParts(NaN, 'quarter'), RangeError); + +assertEquals(true, Array.isArray(rtf.formatToParts(100, 'day'))); +rtf.formatToParts(100, 'day').forEach(function(part) { + assertEquals(true, part.type == 'literal' || part.type == 'integer'); + assertEquals('string', typeof part.value); + if (part.type == 'integer') { + assertEquals('string', typeof part.unit); + } +}); diff --git a/implementation-contributed/v8/intl/relative-time-format/format.js b/implementation-contributed/v8/intl/relative-time-format/format.js index e69de29bb2..e458ad728d 100644 --- a/implementation-contributed/v8/intl/relative-time-format/format.js +++ b/implementation-contributed/v8/intl/relative-time-format/format.js @@ -0,0 +1,80 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Make sure that RelativeTimeFormat exposes all required properties. Those not specified +// should have undefined value. +// http://tc39.github.io/proposal-intl-relative-time/ + +let rtf = new Intl.RelativeTimeFormat(); + +// Test 1.4.3 Intl.RelativeTimeFormat.prototype.format( value, unit ) +assertEquals('string', typeof rtf.format(-1, 'seconds')); +assertEquals('string', typeof rtf.format(-1, 'second')); +assertEquals('string', typeof rtf.format(-1, 'minutes')); +assertEquals('string', typeof rtf.format(-1, 'minute')); +assertEquals('string', typeof rtf.format(-1, 'hours')); +assertEquals('string', typeof rtf.format(-1, 'hour')); +assertEquals('string', typeof rtf.format(-1, 'days')); +assertEquals('string', typeof rtf.format(-1, 'day')); +assertEquals('string', typeof rtf.format(-1, 'weeks')); +assertEquals('string', typeof rtf.format(-1, 'week')); +assertEquals('string', typeof rtf.format(-1, 'months')); +assertEquals('string', typeof rtf.format(-1, 'month')); +assertEquals('string', typeof rtf.format(-1, 'years')); +assertEquals('string', typeof rtf.format(-1, 'year')); +assertEquals('string', typeof rtf.format(-1, 'quarter')); +assertEquals('string', typeof rtf.format(-1, 'quarters')); + +assertEquals('string', typeof rtf.format(-0, 'seconds')); +assertEquals('string', typeof rtf.format(-0, 'second')); +assertEquals('string', typeof rtf.format(-0, 'minutes')); +assertEquals('string', typeof rtf.format(-0, 'minute')); +assertEquals('string', typeof rtf.format(-0, 'hours')); +assertEquals('string', typeof rtf.format(-0, 'hour')); +assertEquals('string', typeof rtf.format(-0, 'days')); +assertEquals('string', typeof rtf.format(-0, 'day')); +assertEquals('string', typeof rtf.format(-0, 'weeks')); +assertEquals('string', typeof rtf.format(-0, 'week')); +assertEquals('string', typeof rtf.format(-0, 'months')); +assertEquals('string', typeof rtf.format(-0, 'month')); +assertEquals('string', typeof rtf.format(-0, 'years')); +assertEquals('string', typeof rtf.format(-0, 'year')); +assertEquals('string', typeof rtf.format(-0, 'quarter')); +assertEquals('string', typeof rtf.format(-0, 'quarters')); + +assertThrows(() => rtf.format(NaN, 'seconds'), RangeError); +assertThrows(() => rtf.format(NaN, 'second'), RangeError); +assertThrows(() => rtf.format(NaN, 'minutes'), RangeError); +assertThrows(() => rtf.format(NaN, 'minute'), RangeError); +assertThrows(() => rtf.format(NaN, 'hours'), RangeError); +assertThrows(() => rtf.format(NaN, 'hour'), RangeError); +assertThrows(() => rtf.format(NaN, 'days'), RangeError); +assertThrows(() => rtf.format(NaN, 'day'), RangeError); +assertThrows(() => rtf.format(NaN, 'weeks'), RangeError); +assertThrows(() => rtf.format(NaN, 'week'), RangeError); +assertThrows(() => rtf.format(NaN, 'months'), RangeError); +assertThrows(() => rtf.format(NaN, 'month'), RangeError); +assertThrows(() => rtf.format(NaN, 'years'), RangeError); +assertThrows(() => rtf.format(NaN, 'year'), RangeError); +assertThrows(() => rtf.format(NaN, 'quarters'), RangeError); +assertThrows(() => rtf.format(NaN, 'quarter'), RangeError); + +assertThrows(() => rtf.format(-1, 'decades'), RangeError); +assertThrows(() => rtf.format(-1, 'decade'), RangeError); +assertThrows(() => rtf.format(-1, 'centuries'), RangeError); +assertThrows(() => rtf.format(-1, 'century'), RangeError); +assertThrows(() => rtf.format(-1, 'milliseconds'), RangeError); +assertThrows(() => rtf.format(-1, 'millisecond'), RangeError); +assertThrows(() => rtf.format(-1, 'microseconds'), RangeError); +assertThrows(() => rtf.format(-1, 'microsecond'), RangeError); +assertThrows(() => rtf.format(-1, 'nanoseconds'), RangeError); +assertThrows(() => rtf.format(-1, 'nanosecond'), RangeError); + +assertEquals('string', typeof rtf.format(5, 'day')); +assertEquals('string', typeof rtf.format('5', 'day')); +assertEquals('string', typeof rtf.format('-5', 'day')); +assertEquals('string', typeof rtf.format('534', 'day')); +assertEquals('string', typeof rtf.format('-534', 'day')); + +//assertThrows(() => rtf.format('xyz', 'day'), RangeError); diff --git a/implementation-contributed/v8/intl/relative-time-format/resolved-options.js b/implementation-contributed/v8/intl/relative-time-format/resolved-options.js index e69de29bb2..1caa4f86c9 100644 --- a/implementation-contributed/v8/intl/relative-time-format/resolved-options.js +++ b/implementation-contributed/v8/intl/relative-time-format/resolved-options.js @@ -0,0 +1,162 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let rtf = new Intl.RelativeTimeFormat(); +// Test 1.4.5 Intl.RelativeTimeFormat.prototype.resolvedOptions () +// The default style is 'long' +assertEquals('long', rtf.resolvedOptions().style); + +// The default numeric is 'always' +assertEquals('always', rtf.resolvedOptions().numeric); + +// contains style, numeric and locale key +assertEquals(4, Object.getOwnPropertyNames(rtf.resolvedOptions()).length); + +// contains style, numeric and locale key +assertEquals( + 4, + Object.getOwnPropertyNames( + new Intl.RelativeTimeFormat("en").resolvedOptions() + ).length +); + +assertEquals( + 'short', + (new Intl.RelativeTimeFormat(['sr'], {style: 'short'})) + .resolvedOptions().style); + +assertEquals( + 'always', + (new Intl.RelativeTimeFormat(['sr'], {style: 'short'})) + .resolvedOptions().numeric); + +assertEquals( + 'narrow', + (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow'})) + .resolvedOptions().style); + +assertEquals( + 'always', + (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow'})) + .resolvedOptions().numeric); + +assertEquals( + 'long', + (new Intl.RelativeTimeFormat(['sr'], {style: 'long'})) + .resolvedOptions().style); + +assertEquals( + 'always', + (new Intl.RelativeTimeFormat(['sr'], {style: 'long'})) + .resolvedOptions().numeric); + +assertEquals( + 'auto', + (new Intl.RelativeTimeFormat(['sr'], {numeric: 'auto'})) + .resolvedOptions().numeric); + +assertEquals( + 'long', + (new Intl.RelativeTimeFormat(['sr'], {numeric: 'auto'})) + .resolvedOptions().style); + +assertEquals( + 'always', + (new Intl.RelativeTimeFormat(['sr'], {numeric: 'always'})) + .resolvedOptions().numeric); + +assertEquals( + 'long', + (new Intl.RelativeTimeFormat(['sr'], {numeric: 'always'})) + .resolvedOptions().style); + +assertEquals( + 'long', + (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'auto'})) + .resolvedOptions().style); + +assertEquals( + 'auto', + (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'auto'})) + .resolvedOptions().numeric); + +assertEquals( + 'long', + (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'always'})) + .resolvedOptions().style); + +assertEquals( + 'always', + (new Intl.RelativeTimeFormat(['sr'], {style: 'long', numeric: 'always'})) + .resolvedOptions().numeric); + +assertEquals( + 'short', + (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'auto'})) + .resolvedOptions().style); + +assertEquals( + 'auto', + (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'auto'})) + .resolvedOptions().numeric); + +assertEquals( + 'short', + (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'always'})) + .resolvedOptions().style); + +assertEquals( + 'always', + (new Intl.RelativeTimeFormat(['sr'], {style: 'short', numeric: 'always'})) + .resolvedOptions().numeric); + +assertEquals( + 'narrow', + (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'auto'})) + .resolvedOptions().style); + +assertEquals( + 'auto', + (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'auto'})) + .resolvedOptions().numeric); + +assertEquals( + 'narrow', + (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'always'})) + .resolvedOptions().style); + +assertEquals( + 'always', + (new Intl.RelativeTimeFormat(['sr'], {style: 'narrow', numeric: 'always'})) + .resolvedOptions().numeric); + +assertEquals( + 'ar', + (new Intl.RelativeTimeFormat(['ar'])).resolvedOptions().locale); + +assertEquals( + 'ar', + (new Intl.RelativeTimeFormat(['ar', 'en'])).resolvedOptions().locale); + +assertEquals( + 'fr', + (new Intl.RelativeTimeFormat(['fr', 'en'])).resolvedOptions().locale); + +assertEquals( + 'ar', + (new Intl.RelativeTimeFormat(['xyz', 'ar'])).resolvedOptions().locale); + +{ + var receiver = 1; + assertThrows(() => + Intl.RelativeTimeFormat.prototype.resolvedOptions.call(receiver), TypeError); + + receiver = {}; + assertThrows(() => + Intl.RelativeTimeFormat.prototype.resolvedOptions.call(receiver), TypeError); +} + +assertEquals( + 'ar', + (new Intl.RelativeTimeFormat(['i-default', 'ar'])).resolvedOptions().locale); diff --git a/implementation-contributed/v8/intl/relative-time-format/supported-locale.js b/implementation-contributed/v8/intl/relative-time-format/supported-locale.js index e69de29bb2..5c177b4777 100644 --- a/implementation-contributed/v8/intl/relative-time-format/supported-locale.js +++ b/implementation-contributed/v8/intl/relative-time-format/supported-locale.js @@ -0,0 +1,18 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertEquals(typeof Intl.RelativeTimeFormat.supportedLocalesOf, "function", + "Intl.RelativeTimeFormat.supportedLocalesOf should be a function"); + +var undef = Intl.RelativeTimeFormat.supportedLocalesOf(); +assertEquals([], undef); + +var empty = Intl.RelativeTimeFormat.supportedLocalesOf([]); +assertEquals([], empty); + +var strLocale = Intl.RelativeTimeFormat.supportedLocalesOf('sr'); +assertEquals('sr', strLocale[0]); + +var multiLocale = ['sr-Thai-RS', 'de', 'zh-CN']; +assertEquals(multiLocale, Intl.RelativeTimeFormat.supportedLocalesOf(multiLocale)); diff --git a/implementation-contributed/v8/intl/segmenter/check-lb-option.js b/implementation-contributed/v8/intl/segmenter/check-lb-option.js index e69de29bb2..0e54d18202 100644 --- a/implementation-contributed/v8/intl/segmenter/check-lb-option.js +++ b/implementation-contributed/v8/intl/segmenter/check-lb-option.js @@ -0,0 +1,29 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-segmenter + +let invalid_lb = [ + "invalid", + "abce", + "breakall", + "keepall", + "none", + "standard", + "strict", + "normal", + "loose", +]; + +let locales = [ + "en", + "ja", + "zh", +]; + +invalid_lb.forEach(function(lb) { + let df = new Intl.Segmenter(["en-u-lb-" + lb + "-fo-obar"]); + assertEquals("en", df.resolvedOptions().locale); +} +); diff --git a/implementation-contributed/v8/intl/segmenter/constructor-order.js b/implementation-contributed/v8/intl/segmenter/constructor-order.js index e69de29bb2..e43fb9f963 100644 --- a/implementation-contributed/v8/intl/segmenter/constructor-order.js +++ b/implementation-contributed/v8/intl/segmenter/constructor-order.js @@ -0,0 +1,20 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-segmenter + +// Throws only once during construction. +// Check for all getters to prevent regression. +// Preserve the order of getter initialization. +let getCount = 0; + +new Intl.Segmenter(['en-US'], { + get localeMatcher() { + assertEquals(0, getCount++); + }, + get granularity() { + assertEquals(1, getCount++); + }, +}); +assertEquals(2, getCount); diff --git a/implementation-contributed/v8/intl/segmenter/constructor.js b/implementation-contributed/v8/intl/segmenter/constructor.js index e69de29bb2..6612e1eab6 100644 --- a/implementation-contributed/v8/intl/segmenter/constructor.js +++ b/implementation-contributed/v8/intl/segmenter/constructor.js @@ -0,0 +1,190 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-segmenter + +// Segmenter constructor can't be called as function. +assertThrows(() => Intl.Segmenter(["sr"]), TypeError); + +// Invalid locale string. +assertThrows(() => new Intl.Segmenter(["abcdefghi"]), RangeError); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], {}), TypeError); + +assertDoesNotThrow(() => new Intl.Segmenter([], {})); + +assertDoesNotThrow(() => new Intl.Segmenter(["fr", "ar"], {})); + +assertDoesNotThrow(() => new Intl.Segmenter({ 0: "ja", 1: "fr" }, {})); + +assertDoesNotThrow(() => new Intl.Segmenter({ 1: "ja", 2: "fr" }, {})); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"])); + +assertDoesNotThrow(() => new Intl.Segmenter()); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + lineBreakStyle: "strict", + granularity: "grapheme" + }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { granularity: "sentence" }) +); + +assertDoesNotThrow(() => new Intl.Segmenter(["sr"], { granularity: "word" })); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { granularity: "grapheme" }) +); + +assertThrows(() => new Intl.Segmenter(["sr"], { granularity: "line" }), RangeError); + +assertThrows( + () => new Intl.Segmenter(["sr"], { granularity: "standard" }), + RangeError +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "normal" }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "strict" }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "loose" }) +); + +assertDoesNotThrow( + () => new Intl.Segmenter(["sr"], { lineBreakStyle: "giant" }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "sentence", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "word", + lineBreakStyle: "loose" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "normal" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "strict" + }) +); + +assertDoesNotThrow( + () => + new Intl.Segmenter(["sr"], { + granularity: "grapheme", + lineBreakStyle: "loose" + }) +); + +assertThrows( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "loose" + }), RangeError +); + +assertThrows( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "normal" + }), RangeError +); + +assertThrows( + () => + new Intl.Segmenter(["sr"], { + granularity: "line", + lineBreakStyle: "strict" + }), RangeError +); + +// propagate exception from getter +assertThrows( + () => + new Intl.Segmenter(undefined, { + get localeMatcher() { + throw new TypeError(""); + } + }), + TypeError +); +assertDoesNotThrow( + () => + new Intl.Segmenter(undefined, { + get lineBreakStyle() { + throw new TypeError(""); + } + }) +); +assertThrows( + () => + new Intl.Segmenter(undefined, { + get granularity() { + throw new TypeError(""); + } + }), + TypeError +); diff --git a/implementation-contributed/v8/intl/segmenter/segment-iterator.js b/implementation-contributed/v8/intl/segmenter/segment-iterator.js index e69de29bb2..696ffab554 100644 --- a/implementation-contributed/v8/intl/segmenter/segment-iterator.js +++ b/implementation-contributed/v8/intl/segmenter/segment-iterator.js @@ -0,0 +1,15 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-intl-segmenter + +const text = "Hello World, Test 123! Foo Bar. How are you?"; +for (const granularity of ["grapheme", "word", "sentence"]) { + const segmenter = new Intl.Segmenter("en", { granularity }); + const iter = segmenter.segment(text); + + assertEquals("number", typeof iter.index); + assertEquals(0, iter.index); + assertEquals(undefined, iter.breakType); +} diff --git a/implementation-contributed/v8/mjsunit/array-sort.js b/implementation-contributed/v8/mjsunit/array-sort.js index 8c2c6fca63..ca0daadf04 100644 --- a/implementation-contributed/v8/mjsunit/array-sort.js +++ b/implementation-contributed/v8/mjsunit/array-sort.js @@ -567,6 +567,27 @@ function TestPrototypeHoles() { } TestPrototypeHoles(); +// The following test ensures that elements on the prototype are also copied +// for JSArrays and not only JSObjects. +function TestArrayPrototypeHasElements() { + let array = [1, 2, 3, 4, 5]; + for (let i = 0; i < array.length; i++) { + delete array[i]; + Object.prototype[i] = 42; + } + + let comparator_called = false; + array.sort(function (a, b) { + if (a === 42 || b === 42) { + comparator_called = true; + } + return a - b; + }); + + assertTrue(comparator_called); +} +TestArrayPrototypeHasElements(); + // The following Tests make sure that there is no crash when the element kind // or the array length changes. Since comparison functions like this are not // consistent, we do not have to make sure that the array is actually sorted diff --git a/implementation-contributed/v8/mjsunit/compiler/regress-924151.js b/implementation-contributed/v8/mjsunit/compiler/regress-924151.js new file mode 100644 index 0000000000..cfaaedfb21 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/compiler/regress-924151.js @@ -0,0 +1,28 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function g(code) { + try { + if (typeof code === 'function') { + +Symbol(); + } else { + eval(); + } + } catch (e) { + return; + } + dummy(); +} + +function f() { + g(g); +} + +try { g(); } catch(e) {; } + +f(); +%OptimizeFunctionOnNextCall(f); +f(); diff --git a/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js b/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js index e69de29bb2..b38013eeb3 100644 --- a/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js +++ b/implementation-contributed/v8/mjsunit/es6/for-each-in-catch.js @@ -0,0 +1,196 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function checkIsRedeclarationError(code) { + try { + eval(` + checkIsRedeclarationError: { + break checkIsRedeclarationError; + ${code} + } + `); + assertUnreachable(); + } catch (e) { + assertInstanceof(e, SyntaxError); + assertTrue(e.toString().includes("has already been declared")); + } +} + +function checkIsNotRedeclarationError(code) { + assertDoesNotThrow(() => eval(` + checkIsNotRedeclarationError_label: { + break checkIsNotRedeclarationError_label; + ${code} + } + `)); +} + + +let var_e = [ + 'var e', + 'var {e}', + 'var {f, e}', + 'var [e]', + 'var {f:e}', + 'var [[[], e]]' +]; + +let not_var_e = [ + 'var f', + 'var {}', + 'var {e:f}', + 'e', + '{e}', + 'let e', + 'const e', + 'let {e}', + 'const {e}', + 'let [e]', + 'const [e]', + 'let {f:e}', + 'const {f:e}' +]; + +// Check that both `for (var ... of ...)` and `for (var ... in ...)` +// can redeclare a simple catch variable. +for (let binding of var_e) { + checkIsNotRedeclarationError(` + try { + throw 0; + } catch (e) { + for (${binding} of []); + } + `); + + checkIsNotRedeclarationError(` + try { + throw 0; + } catch (e) { + for (${binding} in []); + } + `); +} + +// Check that the above applies even for nested catches. +for (let binding of var_e) { + checkIsNotRedeclarationError(` + try { + throw 0; + } catch (e) { + try { + throw 1; + } catch (f) { + try { + throw 2; + } catch ({}) { + for (${binding} of []); + } + } + } + `); + + checkIsNotRedeclarationError(` + try { + throw 0; + } catch (e) { + try { + throw 1; + } catch (f) { + try { + throw 2; + } catch ({}) { + for (${binding} in []); + } + } + } + `); +} + +// Check that the above applies if a declaration scope is between the +// catch and the loop. +for (let binding of var_e) { + checkIsNotRedeclarationError(` + try { + throw 0; + } catch (e) { + (()=>{for (${binding} of []);})(); + } + `); + + checkIsNotRedeclarationError(` + try { + throw 0; + } catch (e) { + (function() { + for (${binding} of []); + })(); + } + `); +} + +// Check that there is no error when not declaring a var named e. +for (let binding of not_var_e) { + checkIsNotRedeclarationError(` + try { + throw 0; + } catch (e) { + for (${binding} of []); + } + `); +} + +// Check that there is an error for both for-in and for-of when redeclaring +// a non-simple catch parameter. +for (let binding of var_e) { + checkIsRedeclarationError(` + try { + throw 0; + } catch ({e}) { + for (${binding} of []); + } + `); + + checkIsRedeclarationError(` + try { + throw 0; + } catch ({e}) { + for (${binding} in []); + } + `); +} + +// Check that the above error occurs even for nested catches. +for (let binding of var_e) { + checkIsRedeclarationError(` + try { + throw 0; + } catch ({e}) { + try { + throw 1; + } catch (f) { + try { + throw 2; + } catch ({}) { + for (${binding} of []); + } + } + } + `); + + checkIsRedeclarationError(` + try { + throw 0; + } catch ({e}) { + try { + throw 1; + } catch (f) { + try { + throw 2; + } catch ({}) { + for (${binding} in []); + } + } + } + `); +} diff --git a/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js b/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js index e69de29bb2..3b9011acdc 100644 --- a/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js +++ b/implementation-contributed/v8/mjsunit/es6/proxies-ownkeys.js @@ -0,0 +1,94 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var target = { + "target_one": 1 +}; +target.__proto__ = { + "target_proto_two": 2 +}; +var handler = { + ownKeys: function(target) { + return ["foo", "bar"]; + } +} + +var proxy = new Proxy(target, handler); + +// Simple case. +assertEquals(["foo", "bar"], Reflect.ownKeys(proxy)); + +// Test interesting steps of the algorithm: + +// Step 6: Fall through to target.[[OwnPropertyKeys]] if the trap is undefined. +handler.ownKeys = undefined; +assertEquals(["target_one"], Reflect.ownKeys(proxy)); + +// Step 7: Throwing traps don't crash. +handler.ownKeys = function(target) { throw 1; }; +assertThrows("Reflect.ownKeys(proxy)"); + +// Step 8: CreateListFromArrayLike error cases: +// Returning a non-Object throws. +var keys = 1; +handler.ownKeys = function(target) { return keys; }; +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = "string"; +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = Symbol("foo"); +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = null; +assertThrows("Reflect.ownKeys(proxy)", TypeError); + +// "length" property is honored. +keys = { 0: "a", 1: "b", 2: "c" }; +keys.length = 0; +assertEquals([], Reflect.ownKeys(proxy)); +keys.length = 1; +assertEquals(["a"], Reflect.ownKeys(proxy)); +keys.length = 3; +assertEquals(["a", "b", "c"], Reflect.ownKeys(proxy)); +// The spec wants to allow lengths up to 2^53, but we can't allocate arrays +// of that size, so we throw even for smaller values. +keys.length = Math.pow(2, 33); +assertThrows("Reflect.ownKeys(proxy)", RangeError); + +// Check that we don't allow duplicated keys. +keys = ['a', 'a', 'a'] +assertThrows("Reflect.ownKeys(proxy)", TypeError); + +// Non-Name results throw. +keys = [1]; +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = [{}]; +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = [{toString: function() { return "foo"; }}]; +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = [null]; +assertThrows("Reflect.ownKeys(proxy)", TypeError); + +// Step 17a: The trap result must include all non-configurable keys. +Object.defineProperty(target, "nonconf", {value: 1, configurable: false}); +keys = ["foo"]; +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = ["nonconf"]; +assertEquals(keys, Reflect.ownKeys(proxy)); + +// Check that we don't allow duplicated keys. +keys = ['nonconf', 'nonconf', 'nonconf'] +assertThrows("Reflect.ownKeys(proxy)", TypeError); + +// Step 19a: The trap result must all keys of a non-extensible target. +Object.preventExtensions(target); +assertThrows("Reflect.ownKeys(proxy)", TypeError); +keys = ["nonconf", "target_one"]; +assertEquals(keys, Reflect.ownKeys(proxy)); + +// Step 20: The trap result must not add keys to a non-extensible target. +keys = ["nonconf", "target_one", "fantasy"]; +assertThrows("Reflect.ownKeys(proxy)", TypeError); + +// Check that we don't allow duplicated keys. +keys = ['nonconf', 'target_one', 'nonconf', 'nonconf', 'target_one',] +assertThrows("Reflect.ownKeys(proxy)", TypeError); diff --git a/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js b/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js index e69de29bb2..7cd08b1258 100644 --- a/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js +++ b/implementation-contributed/v8/mjsunit/es6/typedarray-sort.js @@ -0,0 +1,151 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var typedArrayConstructors = [ + Uint8Array, + Int8Array, + Uint16Array, + Int16Array, + Uint32Array, + Int32Array, + Uint8ClampedArray, + Float32Array, + Float64Array +]; + +function assertArrayLikeEquals(value, expected, type) { + assertEquals(value.__proto__, type.prototype); + // Don't test value.length because we mess with that; + // instead in certain callsites we check that length + // is set appropriately. + for (var i = 0; i < expected.length; ++i) { + // Use Object.is to differentiate between +-0 + assertSame(expected[i], value[i]); + } +} + +for (var constructor of typedArrayConstructors) { + // Test default numerical sorting order + var a = new constructor([100, 7, 45]) + assertEquals(a.sort(), a); + assertArrayLikeEquals(a, [7, 45, 100], constructor); + assertEquals(a.length, 3); + + // For arrays of floats, certain handling of +-0/NaN + if (constructor === Float32Array || constructor === Float64Array) { + var b = new constructor([+0, -0, NaN, -0, NaN, +0]) + b.sort(); + assertArrayLikeEquals(b, [-0, -0, +0, +0, NaN, NaN], constructor); + assertEquals(b.length, 6); + } + + // Custom sort--backwards + a.sort(function(x, y) { return y - x; }); + assertArrayLikeEquals(a, [100, 45, 7], constructor); + + // Basic TypedArray method properties: + // Length field is ignored + Object.defineProperty(a, 'length', {value: 1}); + assertEquals(a.sort(), a); + assertArrayLikeEquals(a, [7, 45, 100], constructor); + assertEquals(a.length, 1); + // Method doesn't work on other objects + assertThrows(function() { a.sort.call([]); }, TypeError); + + // Do not touch elements out of byte offset + var buf = new ArrayBuffer(constructor.BYTES_PER_ELEMENT * 3); + var a = new constructor(buf, constructor.BYTES_PER_ELEMENT); + var b = new constructor(buf); + b[0] = 3; b[1] = 2; b[2] = 1; + a.sort(); + assertArrayLikeEquals(a, [1, 2], constructor); + + // Detached Operation + var array = new constructor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + %ArrayBufferDetach(array.buffer); + assertThrows(() => array.sort(), TypeError); +} + +// Check that TypedArray.p.sort is stable. +for (let constructor of typedArrayConstructors) { + // Sort an array [0..kSize-1] modulo 4. If the sort is stable, the array + // will be partitioned into 4 parts, where each part has only increasing + // elements. + const kSize = 128; + const kModulo = 4; + const kRunSize = kSize / kModulo; + + const template = Array.from({ length: kSize }, (_, i) => i); + const array = new constructor(template); + + const compare = (a, b) => (b % kModulo) - (a % kModulo); + array.sort(compare); + + function assertIncreasing(from) { + for (let i = from + 1; i < from + kRunSize; ++i) { + assertTrue(array[i - 1] < array[i]); + assertEquals(array[i - 1] % kModulo, array[i] % kModulo); + } + } + + for (let i = 0; i < kModulo; ++i) assertIncreasing(i * kRunSize); +} + +// The following creates a test for each typed element kind, where the array +// to sort consists of some max/min/zero elements. +// +// When providing a custom compare function, the torque version of +// TypedArray.p.sort needs to convert array elements to "Number"/"BigInt" +// and back. The following test checks the edge cases for that conversion. + +let constructorsWithArrays = [ + {ctor: Uint8Array, array: [255, 254, 4, 3, 2, 1, 0]}, + {ctor: Int8Array, array: [127, 126, 1, 0, -1, -127, -128]}, + {ctor: Uint16Array, array: [2 ** 16 - 1, 2 ** 16 - 2, 4, 3, 2, 1, 0]}, + { + ctor: Int16Array, + array: [2 ** 15 - 1, 2 ** 15 - 2, 1, 0, -1, -(2 ** 15 - 1), -(2 ** 15)] + }, + {ctor: Uint32Array, array: [2 ** 32 - 1, 2 ** 32 - 2, 4, 3, 2, 1, 0]}, + { + ctor: Int32Array, + array: [2 ** 31 - 1, 2 ** 31 - 2, 1, 0, -1, -(2 ** 31 - 1), -(2 ** 31)] + }, + { + ctor: Float32Array, + array: [2 ** 24, 2 ** 24 - 1, 1, 0,-1, -(2 ** 24 - 1), -(2 ** 24)] + }, + { + ctor: Float64Array, + array: [2 ** 53, 2 ** 53 - 1, 1, 0, -1, -(2 ** 53 - 1), -(2 ** 53)] + }, + {ctor: Uint8ClampedArray, array: [255, 254, 4, 3, 2, 1, 0]}, + { + ctor: BigUint64Array, + array: [2n ** 64n - 1n, 2n ** 64n - 2n, 4n, 3n, 2n, 1n, 0n] + }, + { + ctor: BigInt64Array, + array: [2n ** 63n - 1n, 2n ** 63n - 2n, 1n, 0n, + -1n, -(2n ** 63n - 1n), -(2n ** 63n)] + } +]; + +// Compare function needs to return a Number in all cases, and not a BigInt. +// Hence we can not simply return "a - b". +function cmpfn(a, b) { + if (a < b) return -1; + if (b < a) return 1; + return 0; +} + +for (let constructor of constructorsWithArrays) { + let array = new constructor.ctor(constructor.array); + + assertEquals(array.sort(cmpfn), array); + assertArrayLikeEquals(array, constructor.array.reverse(), constructor.ctor); + assertEquals(array.length, constructor.array.length); +} diff --git a/implementation-contributed/v8/mjsunit/es8/object-entries.js b/implementation-contributed/v8/mjsunit/es8/object-entries.js index 51ce4692e4..f119cfc113 100644 --- a/implementation-contributed/v8/mjsunit/es8/object-entries.js +++ b/implementation-contributed/v8/mjsunit/es8/object-entries.js @@ -144,29 +144,11 @@ function TestOrderWithDuplicates(withWarmup) { }); if (withWarmup) { - for (const key in P) {} + for (const key in O) {}; + try { for (const key in P) {} } catch {}; } - log = []; - assertEquals([ - ["a", 1], - ["a", 1], - ["456", 123], - ["456", 123] - ], Object.entries(P)); - assertEquals([ - "[[OwnPropertyKeys]]", - "[[GetOwnProperty]](\"a\")", - "[[Get]](\"a\")", - "[[GetOwnProperty]](\"a\")", - "[[Get]](\"a\")", - "[[GetOwnProperty]](\"456\")", - "[[Get]](\"456\")", - "[[GetOwnProperty]](\"HIDDEN\")", - "[[GetOwnProperty]](\"HIDDEN\")", - "[[GetOwnProperty]](\"456\")", - "[[Get]](\"456\")" - ], log); + assertThrows(() => Object.entries(P), TypeError); } TestOrderWithDuplicates(); TestOrderWithDuplicates(true); diff --git a/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js b/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js index e69de29bb2..0bd84bd6fe 100644 --- a/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js +++ b/implementation-contributed/v8/mjsunit/es8/object-get-own-property-descriptors.js @@ -0,0 +1,220 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function DataDescriptor(value) { + return { "enumerable": true, "configurable": true, "writable": true, value }; +} + + +function TestMeta() { + assertEquals(1, Object.getOwnPropertyDescriptors.length); + assertEquals(Function.prototype, + Object.getPrototypeOf(Object.getOwnPropertyDescriptors)); + assertEquals( + 'getOwnPropertyDescriptors', Object.getOwnPropertyDescriptors.name); + var desc = Reflect.getOwnPropertyDescriptor( + Object, 'getOwnPropertyDescriptors'); + assertFalse(desc.enumerable); + assertTrue(desc.writable); + assertTrue(desc.configurable); +} +TestMeta(); + + +function TestToObject() { + assertThrows(function() { + Object.getOwnPropertyDescriptors(null); + }, TypeError); + + assertThrows(function() { + Object.getOwnPropertyDescriptors(undefined); + }, TypeError); + + assertThrows(function() { + Object.getOwnPropertyDescriptors(); + }, TypeError); +} +TestToObject(); + + +function TestPrototypeProperties() { + function F() {}; + F.prototype.a = "A"; + F.prototype.b = "B"; + + var F2 = new F(); + Object.defineProperties(F2, { + "b": { + enumerable: false, + configurable: true, + writable: false, + value: "Shadowed 'B'" + }, + "c": { + enumerable: false, + configurable: true, + writable: false, + value: "C" + } + }); + + assertEquals({ + "b": { + enumerable: false, + configurable: true, + writable: false, + value: "Shadowed 'B'" + }, + "c": { + enumerable: false, + configurable: true, + writable: false, + value: "C" + } + }, Object.getOwnPropertyDescriptors(F2)); +} +TestPrototypeProperties(); + + +function TestPrototypeProperties() { + function F() {}; + F.prototype.a = "A"; + F.prototype.b = "B"; + + var F2 = new F(); + Object.defineProperties(F2, { + "b": { + enumerable: false, + configurable: true, + writable: false, + value: "Shadowed 'B'" + }, + "c": { + enumerable: false, + configurable: true, + writable: false, + value: "C" + } + }); + + assertEquals({ + "b": { + enumerable: false, + configurable: true, + writable: false, + value: "Shadowed 'B'" + }, + "c": { + enumerable: false, + configurable: true, + writable: false, + value: "C" + } + }, Object.getOwnPropertyDescriptors(F2)); +} +TestPrototypeProperties(); + + +function TestTypeFilteringAndOrder() { + var log = []; + var sym = Symbol("foo"); + var psym = %CreatePrivateSymbol("private"); + var O = { + 0: 0, + [sym]: 3, + "a": 2, + [psym]: 4, + 1: 1, + }; + var P = new Proxy(O, { + ownKeys(target) { + log.push("ownKeys()"); + return Reflect.ownKeys(target); + }, + getOwnPropertyDescriptor(target, name) { + log.push(`getOwnPropertyDescriptor(${String(name)})`); + return Reflect.getOwnPropertyDescriptor(target, name); + }, + get(target, name) { assertUnreachable(); }, + set(target, name, value) { assertUnreachable(); }, + deleteProperty(target, name) { assertUnreachable(); }, + defineProperty(target, name, desc) { assertUnreachable(); } + }); + + var result1 = Object.getOwnPropertyDescriptors(O); + assertEquals({ + 0: DataDescriptor(0), + 1: DataDescriptor(1), + "a": DataDescriptor(2), + [sym]: DataDescriptor(3) + }, result1); + + var result2 = Object.getOwnPropertyDescriptors(P); + assertEquals([ + "ownKeys()", + "getOwnPropertyDescriptor(0)", + "getOwnPropertyDescriptor(1)", + "getOwnPropertyDescriptor(a)", + "getOwnPropertyDescriptor(Symbol(foo))" + ], log); + assertEquals({ + 0: DataDescriptor(0), + 1: DataDescriptor(1), + "a": DataDescriptor(2), + [sym]: DataDescriptor(3) + }, result2); +} +TestTypeFilteringAndOrder(); + + +function TestDuplicateKeys() { + var i = 0; + var log = []; + var P = new Proxy({}, { + ownKeys() { + log.push(`ownKeys()`); + return ["A", "A"]; + }, + getOwnPropertyDescriptor(t, name) { + log.push(`getOwnPropertyDescriptor(${name})`); + if (i++) return; + return { + configurable: true, + writable: false, + value: "VALUE" + }; + }, + get(target, name) { assertUnreachable(); }, + set(target, name, value) { assertUnreachable(); }, + deleteProperty(target, name) { assertUnreachable(); }, + defineProperty(target, name, desc) { assertUnreachable(); } + }); + + assertThrows(() => Object.getOwnPropertyDescriptors(P), TypeError); +} +TestDuplicateKeys(); + +function TestFakeProperty() { + var log = []; + var P = new Proxy({}, { + ownKeys() { + log.push(`ownKeys()`); + return ["fakeProperty"]; + }, + getOwnPropertyDescriptor(target, name) { + log.push(`getOwnPropertyDescriptor(${name})`); + return; + } + }); + var result = Object.getOwnPropertyDescriptors(P); + assertEquals({}, result); + assertFalse(result.hasOwnProperty("fakeProperty")); + assertEquals([ + "ownKeys()", + "getOwnPropertyDescriptor(fakeProperty)" + ], log); +} +TestFakeProperty(); diff --git a/implementation-contributed/v8/mjsunit/es8/object-values.js b/implementation-contributed/v8/mjsunit/es8/object-values.js index e69de29bb2..b66e4af7d3 100644 --- a/implementation-contributed/v8/mjsunit/es8/object-values.js +++ b/implementation-contributed/v8/mjsunit/es8/object-values.js @@ -0,0 +1,278 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function TestMeta() { + assertEquals(1, Object.values.length); + assertEquals(Function.prototype, Object.getPrototypeOf(Object.values)); + assertEquals("values", Object.values.name); + + var descriptor = Object.getOwnPropertyDescriptor(Object, "values"); + assertTrue(descriptor.writable); + assertFalse(descriptor.enumerable); + assertTrue(descriptor.configurable); + + assertThrows(() => new Object.values({}), TypeError); +} +TestMeta(); + + +function TestBasic() { + var x = 16; + var O = { + d: 1, + c: 3, + [Symbol.iterator]: void 0, + 0: 123, + 1000: 456, + [x * x]: "ducks", + [`0x${(x * x).toString(16)}`]: "quack" + }; + O.a = 2; + O.b = 4; + Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN }); + assertEquals([123, "ducks", 456, 1, 3, "quack", 2, 4], Object.values(O)); + assertEquals(Object.values(O), Object.keys(O).map(key => O[key])); + + assertTrue(Array.isArray(Object.values({}))); + assertEquals(0, Object.values({}).length); +} +TestBasic(); + + +function TestToObject() { + assertThrows(function() { Object.values(); }, TypeError); + assertThrows(function() { Object.values(null); }, TypeError); + assertThrows(function() { Object.values(void 0); }, TypeError); +} +TestToObject(); + + +function TestOrder() { + var O = { + a: 1, + [Symbol.iterator]: null + }; + O[456] = 123; + Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN }); + var priv = %CreatePrivateSymbol("Secret"); + O[priv] = 56; + + var log = []; + var P = new Proxy(O, { + ownKeys(target) { + log.push("[[OwnPropertyKeys]]"); + return Reflect.ownKeys(target); + }, + get(target, name) { + log.push(`[[Get]](${JSON.stringify(name)})`); + return Reflect.get(target, name); + }, + getOwnPropertyDescriptor(target, name) { + log.push(`[[GetOwnProperty]](${JSON.stringify(name)})`); + return Reflect.getOwnPropertyDescriptor(target, name); + }, + set(target, name, value) { + assertUnreachable(); + } + }); + + assertEquals([123, 1], Object.values(P)); + assertEquals([ + "[[OwnPropertyKeys]]", + "[[GetOwnProperty]](\"456\")", + "[[Get]](\"456\")", + "[[GetOwnProperty]](\"a\")", + "[[Get]](\"a\")", + "[[GetOwnProperty]](\"HIDDEN\")" + ], log); +} +TestOrder(); + + +function TestOrderWithDuplicates() { + var O = { + a: 1, + [Symbol.iterator]: null + }; + O[456] = 123; + Object.defineProperty(O, "HIDDEN", { enumerable: false, value: NaN }); + O[priv] = 56; + var priv = %CreatePrivateSymbol("private"); + + var log = []; + var P = new Proxy(O, { + ownKeys(target) { + log.push("[[OwnPropertyKeys]]"); + return [ "a", Symbol.iterator, "a", "456", "HIDDEN", "HIDDEN", "456" ]; + }, + get(target, name) { + log.push(`[[Get]](${JSON.stringify(name)})`); + return Reflect.get(target, name); + }, + getOwnPropertyDescriptor(target, name) { + log.push(`[[GetOwnProperty]](${JSON.stringify(name)})`); + return Reflect.getOwnPropertyDescriptor(target, name); + }, + set(target, name, value) { + assertUnreachable(); + } + }); + + assertThrows(() => Object.values(P), TypeError); +} +TestOrderWithDuplicates(); + + +function TestPropertyFilter() { + var object = { prop3: 30 }; + object[2] = 40; + object["prop4"] = 50; + Object.defineProperty(object, "prop5", { value: 60, enumerable: true }); + Object.defineProperty(object, "prop6", { value: 70, enumerable: false }); + Object.defineProperty(object, "prop7", { + enumerable: true, get() { return 80; }}); + var sym = Symbol("prop8"); + object[sym] = 90; + + values = Object.values(object); + assertEquals(5, values.length); + assertEquals([40,30,50,60,80], values); +} +TestPropertyFilter(); + + +function TestWithProxy() { + var obj1 = {prop1:10}; + var proxy1 = new Proxy(obj1, { }); + assertEquals([10], Object.values(proxy1)); + + var obj2 = {}; + Object.defineProperty(obj2, "prop2", { value: 20, enumerable: true }); + Object.defineProperty(obj2, "prop3", { + get() { return 30; }, enumerable: true }); + var proxy2 = new Proxy(obj2, { + getOwnPropertyDescriptor(target, name) { + return Reflect.getOwnPropertyDescriptor(target, name); + } + }); + assertEquals([20, 30], Object.values(proxy2)); + + var obj3 = {}; + var count = 0; + var proxy3 = new Proxy(obj3, { + get(target, property, receiver) { + return count++ * 5; + }, + getOwnPropertyDescriptor(target, property) { + return { configurable: true, enumerable: true }; + }, + ownKeys(target) { + return [ "prop0", "prop1", Symbol("prop2"), Symbol("prop5") ]; + } + }); + assertEquals([0, 5], Object.values(proxy3)); +} +TestWithProxy(); + + +function TestMutateDuringEnumeration() { + var aDeletesB = { + get a() { + delete this.b; + return 1; + }, + b: 2 + }; + assertEquals([1], Object.values(aDeletesB)); + + var aRemovesB = { + get a() { + Object.defineProperty(this, "b", { enumerable: false }); + return 1; + }, + b: 2 + }; + assertEquals([1], Object.values(aRemovesB)); + + var aAddsB = { get a() { this.b = 2; return 1; } }; + assertEquals([1], Object.values(aAddsB)); + + var aMakesBEnumerable = {}; + Object.defineProperty(aMakesBEnumerable, "a", { + get() { + Object.defineProperty(this, "b", { enumerable: true }); + return 1; + }, + enumerable: true + }); + Object.defineProperty(aMakesBEnumerable, "b", { + value: 2, configurable:true, enumerable: false }); + assertEquals([1, 2], Object.values(aMakesBEnumerable)); +} +TestMutateDuringEnumeration(); + + +(function TestElementKinds() { + var O1 = { name: "1" }, O2 = { name: "2" }, O3 = { name: "3" }; + var PI = 3.141592653589793; + var E = 2.718281828459045; + function fastSloppyArguments(a, b, c) { + delete arguments[0]; + arguments[0] = a; + return arguments; + } + + function slowSloppyArguments(a, b, c) { + delete arguments[0]; + arguments[0] = a; + Object.defineProperties(arguments, { + 0: { + enumerable: true, + value: a + }, + 9999: { + enumerable: false, + value: "Y" + } + }); + arguments[10000] = "X"; + return arguments; + } + + var element_kinds = { + PACKED_SMI_ELEMENTS: [ [1, 2, 3], [1, 2, 3] ], + HOLEY_SMI_ELEMENTS: [ [, , 3], [ 3 ] ], + PACKED_ELEMENTS: [ [O1, O2, O3], [O1, O2, O3] ], + HOLEY_ELEMENTS: [ [, , O3], [O3] ], + PACKED_DOUBLE_ELEMENTS: [ [E, NaN, PI], [E, NaN, PI] ], + HOLEY_DOUBLE_ELEMENTS: [ [, , NaN], [NaN] ], + + DICTIONARY_ELEMENTS: [ Object.defineProperties({ 10000: "world" }, { + 100: { enumerable: true, value: "hello" }, + 99: { enumerable: false, value: "nope" } + }), [ "hello", "world" ] ], + FAST_SLOPPY_ARGUMENTS_ELEMENTS: [ + fastSloppyArguments("a", "b", "c"), ["a", "b", "c"] ], + SLOW_SLOPPY_ARGUMENTS_ELEMENTS: [ + slowSloppyArguments("a", "b", "c"), [ "a", "b", "c", "X"]], + + FAST_STRING_WRAPPER_ELEMENTS: [ new String("str"), ["s", "t", "r"] ], + SLOW_STRING_WRAPPER_ELEMENTS: [ + Object.defineProperties(new String("str"), { + 10000: { enumerable: false, value: "X" }, + 9999: { enumerable: true, value: "Y" } + }), ["s", "t", "r", "Y"] ], + }; + + for (let [kind, [object, expected]] of Object.entries(element_kinds)) { + let result1 = Object.values(object); + assertEquals(expected, result1, `fast Object.values() with ${kind}`); + + let proxy = new Proxy(object, {}); + let result2 = Object.values(proxy); + assertEquals(result1, result2, `slow Object.values() with ${kind}`); + } +})(); diff --git a/implementation-contributed/v8/mjsunit/for-of-in-catch-duplicate-decl.js b/implementation-contributed/v8/mjsunit/for-of-in-catch-duplicate-decl.js new file mode 100644 index 0000000000..e1fdd43c94 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/for-of-in-catch-duplicate-decl.js @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertDoesNotThrow("try { } catch (e) { var e; for (var e of []) {} }") diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js b/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js index e69de29bb2..7181c10bea 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flat-species.js @@ -0,0 +1,29 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +{ + class MyArray extends Array { + static get [Symbol.species]() { + return Array; + } + } + + const wannabe = new MyArray(); + const flattened = wannabe.flat(Infinity); + assertEquals(false, flattened instanceof MyArray); + assertEquals(true, flattened instanceof Array); +} + +{ + class MyArray extends Array { + static get [Symbol.species]() { + return this; + } + } + + const wannabe = new MyArray(); + const flattened = wannabe.flat(Infinity); + assertEquals(true, flattened instanceof MyArray); + assertEquals(true, flattened instanceof Array); +} diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flat.js b/implementation-contributed/v8/mjsunit/harmony/array-flat.js index e69de29bb2..9a291dc3b0 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flat.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flat.js @@ -0,0 +1,63 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertEquals(Array.prototype.flat.length, 0); +assertEquals(Array.prototype.flat.name, 'flat'); + +{ + const input = [1, [2], [[3]]]; + + assertEquals(input.flat(), [1, 2, [3]]); + assertEquals(input.flat(1), [1, 2, [3]]); + assertEquals(input.flat(true), [1, 2, [3]]); + assertEquals(input.flat(undefined), [1, 2, [3]]); + + assertEquals(input.flat(-Infinity), [1, [2], [[3]]]); + assertEquals(input.flat(-1), [1, [2], [[3]]]); + assertEquals(input.flat(-0), [1, [2], [[3]]]); + assertEquals(input.flat(0), [1, [2], [[3]]]); + assertEquals(input.flat(false), [1, [2], [[3]]]); + assertEquals(input.flat(null), [1, [2], [[3]]]); + assertEquals(input.flat(''), [1, [2], [[3]]]); + assertEquals(input.flat('foo'), [1, [2], [[3]]]); + assertEquals(input.flat(/./), [1, [2], [[3]]]); + assertEquals(input.flat([]), [1, [2], [[3]]]); + assertEquals(input.flat({}), [1, [2], [[3]]]); + assertEquals( + input.flat(new Proxy({}, {})), [1, [2], [[3]]]); + assertEquals(input.flat((x) => x), [1, [2], [[3]]]); + assertEquals( + input.flat(String), [1, [2], [[3]]]); + + assertEquals(input.flat(2), [1, 2, 3]); + assertEquals(input.flat(Infinity), [1, 2, 3]); + + assertThrows(() => { input.flat(Symbol()); }, TypeError); + assertThrows(() => { input.flat(Object.create(null)); }, TypeError); +} + +{ + const input = { 0: 'a', 1: 'b', 2: 'c', length: 'wat' }; + assertEquals(Array.prototype.flat.call(input, Infinity), []); +} + +{ + let count = 0; + const input = { + get length() { ++count; return 0; } + }; + const result = Array.prototype.flat.call(input, Infinity); + assertEquals(count, 1); +} + +{ + const descriptor = Object.getOwnPropertyDescriptor( + Array.prototype, + 'flat' + ); + assertEquals(descriptor.value, Array.prototype.flat); + assertEquals(descriptor.writable, true); + assertEquals(descriptor.enumerable, false); + assertEquals(descriptor.configurable, true); +} diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js b/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js index e69de29bb2..48f9bea2d0 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flatMap-species.js @@ -0,0 +1,29 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +{ + class MyArray extends Array { + static get [Symbol.species]() { + return Array; + } + } + + const wannabe = new MyArray(); + const result = wannabe.flatMap(x => [x, x]); + assertEquals(false, result instanceof MyArray); + assertEquals(true, result instanceof Array); +} + +{ + class MyArray extends Array { + static get [Symbol.species]() { + return this; + } + } + + const wannabe = new MyArray(); + const result = wannabe.flatMap(x => [x, x]); + assertEquals(true, result instanceof MyArray); + assertEquals(true, result instanceof Array); +} diff --git a/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js b/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js index e69de29bb2..65a4025603 100644 --- a/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js +++ b/implementation-contributed/v8/mjsunit/harmony/array-flatMap.js @@ -0,0 +1,162 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +assertEquals(Array.prototype.flatMap.length, 1); +assertEquals(Array.prototype.flatMap.name, 'flatMap'); + +assertEquals( + [1, 2, 3, 4].flatMap((element) => [element, element ** 2]), + [1, 1, 2, 4, 3, 9, 4, 16] +); +assertEquals( + [1, 2, 3, 4].flatMap((element) => [[element, element ** 2]]), + [[1, 1], [2, 4], [3, 9], [4, 16]] +); + +{ + const elements = new Set([ + -Infinity, + -1, + -0, + +0, + +1, + Infinity, + null, + undefined, + true, + false, + '', + 'foo', + /./, + [], + {}, + Object.create(null), + new Proxy({}, {}), + Symbol(), + x => x ** 2, + String + ]); + + for (const value of elements) { + assertEquals( + [value].flatMap((element) => [element, element]), + [value, value] + ); + } +} + +{ + const array = [42]; + assertEquals( + [array].flatMap((element) => [element, element]), + [array, array] + ); +} + +{ + const nonCallables = new Set([ + -Infinity, + -1, + -0, + +0, + +1, + Infinity, + null, + undefined, + true, + false, + '', + 'foo', + /./, + [], + {}, + Object.create(null), + new Proxy({}, {}), + Symbol(), + ]); + for (const nonCallable of nonCallables) { + assertThrows(() => { + [].flatMap(nonCallable); + }, TypeError); + } +} + +{ + const object = { + foo: 42, + get length() { + object.foo = 0; + } + }; + const result = [object].flatMap((element) => [element, element]); + %HeapObjectVerify(result); + assertEquals(result, [object, object]); + assertEquals(result[0].foo, 42); +} + +assertThrows(() => { + Array.prototype.flatMap.call(null, (element) => element); +}, TypeError); +assertThrows(() => { + Array.prototype.flatMap.call(undefined, (element) => element); +}, TypeError); + +assertEquals( + Array.prototype.flatMap.call( + { + length: 1, + 0: 'a', + 1: 'b', + }, + (element) => element + ), + ['a'] +); +assertEquals( + Array.prototype.flatMap.call( + { + length: 2, + 0: 'a', + 1: 'b', + }, + (element) => element + ), + ['a', 'b'] +); + +{ + const result = [1, 2, 3].flatMap(function() { + return [this]; + }, 'abc'); + assertEquals(true, result[0] == 'abc'); + assertEquals(true, result[1] == 'abc'); + assertEquals(true, result[2] == 'abc'); +} + +{ + const input = { 0: 'a', 1: 'b', 2: 'c', length: 'wat' }; + assertEquals(Array.prototype.flatMap.call(input, x => [x]), []); +} + +{ + let count = 0; + const input = { + get length() { ++count; return 0; } + }; + const result = Array.prototype.flatMap.call(input, x => [x]); + assertEquals(count, 1); +} + +{ + const descriptor = Object.getOwnPropertyDescriptor( + Array.prototype, + 'flatMap' + ); + assertEquals(descriptor.value, Array.prototype.flatMap); + assertEquals(descriptor.writable, true); + assertEquals(descriptor.enumerable, false); + assertEquals(descriptor.configurable, true); +} diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js index e69de29bb2..c1ec4070f4 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/basics.js @@ -0,0 +1,140 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs + +(function TestConstructFinalizationGroup() { + let fg = new FinalizationGroup(() => {}); + assertEquals(fg.toString(), "[object FinalizationGroup]"); + assertNotSame(fg.__proto__, Object.prototype); + assertSame(fg.__proto__.__proto__, Object.prototype); +})(); + +(function TestFinalizationGroupConstructorCallAsFunction() { + let caught = false; + let message = ""; + try { + let f = FinalizationGroup(() => {}); + } catch (e) { + message = e.message; + caught = true; + } finally { + assertTrue(caught); + assertEquals(message, "Constructor FinalizationGroup requires 'new'"); + } +})(); + +(function TestConstructFinalizationGroupCleanupNotCallable() { + let message = "FinalizationGroup: cleanup must be callable"; + assertThrows(() => { let fg = new FinalizationGroup(); }, TypeError, message); + assertThrows(() => { let fg = new FinalizationGroup(1); }, TypeError, message); + assertThrows(() => { let fg = new FinalizationGroup(null); }, TypeError, message); +})(); + +(function TestConstructFinalizationGroupWithCallableProxyAsCleanup() { + let handler = {}; + let obj = () => {}; + let proxy = new Proxy(obj, handler); + let fg = new FinalizationGroup(proxy); +})(); + +(function TestConstructFinalizationGroupWithNonCallableProxyAsCleanup() { + let message = "FinalizationGroup: cleanup must be callable"; + let handler = {}; + let obj = {}; + let proxy = new Proxy(obj, handler); + assertThrows(() => { let fg = new FinalizationGroup(proxy); }, TypeError, message); +})(); + +(function TestRegisterWithNonObjectTarget() { + let fg = new FinalizationGroup(() => {}); + let message = "FinalizationGroup.prototype.register: target must be an object"; + assertThrows(() => fg.register(1, "holdings"), TypeError, message); + assertThrows(() => fg.register(false, "holdings"), TypeError, message); + assertThrows(() => fg.register("foo", "holdings"), TypeError, message); + assertThrows(() => fg.register(Symbol(), "holdings"), TypeError, message); + assertThrows(() => fg.register(null, "holdings"), TypeError, message); + assertThrows(() => fg.register(undefined, "holdings"), TypeError, message); +})(); + +(function TestRegisterWithProxy() { + let handler = {}; + let obj = {}; + let proxy = new Proxy(obj, handler); + let fg = new FinalizationGroup(() => {}); + fg.register(proxy); +})(); + +(function TestRegisterTargetAndHoldingsSameValue() { + let fg = new FinalizationGroup(() => {}); + let obj = {a: 1}; + // SameValue(target, holdings) not ok + assertThrows(() => fg.register(obj, obj), TypeError, + "FinalizationGroup.prototype.register: target and holdings must not be same"); + let holdings = {a: 1}; + fg.register(obj, holdings); +})(); + +(function TestRegisterWithoutFinalizationGroup() { + assertThrows(() => FinalizationGroup.prototype.register.call({}, {}, "holdings"), TypeError); + // Does not throw: + let fg = new FinalizationGroup(() => {}); + FinalizationGroup.prototype.register.call(fg, {}, "holdings"); +})(); + +(function TestUnregisterWithNonExistentKey() { + let fg = new FinalizationGroup(() => {}); + fg.unregister({"k": "whatever"}); +})(); + +(function TestWeakRefConstructor() { + let wr = new WeakRef({}); + assertEquals(wr.toString(), "[object WeakRef]"); + assertNotSame(wr.__proto__, Object.prototype); + + let deref_desc = Object.getOwnPropertyDescriptor(wr.__proto__, "deref"); + assertEquals(true, deref_desc.configurable); + assertEquals(false, deref_desc.enumerable); + assertEquals("function", typeof deref_desc.value); +})(); + +(function TestWeakRefConstructorWithNonObject() { + let message = "WeakRef: target must be an object"; + assertThrows(() => new WeakRef(), TypeError, message); + assertThrows(() => new WeakRef(1), TypeError, message); + assertThrows(() => new WeakRef(false), TypeError, message); + assertThrows(() => new WeakRef("foo"), TypeError, message); + assertThrows(() => new WeakRef(Symbol()), TypeError, message); + assertThrows(() => new WeakRef(null), TypeError, message); + assertThrows(() => new WeakRef(undefined), TypeError, message); +})(); + +(function TestWeakRefConstructorCallAsFunction() { + let caught = false; + let message = ""; + try { + let f = WeakRef({}); + } catch (e) { + message = e.message; + caught = true; + } finally { + assertTrue(caught); + assertEquals(message, "Constructor WeakRef requires 'new'"); + } +})(); + +(function TestWeakRefWithProxy() { + let handler = {}; + let obj = {}; + let proxy = new Proxy(obj, handler); + let wr = new WeakRef(proxy); +})(); + +(function TestCleanupSomeWithoutFinalizationGroup() { + assertThrows(() => FinalizationGroup.prototype.cleanupSome.call({}), TypeError); + // Does not throw: + let fg = new FinalizationGroup(() => {}); + let rv = FinalizationGroup.prototype.cleanupSome.call(fg); + assertEquals(undefined, rv); +})(); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js index f8e44c355c..20726284bb 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js @@ -7,48 +7,47 @@ let cleanup_call_count = 0; let cleanup = function(iter) { if (cleanup_call_count == 0) { - // First call: iterate 2 of the 3 cells - let cells = []; - for (wc of iter) { - cells.push(wc); - // Don't iterate the rest of the cells - if (cells.length == 2) { + // First call: iterate 2 of the 3 holdings + let holdings_list = []; + for (holdings of iter) { + holdings_list.push(holdings); + // Don't iterate the rest of the holdings + if (holdings_list.length == 2) { break; } } - assertEquals(cells.length, 2); - assertTrue(cells[0].holdings < 3); - assertTrue(cells[1].holdings < 3); + assertEquals(holdings_list.length, 2); + assertTrue(holdings_list[0] < 3); + assertTrue(holdings_list[1] < 3); // Update call count only after the asserts; this ensures that the test // fails even if the exceptions inside the cleanup function are swallowed. cleanup_call_count++; } else { - // Second call: iterate one leftover cell and one new cell. + // Second call: iterate one leftover holdings and one holdings. assertEquals(1, cleanup_call_count); - let cells = []; - for (wc of iter) { - cells.push(wc); + let holdings_list = []; + for (holdings of iter) { + holdings_list.push(holdings); } - assertEquals(cells.length, 2); - assertTrue((cells[0].holdings < 3 && cells[1].holdings == 100) || - (cells[1].holdings < 3 && cells[0].holdings == 100)); + assertEquals(holdings_list.length, 2); + assertTrue((holdings_list[0] < 3 && holdings_list[1] == 100) || + (holdings_list[1] < 3 && holdings_list[0] == 100)); // Update call count only after the asserts; this ensures that the test // fails even if the exceptions inside the cleanup function are swallowed. cleanup_call_count++; } } -let wf = new WeakFactory(cleanup); -// Create 3 objects and WeakCells pointing to them. The objects need to be -// inside a closure so that we can reliably kill them! -let weak_cells = []; +let fg = new FinalizationGroup(cleanup); +// Create 3 objects and register them in the FinalizationGroup. The objects need +// to be inside a closure so that we can reliably kill them! (function() { let objects = []; for (let i = 0; i < 3; ++i) { objects[i] = {a: i}; - weak_cells[i] = wf.makeCell(objects[i], i); + fg.register(objects[i], i); } gc(); @@ -58,14 +57,14 @@ let weak_cells = []; objects = []; })(); -// This GC will discover dirty WeakCells. +// This GC will reclaim the targets. gc(); assertEquals(0, cleanup_call_count); let timeout_func_1 = function() { assertEquals(1, cleanup_call_count); - // Assert that the cleanup function won't be called unless new WeakCells appear. + // Assert that the cleanup function won't be called unless new targets appear. setTimeout(timeout_func_2, 0); } @@ -74,9 +73,9 @@ setTimeout(timeout_func_1, 0); let timeout_func_2 = function() { assertEquals(1, cleanup_call_count); - // Create a new WeakCells to be cleaned up. + // Create a new object and register it. let obj = {}; - let wc = wf.makeCell(obj, 100); + let wc = fg.register(obj, 100); obj = null; gc(); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js index e69de29bb2..97ab1dbd80 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js @@ -0,0 +1,34 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +let r = Realm.create(); + +let cleanup = Realm.eval(r, "var stored_global; function cleanup() { stored_global = globalThis; } cleanup"); +let realm_global_this = Realm.eval(r, "globalThis"); + +let fg = new FinalizationGroup(cleanup); + +// Create an object and a register it in the FinalizationGroup. The object needs +// to be inside a closure so that we can reliably kill them! +let weak_cell; + +(function() { + let object = {}; + fg.register(object, {}); + + // object goes out of scope. +})(); + +gc(); + +// Assert that the cleanup function was called in its Realm. +let timeout_func = function() { + let stored_global = Realm.eval(r, "stored_global;"); + assertNotEquals(stored_global, globalThis); + assertEquals(stored_global, realm_global_this); +} + +setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js index e69de29bb2..c6b834e8fb 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js @@ -0,0 +1,56 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +// This test asserts that the cleanup function call, scheduled by GC, is a +// microtask and not a normal task. + +// Inside a microtask, cause GC (which should schedule the cleanup as +// microtask). lso schedule another microtask. Assert that the cleanup +// function ran before the other microtask. + +function scheduleMicrotask(func) { + Promise.resolve().then(func); +} + +let log = []; + +let cleanup = (iter) => { + log.push("cleanup"); + for (holdings of iter) { } +} + +let fg = new FinalizationGroup(cleanup); +let o = null; + +(function() { + // Use a closure here to avoid other references to o which might keep it alive + // (e.g., stack frames pointing to it). + o = {}; + fg.register(o, {}); +})(); + +let microtask_after_cleanup = () => { + log.push("microtask_after_cleanup"); +} + +let first_microtask = function() { + log.push("first_microtask"); + + // This schedules the cleanup function as microtask. + o = null; + gc(); + + // Schedule a microtask which should run after the cleanup microtask. + scheduleMicrotask(microtask_after_cleanup); +} + +scheduleMicrotask(first_microtask); + +setTimeout(() => { + // Assert that the functions got called in the right order. + let wanted_log = ["first_microtask", "cleanup", "microtask_after_cleanup"]; + assertEquals(wanted_log, log); +}, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js index e69de29bb2..1d275a19aa 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js @@ -0,0 +1,34 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +let r = Realm.create(); + +let cleanup = Realm.eval(r, "var stored_global; let cleanup = new Proxy(function() { stored_global = globalThis;}, {}); cleanup"); +let realm_global_this = Realm.eval(r, "globalThis"); + +let fg = new FinalizationGroup(cleanup); + +// Create an object and register it in the FinalizationGroup. The object needs +// to be inside a closure so that we can reliably kill them! +let weak_cell; + +(function() { + let object = {}; + fg.register(object, "holdings"); + + // object goes out of scope. +})(); + +gc(); + +// Assert that the cleanup function was called in its Realm. +let timeout_func = function() { + let stored_global = Realm.eval(r, "stored_global;"); + assertNotEquals(stored_global, globalThis); + assertEquals(stored_global, realm_global_this); +} + +setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js index 631f43c012..0cef0a1af5 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js @@ -5,31 +5,31 @@ // Flags: --harmony-weak-refs --expose-gc --noincremental-marking let cleanup_count = 0; -let cleanup_cells = []; +let cleanup_holdings = []; let cleanup = function(iter) { - for (wc of iter) { - cleanup_cells.push(wc); + for (holdings of iter) { + cleanup_holdings.push(holdings); } ++cleanup_count; } -let wf = new WeakFactory(cleanup); -let weak_cell; +let fg = new FinalizationGroup(cleanup); +let key = {"k": "this is the key"}; (function() { let o = {}; - weak_cell = wf.makeCell(o); + weak_cell = fg.register(o, "holdings", key); - // cleanupSome won't do anything since there are no dirty WeakCells. - wf.cleanupSome(); + // cleanupSome won't do anything since there are no reclaimed targets. + fg.cleanupSome(); assertEquals(0, cleanup_count); })(); // GC will detect the WeakCell as dirty. gc(); -// Clear the WeakCell just before we would've called cleanupSome. -weak_cell.clear(); +// Unregister the tracked object just before calling cleanupSome. +fg.unregister(key); -wf.cleanupSome(); +fg.cleanupSome(); assertEquals(0, cleanup_count); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome.js index 84a946d390..1d3ceda3f2 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/cleanupsome.js @@ -5,29 +5,28 @@ // Flags: --harmony-weak-refs --expose-gc --noincremental-marking let cleanup_count = 0; -let cleanup_cells = []; +let cleanup_holdings = []; let cleanup = function(iter) { - for (wc of iter) { - cleanup_cells.push(wc); + for (holdings of iter) { + cleanup_holdings.push(holdings); } ++cleanup_count; } -let wf = new WeakFactory(cleanup); -let weak_cell; +let fg = new FinalizationGroup(cleanup); (function() { let o = {}; - weak_cell = wf.makeCell(o); + fg.register(o, "holdings"); - // cleanupSome won't do anything since there are no dirty WeakCells. - wf.cleanupSome(); + // cleanupSome won't do anything since there are no reclaimed targets. + fg.cleanupSome(); assertEquals(0, cleanup_count); })(); -// GC will detect the WeakCell as dirty. +// GC will detect o as dead. gc(); -wf.cleanupSome(); +fg.cleanupSome(); assertEquals(1, cleanup_count); -assertEquals(1, cleanup_cells.length); -assertEquals(weak_cell, cleanup_cells[0]); +assertEquals(1, cleanup_holdings.length); +assertEquals("holdings", cleanup_holdings[0]); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js index 367cd9a9c0..ea35a2e63f 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js @@ -7,18 +7,19 @@ let cleanup_called = false; let cleanup = function(iter) { assertFalse(cleanup_called); - let cells = []; - for (wc of iter) { - cells.push(wc); + let holdings_list = []; + for (holdings of iter) { + holdings_list.push(holdings); } - assertEquals(cells.length, 1); - assertEquals(cells[0].holdings, "this is my cell"); + assertEquals(holdings_list.length, 1); + assertEquals(holdings_list[0].a, "this is the holdings object"); cleanup_called = true; } -let wf = new WeakFactory(cleanup); +let fg = new FinalizationGroup(cleanup); let o1 = {}; -let wc1 = wf.makeCell(o1, "this is my cell"); +let holdings = {'a': 'this is the holdings object'}; +fg.register(o1, holdings); gc(); assertFalse(cleanup_called); @@ -26,9 +27,9 @@ assertFalse(cleanup_called); // Drop the last references to o1. o1 = null; -// Drop the last reference to the WeakCell. The WeakFactory keeps it alive, so -// the cleanup function will be called as normal. -wc1 = null; +// Drop the last reference to the holdings. The FinalizationGroup keeps it +// alive, so the cleanup function will be called as normal. +holdings = null; gc(); assertFalse(cleanup_called); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js index f6627be19e..bd66f1ce1d 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js @@ -7,27 +7,26 @@ let cleanup_called = false; let cleanup = function(iter) { assertFalse(cleanup_called); - let cells = []; - for (wc of iter) { - cells.push(wc); + let holdings_list = []; + for (holdings of iter) { + holdings_list.push(holdings); } - assertEquals(1, cells.length); - assertEquals(weak_cell, cells[0]); + assertEquals(1, holdings_list.length); + assertEquals("holdings", holdings_list[0]); cleanup_called = true; } -let wf = new WeakFactory(cleanup); +let fg = new FinalizationGroup(cleanup); let weak_ref; -let weak_cell; (function() { let o = {}; weak_ref = new WeakRef(o); - weak_cell = wf.makeCell(o); + fg.register(o, "holdings"); })(); // Since the WeakRef was created during this turn, it is not cleared by GC. The -// WeakCell is not cleared either, since the WeakRef keeps the target object -// alive. +// pointer inside the FinalizationGroup is not cleared either, since the WeakRef +// keeps the target object alive. gc(); (function() { assertNotEquals(undefined, weak_ref.deref()); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js index 2f3915478e..a1cff3aaa0 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js @@ -6,66 +6,66 @@ // Flags: --no-stress-flush-bytecode let cleanup0_call_count = 0; -let cleanup0_weak_cell_count = 0; +let cleanup0_holdings_count = 0; let cleanup1_call_count = 0; -let cleanup1_weak_cell_count = 0; +let cleanup1_holdings_count = 0; let cleanup0 = function(iter) { - for (wc of iter) { - ++cleanup0_weak_cell_count; + for (holdings of iter) { + ++cleanup0_holdings_count; } ++cleanup0_call_count; } let cleanup1 = function(iter) { - for (wc of iter) { - ++cleanup1_weak_cell_count; + for (holdings of iter) { + ++cleanup1_holdings_count; } ++cleanup1_call_count; } -let wf0 = new WeakFactory(cleanup0); -let wf1 = new WeakFactory(cleanup1); +let fg0 = new FinalizationGroup(cleanup0); +let fg1 = new FinalizationGroup(cleanup1); -// Create 1 WeakCell for each WeakFactory and kill the objects they point to. +// Register 1 weak reference for each FinalizationGroup and kill the objects they point to. (function() { // The objects need to be inside a closure so that we can reliably kill them. let objects = []; objects[0] = {}; objects[1] = {}; - wf0.makeCell(objects[0]); - wf1.makeCell(objects[1]); + fg0.register(objects[0], "holdings0-0"); + fg1.register(objects[1], "holdings1-0"); // Drop the references to the objects. objects = []; - // Will schedule both wf0 and wf1 for cleanup. + // Will schedule both fg0 and fg1 for cleanup. gc(); })(); // Before the cleanup task has a chance to run, do the same thing again, so both -// factories are (again) scheduled for cleanup. This has to be a IIFE function +// FinalizationGroups are (again) scheduled for cleanup. This has to be a IIFE function // (so that we can reliably kill the objects) so we cannot use the same function // as before. (function() { let objects = []; objects[0] = {}; objects[1] = {}; - wf0.makeCell(objects[0]); - wf1.makeCell(objects[1]); + fg0.register(objects[0], "holdings0-1"); + fg1.register(objects[1], "holdings1-1"); objects = []; gc(); })(); let timeout_func = function() { assertEquals(1, cleanup0_call_count); - assertEquals(2, cleanup0_weak_cell_count); + assertEquals(2, cleanup0_holdings_count); assertEquals(1, cleanup1_call_count); - assertEquals(2, cleanup1_weak_cell_count); + assertEquals(2, cleanup1_holdings_count); } -// Give the cleanup task a chance to run. All WeakCells to cleanup will be -// available during the same invocation of the cleanup function. +// Give the cleanup task a chance to run. All holdings will be iterated during +// the same invocation of the cleanup function. setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-in-cleanup.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-in-cleanup.js index 9fef051122..73aac76378 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-in-cleanup.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/iterating-in-cleanup.js @@ -7,29 +7,25 @@ let cleanup_called = false; let cleanup = function(iter) { assertFalse(cleanup_called); - let cells = []; - for (wc of iter) { - cells.push(wc); + let holdings_list = []; + for (holdings of iter) { + holdings_list.push(holdings); } - assertEquals(cells.length, 2); - if (cells[0] == wc1) { - assertEquals(cells[0].holdings, 1); - assertEquals(cells[1], wc2); - assertEquals(cells[1].holdings, 2); + assertEquals(holdings_list.length, 2); + if (holdings_list[0] == 1) { + assertEquals(holdings_list[1], 2); } else { - assertEquals(cells[0], wc2); - assertEquals(cells[0].holdings, 2); - assertEquals(cells[1], wc1); - assertEquals(cells[1].holdings, 1); + assertEquals(holdings_list[0], 2); + assertEquals(holdings_list[1], 1); } cleanup_called = true; } -let wf = new WeakFactory(cleanup); +let fg = new FinalizationGroup(cleanup); let o1 = {}; let o2 = {}; -let wc1 = wf.makeCell(o1, 1); -let wc2 = wf.makeCell(o2, 2); +fg.register(o1, 1); +fg.register(o2, 2); gc(); assertFalse(cleanup_called); @@ -37,8 +33,8 @@ assertFalse(cleanup_called); // Drop the last references to o1 and o2. o1 = null; o2 = null; -// GC will clear the WeakCells; the cleanup function will be called the next time -// we enter the event loop. +// GC will reclaim the target objects; the cleanup function will be called the +// next time we enter the event loop. gc(); assertFalse(cleanup_called); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js index 98a33df240..51e721401a 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js @@ -5,28 +5,26 @@ // Flags: --harmony-weak-refs --expose-gc --noincremental-marking let cleanup_call_count = 0; -let cleanup_weak_cell_count = 0; +let cleanup_holdings_count = 0; let cleanup = function(iter) { - for (wc of iter) { - ++cleanup_weak_cell_count; + for (holdings of iter) { + ++cleanup_holdings_count; } ++cleanup_call_count; } -let wf1 = new WeakFactory(cleanup); -let wf2 = new WeakFactory(cleanup); +let fg1 = new FinalizationGroup(cleanup); +let fg2 = new FinalizationGroup(cleanup); -// Create two objects and WeakCells pointing to them. The objects need to be inside -// a closure so that we can reliably kill them! -let weak_cell1; -let weak_cell2; +// Create two objects and register them in FinalizationGroups. The objects need +// to be inside a closure so that we can reliably kill them! (function() { let object1 = {}; - weak_cell1 = wf1.makeCell(object1); + fg1.register(object1, "holdings1"); let object2 = {}; - weak_cell2 = wf2.makeCell(object2); + fg2.register(object2, "holdings2"); // object1 and object2 go out of scope. })(); @@ -35,10 +33,10 @@ let weak_cell2; gc(); assertEquals(0, cleanup_call_count); -// Assert that the cleanup function was called and iterated the WeakCells. +// Assert that the cleanup function was called and iterated the holdings. let timeout_func = function() { assertEquals(2, cleanup_call_count); - assertEquals(2, cleanup_weak_cell_count); + assertEquals(2, cleanup_holdings_count); } setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/undefined-holdings.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/undefined-holdings.js new file mode 100644 index 0000000000..ac3dc6041a --- /dev/null +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/undefined-holdings.js @@ -0,0 +1,39 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +let cleanup_call_count = 0; +let cleanup_holdings_count = 0; +let cleanup = function(iter) { + for (holdings of iter) { + assertEquals(holdings, undefined); + ++cleanup_holdings_count; + } + ++cleanup_call_count; +} + +let fg = new FinalizationGroup(cleanup); + +// Create an object and register it in the FinalizationGroup. The object needs to be inside +// a closure so that we can reliably kill them! + +(function() { + let object = {}; + fg.register(object); + + // object goes out of scope. +})(); + +// This GC will reclaim the target object and schedule cleanup. +gc(); +assertEquals(0, cleanup_call_count); + +// Assert that the cleanup function was called and iterated the holdings. +let timeout_func = function() { + assertEquals(1, cleanup_call_count); + assertEquals(1, cleanup_holdings_count); +} + +setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-after-cleanup.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-after-cleanup.js index 3392d7fbb9..f6480f86b6 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-after-cleanup.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-after-cleanup.js @@ -5,42 +5,42 @@ // Flags: --harmony-weak-refs --expose-gc --noincremental-marking let cleanup_call_count = 0; -let cleanup_weak_cell_count = 0; +let cleanup_holdings_count = 0; let cleanup = function(iter) { - for (wc of iter) { - assertSame(wc, weak_cell); - ++cleanup_weak_cell_count; + for (holdings of iter) { + assertEquals("holdings", holdings); + ++cleanup_holdings_count; } ++cleanup_call_count; } -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside -// a closure so that we can reliably kill them! -let weak_cell; +let fg = new FinalizationGroup(cleanup); +let key = {"k": "this is the key"}; +// Create an object and register it in the FinalizationGroup. The object needs +// to be inside a closure so that we can reliably kill them! (function() { let object = {}; - weak_cell = wf.makeCell(object); + fg.register(object, "holdings", key); // object goes out of scope. })(); -// This GC will discover dirty WeakCells and schedule cleanup. +// This GC will reclaim the target object and schedule cleanup. gc(); assertEquals(0, cleanup_call_count); -// Assert that the cleanup function was called and iterated the WeakCell. +// Assert that the cleanup function was called and iterated the holdings. let timeout_func = function() { assertEquals(1, cleanup_call_count); - assertEquals(1, cleanup_weak_cell_count); + assertEquals(1, cleanup_holdings_count); - // Clear an already iterated over WeakCell. - weak_cell.clear(); + // Unregister an already iterated over weak reference. + fg.unregister(key); // Assert that it didn't do anything. setTimeout(() => { assertEquals(1, cleanup_call_count); }, 0); - setTimeout(() => { assertEquals(1, cleanup_weak_cell_count); }, 0); + setTimeout(() => { assertEquals(1, cleanup_holdings_count); }, 0); } setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-before-cleanup.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-before-cleanup.js index 1fd0fbf3b0..10b8bc67ff 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-before-cleanup.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-before-cleanup.js @@ -9,30 +9,27 @@ let cleanup = function(iter) { ++cleanup_call_count; } -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside -// a closure so that we can reliably kill them! -let weak_cell; +let fg = new FinalizationGroup(cleanup); +let key = {"k": "this is the key"}; +// Create an object and register it in the FinalizationGroup. The object needs +// to be inside a closure so that we can reliably kill them! (function() { let object = {}; - weak_cell = wf.makeCell(object, "my holdings"); + fg.register(object, "my holdings", key); // Clear the WeakCell before the GC has a chance to discover it. - let return_value = weak_cell.clear(); + let return_value = fg.unregister(key); assertEquals(undefined, return_value); - // Assert holdings got cleared too. - assertEquals(undefined, weak_cell.holdings); - // object goes out of scope. })(); -// This GC will discover dirty WeakCells. +// This GC will reclaim the target object. gc(); assertEquals(0, cleanup_call_count); -// Assert that the cleanup function won't be called, since the WeakCell was cleared. +// Assert that the cleanup function won't be called, since we called unregister. let timeout_func = function() { assertEquals(0, cleanup_call_count); } diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-called-twice.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-called-twice.js new file mode 100644 index 0000000000..e6ea150027 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-called-twice.js @@ -0,0 +1,40 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +let cleanup_call_count = 0; +let cleanup = function(iter) { + ++cleanup_call_count; +} + +let fg = new FinalizationGroup(cleanup); +let key = {"k": "this is the key"}; +// Create an object and register it in the FinalizationGroup. The object needs +// to be inside a closure so that we can reliably kill them! + +(function() { + let object = {}; + fg.register(object, "holdings", key); + + // Unregister before the GC has a chance to discover the object. + fg.unregister(key); + + // Call unregister again (just to assert we handle this gracefully). + fg.unregister(key); + + // object goes out of scope. +})(); + +// This GC will reclaim the target object. +gc(); +assertEquals(0, cleanup_call_count); + +// Assert that the cleanup function won't be called, since the weak reference +// was unregistered. +let timeout_func = function() { + assertEquals(0, cleanup_call_count); +} + +setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js index 6c06d7af74..aa9eab20ff 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js @@ -5,37 +5,37 @@ // Flags: --harmony-weak-refs --expose-gc --noincremental-marking let cleanup_call_count = 0; -let cleanup_weak_cell_count = 0; +let cleanup_holdings_count = 0; let cleanup = function(iter) { - // Clear the WeakCell before we've iterated through it. - weak_cell.clear(); + // Unregister before we've iterated through the holdings. + fg.unregister(key); for (wc of iter) { - ++cleanup_weak_cell_count; + ++cleanup_holdings_count; } ++cleanup_call_count; } -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside -// a closure so that we can reliably kill them! -let weak_cell; +let fg = new FinalizationGroup(cleanup); +let key = {"k": "the key"}; +// Create an object and register it in the FinalizationGroup. The object needs +// to be inside a closure so that we can reliably kill them! (function() { let object = {}; - weak_cell = wf.makeCell(object); + fg.register(object, "holdings", key); // object goes out of scope. })(); -// This GC will discover dirty WeakCells and schedule cleanup. +// This GC will discover unretained targets and schedule cleanup. gc(); assertEquals(0, cleanup_call_count); -// Assert that the cleanup function was called, but didn't iterate any weak cells. +// Assert that the cleanup function was called, but didn't iterate any holdings. let timeout_func = function() { assertEquals(1, cleanup_call_count); - assertEquals(0, cleanup_weak_cell_count); + assertEquals(0, cleanup_holdings_count); } setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js index 0aab366f97..84ec3aaef8 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js @@ -5,24 +5,24 @@ // Flags: --harmony-weak-refs --expose-gc --noincremental-marking let cleanup_call_count = 0; -let cleanup_weak_cell_count = 0; +let cleanup_holdings_count = 0; let cleanup = function(iter) { - for (wc of iter) { - assertSame(wc, weak_cell); - wc.clear(); - ++cleanup_weak_cell_count; + for (holdings of iter) { + assertEquals(holdings, "holdings"); + fg.unregister(key); + ++cleanup_holdings_count; } ++cleanup_call_count; } -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside +let fg = new FinalizationGroup(cleanup); +// Create an object and register it in the FinalizationGroup. The object needs to be inside // a closure so that we can reliably kill them! -let weak_cell; +let key = {"k": "this is the key"}; (function() { let object = {}; - weak_cell = wf.makeCell(object); + fg.register(object, "holdings", key); // object goes out of scope. })(); @@ -34,7 +34,7 @@ assertEquals(0, cleanup_call_count); // Assert that the cleanup function was called and iterated the WeakCell. let timeout_func = function() { assertEquals(1, cleanup_call_count); - assertEquals(1, cleanup_weak_cell_count); + assertEquals(1, cleanup_holdings_count); } setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js index 9dcea5ded5..39706a7b9b 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js @@ -5,37 +5,38 @@ // Flags: --harmony-weak-refs --expose-gc --noincremental-marking let cleanup_call_count = 0; -let cleanup_weak_cell_count = 0; +let cleanup_holdings_count = 0; let cleanup = function(iter) { - for (wc of iter) { - assertSame(wc, weak_cell); - ++cleanup_weak_cell_count; + for (holdings of iter) { + assertEquals(holdings, "holdings"); + ++cleanup_holdings_count; } - // Clear an already iterated over WeakCell. - weak_cell.clear(); + // Unregister an already iterated over weak reference. + fg.unregister(key); ++cleanup_call_count; } -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside +let fg = new FinalizationGroup(cleanup); +let key = {"k": "this is the key"}; + +// Create an object and register it in the FinalizationGroup. The object needs to be inside // a closure so that we can reliably kill them! -let weak_cell; (function() { let object = {}; - weak_cell = wf.makeCell(object); + fg.register(object, "holdings", key); // object goes out of scope. })(); -// This GC will discover dirty WeakCells and schedule cleanup. +// This GC will reclaim the target object and schedule cleanup. gc(); assertEquals(0, cleanup_call_count); -// Assert that the cleanup function was called and iterated the WeakCell. +// Assert that the cleanup function was called and iterated the holdings. let timeout_func = function() { assertEquals(1, cleanup_call_count); - assertEquals(1, cleanup_weak_cell_count); + assertEquals(1, cleanup_holdings_count); } setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js new file mode 100644 index 0000000000..67ed227502 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js @@ -0,0 +1,48 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +let cleanup_call_count = 0; +let cleanup_holdings_count = 0; +let cleanup = function(iter) { + for (holdings of iter) { + // See which target we're iterating over and unregister the other one. + if (holdings == 1) { + fg.unregister(key2); + } else { + assertSame(holdings, 2); + fg.unregister(key1); + } + ++cleanup_holdings_count; + } + ++cleanup_call_count; +} + +let fg = new FinalizationGroup(cleanup); +let key1 = {"k": "first key"}; +let key2 = {"k": "second key"}; +// Create two objects and register them in the FinalizationGroup. The objects +// need to be inside a closure so that we can reliably kill them! + +(function() { + let object1 = {}; + fg.register(object1, 1, key1); + let object2 = {}; + fg.register(object2, 2, key2); + + // object1 and object2 go out of scope. +})(); + +// This GC will reclaim target objects and schedule cleanup. +gc(); +assertEquals(0, cleanup_call_count); + +// Assert that the cleanup function was called and iterated one holdings (but not the other one). +let timeout_func = function() { + assertEquals(1, cleanup_call_count); + assertEquals(1, cleanup_holdings_count); +} + +setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-many.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-many.js new file mode 100644 index 0000000000..748b7065c6 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-many.js @@ -0,0 +1,50 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +let cleanup_call_count = 0; +let cleanup_holdings_count = 0; +let cleanup = function(iter) { + for (holdings of iter) { + assertEquals("holdings2", holdings); + ++cleanup_holdings_count; + } + ++cleanup_call_count; +} + +let fg = new FinalizationGroup(cleanup); +let key1 = {"k": "key1"}; +let key2 = {"k": "key2"}; +// Create three objects and register them in the FinalizationGroup. The objects +// need to be inside a closure so that we can reliably kill them! + +(function() { + let object1a = {}; + fg.register(object1a, "holdings1a", key1); + + let object1b = {}; + fg.register(object1b, "holdings1b", key1); + + let object2 = {}; + fg.register(object2, "holdings2", key2); + + // Unregister before the GC has a chance to discover the objects. + fg.unregister(key1); + + // objects go out of scope. +})(); + +// This GC will reclaim the target objects. +gc(); +assertEquals(0, cleanup_call_count); + +// Assert that the cleanup function will be called only for the reference which +// was not unregistered. +let timeout_func = function() { + assertEquals(1, cleanup_call_count); + assertEquals(1, cleanup_holdings_count); +} + +setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js index 159fb0b140..2466568397 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js @@ -9,14 +9,14 @@ let cleanup = function(iter) { ++cleanup_call_count; } -let wf = new WeakFactory(cleanup); -// Create an object and a WeakCell pointing to it. The object needs to be inside +let key = {"k": "this is my key"}; +let fg = new FinalizationGroup(cleanup); +// Create an object and register it in the FinalizationGroup. The object needs to be inside // a closure so that we can reliably kill them! -let weak_cell; (function() { let object = {}; - weak_cell = wf.makeCell(object); + fg.register(object, {}, key); // object goes out of scope. })(); @@ -25,10 +25,10 @@ let weak_cell; gc(); assertEquals(0, cleanup_call_count); -// Clear the WeakCell before cleanup has ran. -weak_cell.clear(); +// Unregister the object from the FinalizationGroup before cleanup has ran. +fg.unregister(key); -// Assert that the cleanup function won't be called, since the WeakCell was cleared. +// Assert that the cleanup function won't be called. let timeout_func = function() { assertEquals(0, cleanup_call_count); } diff --git a/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js b/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js index e69de29bb2..170a52df10 100644 --- a/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js +++ b/implementation-contributed/v8/mjsunit/harmony/weakrefs/weak-cell-basics.js @@ -0,0 +1,37 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-weak-refs --expose-gc --noincremental-marking + +let cleanup_called = false; +let cleanup = function(iter) { + assertFalse(cleanup_called); + let result = iter.next(); + assertEquals(result.value, holdings); + assertFalse(result.done); + result = iter.next(); + assertTrue(result.done); + cleanup_called = true; +} + +let fg = new FinalizationGroup(cleanup); +let o = {}; +let holdings = {'h': 55}; +fg.register(o, holdings); + +gc(); +assertFalse(cleanup_called); + +// Drop the last reference to o. +o = null; +// GC will clear the WeakCell; the cleanup function will be called the next time +// we enter the event loop. +gc(); +assertFalse(cleanup_called); + +let timeout_func = function() { + assertTrue(cleanup_called); +} + +setTimeout(timeout_func, 0); diff --git a/implementation-contributed/v8/mjsunit/integrity-level-map-update.js b/implementation-contributed/v8/mjsunit/integrity-level-map-update.js new file mode 100644 index 0000000000..b4e066f7de --- /dev/null +++ b/implementation-contributed/v8/mjsunit/integrity-level-map-update.js @@ -0,0 +1,166 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function SealAndReconfigure() { + function C() { this.x = 1; this.y = 1; Object.seal(this); } + + let c1 = new C(); + + c1.x = 0.1; + + let c2 = new C(); + let c3 = new C(); + let c4 = new C(); + + // The objects c2, c3 and c4 should follow the same transition + // path that we reconfigured c1 to. + assertTrue(%HaveSameMap(c1, c2)); + assertTrue(%HaveSameMap(c1, c3)); + assertTrue(%HaveSameMap(c1, c4)); + + c2.x = 0.1; + c3.x = 0.1; + c4.x = 0.1; + + assertTrue(%HaveSameMap(c1, c2)); + assertTrue(%HaveSameMap(c1, c3)); + assertTrue(%HaveSameMap(c1, c4)); +})(); + +(function SealAndReconfigureWithIC() { + function C() { this.x = 1; this.y = 1; Object.seal(this); } + + let c1 = new C(); + + function g(o) { + o.x = 0.1; + } + + g(c1); + + let c2 = new C(); + let c3 = new C(); + let c4 = new C(); + + // The objects c2, c3 and c4 should follow the same transition + // path that we reconfigured c1 to. + assertTrue(%HaveSameMap(c1, c2)); + assertTrue(%HaveSameMap(c1, c3)); + assertTrue(%HaveSameMap(c1, c4)); + + g(c2); + g(c3); + g(c4); + + assertTrue(%HaveSameMap(c1, c2)); + assertTrue(%HaveSameMap(c1, c3)); + assertTrue(%HaveSameMap(c1, c4)); +})(); + +(function SealReconfigureAndMigrateWithIC() { + function C() { this.x = 1; this.y = 1; Object.seal(this); } + + let c1 = new C(); + let c2 = new C(); + let c3 = new C(); + let c4 = new C(); + + function g(o) { + o.x = 0.1; + } + + g(c1); + + // Now c2, c3 and c4 have deprecated maps. + assertFalse(%HaveSameMap(c1, c2)); + assertFalse(%HaveSameMap(c1, c3)); + assertFalse(%HaveSameMap(c1, c4)); + + g(c2); + g(c3); + g(c4); + + assertTrue(%HaveSameMap(c1, c2)); + assertTrue(%HaveSameMap(c1, c3)); + assertTrue(%HaveSameMap(c1, c4)); +})(); + +(function SealReconfigureAndMigrateWithOptCode() { + function C() { this.x = 1; this.y = 1; Object.seal(this); } + + let c1 = new C(); + let c2 = new C(); + let c3 = new C(); + let c4 = new C(); + + function g(o) { + o.x = 0.1; + } + + g(c1); + g(c2); + g(c3); + %OptimizeFunctionOnNextCall(g); + g(c4); + + assertTrue(%HaveSameMap(c1, c2)); + assertTrue(%HaveSameMap(c1, c3)); + assertTrue(%HaveSameMap(c1, c4)); +})(); + +(function PreventExtensionsAndReconfigure() { + function C() { this.x = 1; this.y = 1; Object.preventExtensions(this); } + + let c1 = new C(); + + function g(o) { + o.x = 0.1; + } + + g(c1); + + let c2 = new C(); + let c3 = new C(); + let c4 = new C(); + + c2.x = 0.1; + c3.x = 0.1; + c4.x = 0.1; + + assertTrue(%HaveSameMap(c1, c2)); + assertTrue(%HaveSameMap(c1, c3)); + assertTrue(%HaveSameMap(c1, c4)); +})(); + +(function PreventExtensionsSealAndReconfigure() { + function C() { + this.x = 1; + this.y = 1; + Object.preventExtensions(this); + Object.seal(this); + } + + let c1 = new C(); + + function g(o) { + o.x = 0.1; + } + + g(c1); + + let c2 = new C(); + let c3 = new C(); + let c4 = new C(); + + c2.x = 0.1; + c3.x = 0.1; + c4.x = 0.1; + + // Ideally, all the objects would have the same map, but at the moment + // we shortcut the unnecessary integrity level transitions. + assertTrue(%HaveSameMap(c2, c3)); + assertTrue(%HaveSameMap(c2, c4)); +})(); diff --git a/implementation-contributed/v8/mjsunit/messages.js b/implementation-contributed/v8/mjsunit/messages.js index d5c796228c..916a7d554f 100644 --- a/implementation-contributed/v8/mjsunit/messages.js +++ b/implementation-contributed/v8/mjsunit/messages.js @@ -126,13 +126,6 @@ test(function() { [].join(o); }, "Cannot convert object to primitive value", TypeError); -// kCircularStructure -test(function() { - var o = {}; - o.o = o; - JSON.stringify(o); -}, "Converting circular structure to JSON", TypeError); - // kConstructorNotFunction test(function() { Map(); diff --git a/implementation-contributed/v8/mjsunit/mjsunit.js b/implementation-contributed/v8/mjsunit/mjsunit.js index 41f2caee7a..b81c9676e6 100644 --- a/implementation-contributed/v8/mjsunit/mjsunit.js +++ b/implementation-contributed/v8/mjsunit/mjsunit.js @@ -213,7 +213,7 @@ var prettyPrinted; // TODO(neis): Remove try-catch once BigInts are enabled by default. try { BigIntPrototypeValueOf = BigInt.prototype.valueOf; - } catch(e) {} + } catch (e) {} function classOf(object) { // Argument must not be null or undefined. @@ -480,14 +480,17 @@ var prettyPrinted; } }; + function executeCode(code) { + if (typeof code === 'function') return code(); + if (typeof code === 'string') return eval(code); + failWithMessage( + 'Given code is neither function nor string, but ' + (typeof code) + + ': <' + prettyPrinted(code) + '>'); + } assertThrows = function assertThrows(code, type_opt, cause_opt) { try { - if (typeof code === 'function') { - code(); - } else { - eval(code); - } + executeCode(code); } catch (e) { if (typeof type_opt === 'function') { assertInstanceof(e, type_opt); @@ -508,11 +511,10 @@ var prettyPrinted; failWithMessage("Did not throw exception"); }; - assertThrowsEquals = function assertThrowsEquals(fun, val) { try { fun(); - } catch(e) { + } catch (e) { assertSame(val, e); return; } @@ -533,15 +535,11 @@ var prettyPrinted; } }; - - assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) { + assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) { try { - if (typeof code === 'function') { - return code(); - } else { - return eval(code); - } + executeCode(code); } catch (e) { + if (e instanceof MjsUnitAssertionError) throw e; failWithMessage("threw an exception: " + (e.message || e)); } }; @@ -584,13 +582,15 @@ var prettyPrinted; } assertPromiseResult = function(promise, success, fail) { + if (success !== undefined) assertEquals('function', typeof success); + if (fail !== undefined) assertEquals('function', typeof fail); const stack = (new Error()).stack; var test_promise = promise.then( result => { try { if (--promiseTestCount == 0) testRunner.notifyDone(); - if (success) success(result); + if (success !== undefined) success(result); } catch (e) { // Use setTimeout to throw the error again to get out of the promise // chain. @@ -602,7 +602,7 @@ var prettyPrinted; result => { try { if (--promiseTestCount == 0) testRunner.notifyDone(); - if (!fail) throw result; + if (fail === undefined) throw result; fail(result); } catch (e) { // Use setTimeout to throw the error again to get out of the promise @@ -667,7 +667,9 @@ var prettyPrinted; // option is provided. Such tests must add --opt to flags comment. assertFalse((opt_status & V8OptimizationStatus.kNeverOptimize) !== 0, "test does not make sense with --no-opt"); - assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, name_opt); + assertTrue( + (opt_status & V8OptimizationStatus.kIsFunction) !== 0, + 'should be a function: ' + name_opt); if (skip_if_maybe_deopted && (opt_status & V8OptimizationStatus.kMaybeDeopted) !== 0) { // When --deopt-every-n-times flag is specified it's no longer guaranteed @@ -675,7 +677,9 @@ var prettyPrinted; // to stress test the deoptimizer. return; } - assertTrue((opt_status & V8OptimizationStatus.kOptimized) !== 0, name_opt); + assertTrue( + (opt_status & V8OptimizationStatus.kOptimized) !== 0, + 'should be optimized: ' + name_opt); } isNeverOptimizeLiteMode = function isNeverOptimizeLiteMode() { @@ -772,7 +776,7 @@ var prettyPrinted; return frame; }); return "" + error.message + "\n" + ArrayPrototypeJoin.call(stack, "\n"); - } catch(e) {}; + } catch (e) {}; return error.stack; } })(); diff --git a/implementation-contributed/v8/mjsunit/mjsunit.status b/implementation-contributed/v8/mjsunit/mjsunit.status index 884c7cca92..fd13b2750f 100644 --- a/implementation-contributed/v8/mjsunit/mjsunit.status +++ b/implementation-contributed/v8/mjsunit/mjsunit.status @@ -1003,4 +1003,1166 @@ 'regress/regress-913844': [SKIP], }], +] + + /* + ********************************** test262-automation ********************************** + Summary: The two files have now diverged. + File Status: Partially curated & modified. + Source Status: Modified since its export. + Below is the current and modified source which was exported on Mon Feb 04 2019 19:40:41 GMT+0000 (Coordinated Universal Time) + */ + # Copyright 2012 the V8 project authors. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[ +[ALWAYS, { + # Modules which are only meant to be imported from by other tests, not to be + # tested standalone. + 'modules-skip*': [SKIP], + 'harmony/modules-skip*': [SKIP], + 'regress/modules-skip*': [SKIP], + 'wasm/exceptions-utils': [SKIP], + 'wasm/wasm-module-builder': [SKIP], + + # All tests in the bug directory are expected to fail. + 'bugs/*': [FAIL], + + ############################################################################## + # Fails. + 'regress/regress-1119': [FAIL], + + # Issue 1719: Slow to collect arrays over several contexts. + 'regress/regress-524': [SKIP], + # When that bug is fixed, revert the expectation to: + # Skip long running test in debug. + # regress/regress-524: [PASS, ['mode == debug', SKIP]], + + # This test non-deterministically runs out of memory on Windows ia32. + 'regress/regress-crbug-160010': [SKIP], + + # Issue 3784: setters-on-elements is flaky + 'setters-on-elements': [PASS, FAIL], + + # Issue 5495: enable the test when the constant field tracking in enabled. + 'const-field-tracking': [SKIP], + + # Issue 8505: Math.pow is incorrect for asm.js + 'regress/wasm/regress-8505': [SKIP], + + ############################################################################## + # Too slow in debug mode with --stress-opt mode. + 'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]], + + ############################################################################## + # Too slow in debug mode for validation of elements. + 'regress/regress-430201': [PASS, ['mode == debug', SKIP], ['tsan', SKIP]], + 'regress/regress-430201b': [PASS, ['mode == debug', SKIP]], + 'regress/regress-716044': [PASS, ['mode == debug', SKIP]], + + ############################################################################## + # Too slow in debug mode for GC stress mode. + 'regress/regress-crbug-217858': [PASS, ['mode == debug', SKIP]], + + # Too slow in debug mode and under turbofan. + 'regress/regress-4595': [PASS, NO_VARIANTS, ['mode == debug', SKIP]], + + ############################################################################## + # Only RegExp stuff tested, no need for extensive optimizing compiler tests. + 'regexp-global': [PASS, NO_VARIANTS], + 'third_party/regexp-pcre/regexp-pcre': [PASS, NO_VARIANTS], + + ############################################################################## + # No need to waste time for this test. + 'd8/d8-performance-now': [PASS, NO_VARIANTS], + 'regress/regress-crbug-491062': [PASS, NO_VARIANTS], + + # Issue 488: this test sometimes times out. + # TODO(arm): This seems to flush out a bug on arm with simulator. + 'array-constructor': [PASS, SLOW, ['arch == arm and simulator_run == True', SKIP]], + + # Very slow test + 'regress/regress-crbug-808192' : [PASS, SLOW, NO_VARIANTS, ['mode == debug or arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips64 or arch == mips or arch == s390 or arch == s390x or arch == ppc or arch == ppc64', SKIP]], + + # Very slow on ARM and MIPS, contains no architecture dependent code. + 'unicode-case-overoptimization': [PASS, NO_VARIANTS, ['arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips64 or arch == mips', SKIP]], + 'regress/regress-3976': [PASS, NO_VARIANTS, ['arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips64 or arch == mips', SKIP]], + 'regress/regress-crbug-482998': [PASS, NO_VARIANTS, ['arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips', SKIP]], + 'regress/regress-740784': [PASS, NO_VARIANTS, ['arch == arm or arch == arm64 or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips', SKIP]], + + # This test allocates a 2G block of memory and if there are multiple + # variants this can lead to OOM. + 'regress/regress-crbug-514081': [PASS, NO_VARIANTS], + + ############################################################################## + # Skip long running tests that time out in debug mode. + 'generated-transition-stub': [PASS, ['mode == debug', SKIP]], + 'migrations': [SKIP], + 'array-functions-prototype-misc': [PASS, SLOW, ['mode == debug', SKIP]], + 'compiler/regress-808472': [PASS, ['mode == debug', SKIP]], + 'es6/promise-all-overflow-1': [SKIP], + 'es6/promise-all-overflow-2': [PASS, SLOW, ['mode == debug or arch != x64', SKIP]], + + ############################################################################## + # This test sets the umask on a per-process basis and hence cannot be + # used in multi-threaded runs. + # On android there is no /tmp directory. + # Currently d8-os generates a temporary directory name using Math.random(), so + # we cannot run several variants of d8-os simultaneously, since all of them + # get the same random seed and would generate the same directory name. Besides + # that, it doesn't make sense to run several variants of d8-os anyways. + 'd8/d8-os': [PASS, NO_VARIANTS, ['isolates or arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]], + 'tools/tickprocessor': [PASS, NO_VARIANTS, ['arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]], + 'tools/dumpcpp': [PASS, NO_VARIANTS, ['arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]], + + ############################################################################## + # These tests generate files in the test directory, so we cannot run several + # variants of them simultaneously. Additionally they should not be affected by + # variants. + 'd8/enable-tracing': [PASS, NO_VARIANTS], + 'tools/compiler-trace-flags': [PASS, NO_VARIANTS], + + ############################################################################## + # Long running test that reproduces memory leak and should be run manually. + 'regress/regress-2073': [SKIP], + + ############################################################################## + # Tests verifying CHECK and ASSERT. + 'verify-check-false': [FAIL, NO_VARIANTS], + 'verify-assert-false': [NO_VARIANTS, ['mode == release and dcheck_always_on == False', PASS], ['mode == debug', FAIL]], + + ############################################################################## + # Tests with different versions for release and debug. + 'compiler/alloc-number': [PASS, ['mode == debug', SKIP]], + 'compiler/alloc-number-debug': [PASS, ['mode == release', SKIP]], + 'regress/regress-634-debug': [PASS, ['mode == release', SKIP]], + + # BUG(v8:2989). + 'regress/regress-2989': [FAIL, NO_VARIANTS, ['lite_mode == True', SKIP]], + + # This test variant makes only sense on arm. + 'math-floor-of-div-nosudiv': [PASS, SLOW, ['arch not in [arm, arm64, android_arm, android_arm64]', SKIP]], + + # Too slow for slow variants. + 'asm/embenchen/*': [PASS, SLOW, NO_VARIANTS], + 'asm/poppler/*': [PASS, SLOW, NO_VARIANTS], + 'asm/sqlite3/*': [PASS, SLOW, NO_VARIANTS], + + # OOM flakes in isolates tests because too many largish heaps are created. + 'asm/asm-heap': [PASS, NO_VARIANTS, ['isolates', SKIP]], + + # Slow tests. + 'copy-on-write-assert': [PASS, SLOW], + 'es6/typedarray-construct-offset-not-smi': [PASS, SLOW], + 'harmony/regexp-property-script-extensions': [PASS, SLOW], + 'md5': [PASS, SLOW], + 'numops-fuzz-part*': [PASS, ['mode == debug', SLOW]], + 'readonly': [PASS, SLOW], + 'regress/regress-1122': [PASS, SLOW], + 'regress/regress-605470': [PASS, SLOW], + 'regress/regress-655573': [PASS, SLOW], + 'regress/regress-1200351': [PASS, SLOW], + 'regress/wasm/regress-810973': [PASS, SLOW], + 'string-replace-gc': [PASS, SLOW], + 'wasm/asm-wasm-f32': [PASS, SLOW], + 'wasm/asm-wasm-f64': [PASS, SLOW], + 'wasm/embenchen/*': [PASS, SLOW], + 'wasm/grow-memory': [PASS, SLOW], + 'wasm/unreachable-validation': [PASS, SLOW], + 'wasm/atomics-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['(arch == arm or arch == arm64) and simulator_run', SKIP], ['tsan', SKIP]], + 'wasm/atomics64-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['(arch == arm or arch == arm64) and simulator_run', SKIP], ['tsan', SKIP]], + 'wasm/compare-exchange-stress': [PASS, SLOW, NO_VARIANTS], + 'wasm/compare-exchange64-stress': [PASS, SLOW, NO_VARIANTS], + + # case-insensitive unicode regexp relies on case mapping provided by ICU. + 'es6/unicode-regexp-ignore-case': [PASS, ['no_i18n == True', FAIL]], + 'es6/unicode-regexp-ignore-case-noi18n': [FAIL, ['no_i18n == True', PASS]], + 'regress/regress-5036': [PASS, ['no_i18n == True', FAIL]], + 'es7/regexp-ui-word': [PASS, ['no_i18n == True', FAIL]], + 'regexp-modifiers-i18n': [PASS, ['no_i18n == True', FAIL]], + 'regexp-modifiers-autogenerated-i18n': [PASS, ['no_i18n == True', FAIL]], + # desugaring regexp property class relies on ICU. + 'harmony/regexp-property-*': [PASS, ['no_i18n == True', FAIL]], + 'regress/regress-793588': [PASS, ['no_i18n == True', FAIL]], + + # noi18n build cannot parse characters in supplementary plane. + 'harmony/regexp-named-captures': [PASS, ['no_i18n == True', FAIL]], + + # noi18n cannot turn on ICU backend for Date + 'icu-date-to-string': [PASS, ['no_i18n == True', SKIP]], + 'icu-date-lord-howe': [PASS, ['no_i18n == True', SKIP]], + 'tzoffset-transition-apia': [PASS, ['no_i18n == True', SKIP]], + 'tzoffset-transition-lord-howe': [PASS, ['no_i18n == True', SKIP]], + 'tzoffset-transition-moscow': [PASS, ['no_i18n == True', SKIP]], + 'tzoffset-transition-new-york': [PASS, ['no_i18n == True', SKIP]], + 'tzoffset-seoul': [PASS, ['no_i18n == True', SKIP]], + + # TODO(bmeurer): Flaky timeouts (sometimes <1s, sometimes >3m). + 'unicodelctest': [PASS, NO_VARIANTS], + 'unicodelctest-no-optimization': [PASS, NO_VARIANTS], + + # TODO(vogelheim): big-object-literal exceeds the stack in debug builds, + # which makes the test useless. + 'big-object-literal': [PASS, ['mode == debug', SKIP]], + + # Runs out of stack space in debug builds. + 'big-array-literal': [PASS, ['mode == debug', SKIP]], + + # BUG(v8:6306). + 'wasm/huge-memory': [SKIP], + + # Allocates a huge string and then flattens it, very slow in debug mode. + 'regress/regress-752764': [PASS, ['mode == debug', SLOW]], + + # https://crbug.com/v8/7697 + 'array-literal-feedback': [PASS, FAIL], + + # https://crbug.com/v8/7775 + 'allocation-site-info': [SKIP], + + # BUG(v8:8169) + 'external-backing-store-gc': [SKIP], + + # https://crbug.com/v8/8781 + 'compiler/string-from-code-point': [PASS, FAIL], +}], # ALWAYS + +['novfp3 == True', { + 'asm/embenchen/box2d': [SKIP], + 'asm/embenchen/zlib': [SKIP], + 'asm/embenchen/memops': [SKIP], + 'asm/embenchen/lua_binarytrees': [SKIP], +}], # novfp3 == True + +############################################################################## +# TODO(ahaas): Port multiple return values to ARM, MIPS, S390 and PPC +['arch == arm or arch == arm64 or arch == mips or arch == mips64 or arch == mipsel or arch == mips64el or arch == s390 or arch == s390x or arch == ppc or arch == ppc64', { + 'wasm/multi-value': [SKIP], +}], + +############################################################################## +['gc_stress == True', { + # Skip tests not suitable for GC stress. + 'allocation-site-info': [SKIP], + 'array-constructor-feedback': [SKIP], + 'array-feedback': [SKIP], + 'array-literal-feedback': [SKIP], + 'd8/d8-performance-now': [SKIP], + 'elements-kind': [SKIP], + 'elements-transition-hoisting': [SKIP], + 'fast-prototype': [SKIP], + 'field-type-tracking': [SKIP], + 'getters-on-elements': [SKIP], + 'es6/block-let-crankshaft': [SKIP], + 'opt-elements-kind': [SKIP], + 'osr-elements-kind': [SKIP], + 'regress/regress-crbug-137689': [SKIP], + 'regress/regress-trap-allocation-memento': [SKIP], + 'regress/regress-2249': [SKIP], + 'regress/regress-4121': [SKIP], + 'regress/regress-6989': [SKIP], + 'compare-known-objects-slow': [SKIP], + 'compiler/array-multiple-receiver-maps': [SKIP], + # Tests taking too long + 'packed-elements': [SKIP], + 'regress/regress-1122': [SKIP], + 'regress/regress-331444': [SKIP], + 'regress/regress-353551': [SKIP], + 'regress/regress-crbug-119926': [SKIP], + 'regress/short-circuit': [SKIP], + 'stack-traces-overflow': [SKIP], + 'unicode-test': [SKIP], + 'whitespaces': [SKIP], + + # Unsuitable for GC stress because coverage information is lost on GC. + 'code-coverage-ad-hoc': [SKIP], + 'code-coverage-precise': [SKIP], + + # TODO(mstarzinger): Takes too long with TF. + 'array-sort': [PASS, NO_VARIANTS], + 'regress/regress-91008': [PASS, NO_VARIANTS], + 'regress/regress-transcendental': [PASS, ['arch == arm64', NO_VARIANTS]], + 'compiler/osr-regress-max-locals': [PASS, NO_VARIANTS], + 'math-floor-of-div': [PASS, NO_VARIANTS], + 'unicodelctest': [PASS, NO_VARIANTS], + 'unicodelctest-no-optimization': [PASS, NO_VARIANTS], + + # TODO(jkummerow): Doesn't work correctly in GC stress. + 'regress/regress-crbug-500497': [SKIP], + + # Too slow for gc stress. + 'asm/embenchen/box2d': [SKIP], + + # BUG(v8:4237) + 'regress/regress-3976': [SKIP], + + # Slow tests. + 'array-constructor': [PASS, SLOW], + 'json': [PASS, SLOW], + + # BUG(v8:4779): Crashes flakily with stress mode on arm64. + 'array-splice': [PASS, SLOW, ['arch == arm64', NO_VARIANTS]], + + # BUG(v8:7880): Slow tests. + 'regress/regress-707066': [SKIP], + 'regress/regress-446389': [SKIP], + 'regress/regress-458987': [SKIP], + 'es6/regress/regress-crbug-465671': [SKIP], + 'regress/regress-inline-getter-near-stack-limit': [SKIP], + 'es6/regress/regress-crbug-465671-null': [SKIP], + 'regress/regress-148378': [SKIP], + 'regress/regress-crbug-762472': [SKIP], +}], # 'gc_stress == True' + +############################################################################## +['lite_mode or variant == jitless', { + # Skip tests not suitable for lite_mode. + + # TODO(8596): We cache the templates in the feedback vector. In lite mode + # without feedback vectors we need to implement some other mechanism to cache + # them. Enable this test after fixing it. + 'es6/templates': [SKIP], + + # code coverage needs feedback vectors + 'code-coverage-ad-hoc': [SKIP], + 'code-coverage-class-fields': [SKIP], + 'code-coverage-block-noopt': [SKIP], + 'code-coverage-block': [SKIP], + 'code-coverage-precise': [SKIP], + + # Needs feedback vector - tests for allocation sites + 'array-constructor-feedback': [SKIP], + 'regress/regress-trap-allocation-memento': [SKIP], + 'regress/regress-4121': [SKIP], + + # Slow tests without feedback vectors + # TODO(mythria): Investigate why they are slow and either fix if + # possible are update the reason why they are slow. + 'spread-large-string': [SKIP], + 'spread-large-array': [SKIP], + + # TODO(v8:7777): Re-enable once wasm is supported in jitless mode. + 'regress/regress-5888': [SKIP], + 'regress/regress-5911': [SKIP], + 'regress/regress-813440': [SKIP], + 'regress/regress-crbug-746835': [SKIP], + 'regress/regress-crbug-772056': [SKIP], + 'regress/wasm/*': [SKIP], + 'tools/compiler-trace-flags': [SKIP], + 'wasm/*': [SKIP], + + # Other tests that use asm / wasm / optimized code. + 'asm/asm-heap': [SKIP], + 'asm/asm-validation': [SKIP], + 'asm/call-stdlib': [SKIP], + 'asm/call-annotation': [SKIP], + 'asm/global-imports': [SKIP], + 'asm/regress-913822': [SKIP], + 'asm/return-types': [SKIP], + 'regress/regress-599719': [SKIP], + 'regress/regress-6196': [SKIP], + 'regress/regress-6700': [SKIP], + 'regress/regress-6838-2': [SKIP], + 'regress/regress-6838-3': [SKIP], + + # Timeouts in lite / jitless mode. + 'asm/embenchen/*': [SKIP], + + # Tests that generate code at runtime. + 'code-comments': [SKIP], + 'regress/regress-617526': [SKIP], + 'regress/regress-7893': [SKIP], + 'regress/regress-8377': [SKIP], + 'regress/regress-863810': [SKIP], + 'regress/regress-crbug-721835': [SKIP], + 'regress/regress-crbug-759327': [SKIP], + 'regress/regress-crbug-898974': [SKIP], +}], # 'lite_mode or variant == jitless' + +############################################################################## +['variant == jitless', { + # https://crbug.com/v8/7777 + 'array-literal-transitions': [SKIP], + 'array-push5': [SKIP], + 'array-shift4': [SKIP], + 'array-store-and-grow': [SKIP], + 'code-coverage-block-opt': [SKIP], + 'compiler/abstract-equal-receiver': [SKIP], + 'compiler/abstract-equal-symbol': [SKIP], + 'compiler/abstract-equal-undetectable': [SKIP], + 'compiler/array-buffer-is-view': [SKIP], + 'compiler/array-multiple-receiver-maps': [SKIP], + 'compiler/array-push-3': [SKIP], + 'compiler/array-slice-clone': [SKIP], + 'compiler/constant-fold-cow-array': [SKIP], + 'compiler/dataview-deopt': [SKIP], + 'compiler/dataview-get': [SKIP], + 'compiler/dataview-neutered': [SKIP], + 'compiler/dataview-set': [SKIP], + 'compiler/deopt-array-builtins': [SKIP], + 'compiler/deopt-array-push': [SKIP], + 'compiler/deopt-inlined-from-call': [SKIP], + 'compiler/deopt-numberoroddball-binop': [SKIP], + 'compiler/deopt-string-outofbounds': [SKIP], + 'compiler/increment-typefeedback': [SKIP], + 'compiler/inlined-array-pop-opt': [SKIP], + 'compiler/inlined-call': [SKIP], + 'compiler/integral32-add-sub': [SKIP], + 'compiler/manual-concurrent-recompile': [SKIP], + 'compiler/math-imul': [SKIP], + 'compiler/native-context-specialization-hole-check': [SKIP], + 'compiler/number-abs': [SKIP], + 'compiler/number-ceil': [SKIP], + 'compiler/number-comparison-truncations': [SKIP], + 'compiler/number-divide': [SKIP], + 'compiler/number-floor': [SKIP], + 'compiler/number-max': [SKIP], + 'compiler/number-min': [SKIP], + 'compiler/number-modulus': [SKIP], + 'compiler/number-round': [SKIP], + 'compiler/number-toboolean': [SKIP], + 'compiler/number-trunc': [SKIP], + 'compiler/optimized-float32array-length': [SKIP], + 'compiler/optimized-float64array-length': [SKIP], + 'compiler/optimized-int32array-length': [SKIP], + 'compiler/optimized-uint32array-length': [SKIP], + 'compiler/opt-next-call': [SKIP], + 'compiler/opt-next-call-turbo': [SKIP], + 'compiler/promise-resolve-stable-maps': [SKIP], + 'compiler/redundancy-elimination': [SKIP], + 'compiler/regress-5320': [SKIP], + 'compiler/regress-compare-negate': [SKIP], + 'compiler/stress-deopt-count-1': [SKIP], + 'compiler/stress-deopt-count-2': [SKIP], + 'compiler/string-from-code-point': [SKIP], + 'compiler/uint8-clamped-array': [SKIP], + 'constant-folding-2': [SKIP], + 'default-nospec': [SKIP], + 'deopt-minus-zero': [SKIP], + 'deopt-recursive-eager-once': [SKIP], + 'deopt-recursive-lazy-once': [SKIP], + 'deopt-recursive-soft-once': [SKIP], + 'deopt-unlinked': [SKIP], + 'deopt-with-fp-regs': [SKIP], + 'deserialize-optimize-inner': [SKIP], + 'div-mul-minus-one': [SKIP], + 'elements-transition-hoisting': [SKIP], + 'ensure-growing-store-learns': [SKIP], + 'es6/array-iterator-turbo': [SKIP], + 'es6/block-let-crankshaft': [SKIP], + 'es6/block-let-crankshaft-sloppy': [SKIP], + 'es6/block-scoping': [SKIP], + 'es6/block-scoping-sloppy': [SKIP], + 'es6/collections-constructor-custom-iterator': [SKIP], + 'es6/collections-constructor-iterator-side-effect': [SKIP], + 'es6/collections-constructor-with-modified-array-prototype': [SKIP], + 'es6/collections-constructor-with-modified-protoype': [SKIP], + 'es6/map-constructor-entry-side-effect': [SKIP], + 'es6/map-constructor-entry-side-effect2': [SKIP], + 'es6/map-constructor-entry-side-effect3': [SKIP], + 'es6/map-constructor-entry-side-effect4': [SKIP], + 'field-type-tracking': [SKIP], + 'getters-on-elements': [SKIP], + 'ignition/throw-if-hole': [SKIP], + 'ignition/throw-if-not-hole': [SKIP], + 'ignition/throw-super-not-called': [SKIP], + 'keyed-load-hole-to-undefined': [SKIP], + 'keyed-load-with-string-key': [SKIP], + 'keyed-load-with-symbol-key': [SKIP], + 'math-deopt': [SKIP], + 'math-floor-of-div-minus-zero': [SKIP], + 'modules-turbo1': [SKIP], + 'never-optimize': [SKIP], + 'object-seal': [SKIP], + 'optimized-map': [SKIP], + 'regress/regress-2132': [SKIP], + 'regress/regress-2250': [SKIP], + 'regress/regress-2315': [SKIP], + 'regress/regress-2339': [SKIP], + 'regress/regress-2451': [SKIP], + 'regress/regress-252797': [SKIP], + 'regress/regress-2618': [SKIP], + 'regress/regress-3176': [SKIP], + 'regress/regress-3650-3': [SKIP], + 'regress/regress-3709': [SKIP], + 'regress/regress-385565': [SKIP], + 'regress/regress-4380': [SKIP], + 'regress/regress-5404': [SKIP], + 'regress/regress-5790': [SKIP], + 'regress/regress-5802': [SKIP], + 'regress/regress-6607-1': [SKIP], + 'regress/regress-6607-2': [SKIP], + 'regress/regress-6941': [SKIP], + 'regress/regress-6948': [SKIP], + 'regress/regress-6989': [SKIP], + 'regress/regress-6991': [SKIP], + 'regress/regress-7014-1': [SKIP], + 'regress/regress-7014-2': [SKIP], + 'regress/regress-7135': [SKIP], + 'regress/regress-7254': [SKIP], + 'regress/regress-7510': [SKIP], + 'regress/regress-794825': [SKIP], + 'regress/regress-crbug-554831': [SKIP], + 'regress/regress-crbug-587068': [SKIP], + 'regress/regress-crbug-594183': [SKIP], + 'regress/regress-crbug-882233-2': [SKIP], + 'regress/regress-embedded-cons-string': [SKIP], + 'regress/regress-map-invalidation-2': [SKIP], + 'regress/regress-param-local-type': [SKIP], + 'regress/regress-store-uncacheable': [SKIP], + 'regress/regress-v8-5697': [SKIP], + 'shared-function-tier-up-turbo': [SKIP], + 'shift-for-integer-div': [SKIP], + 'sin-cos': [SKIP], + 'smi-mul': [SKIP], + 'smi-mul-const': [SKIP], + 'string-deopt': [SKIP], + 'strong-rooted-literals': [SKIP], + 'unary-minus-deopt': [SKIP], +}], # variant == jitless + +############################################################################## +['byteorder == big', { + # Emscripten requires little-endian, skip all tests on big endian platforms. + 'asm/embenchen/*': [SKIP], + 'asm/poppler/*': [SKIP], + 'asm/sqlite3/*': [SKIP], + # TODO(mips-team): Fix Wasm for big-endian. + 'wasm/*': [SKIP], +}], # 'byteorder == big' + +############################################################################## +['arch == arm64 or arch == android_arm64', { + + # Requires bigger stack size in the Genesis and if stack size is increased, + # the test requires too much time to run. However, the problem test covers + # should be platform-independent. + 'regress/regress-1132': [SKIP], + + # Pass but take too long to run. Skip. + # Some similar tests (with fewer iterations) may be included in arm64-js + # tests. + 'asm/embenchen/box2d': [SKIP], + 'asm/embenchen/lua_binarytrees': [SKIP], + 'big-object-literal': [SKIP], + 'compiler/regress-arguments': [SKIP], + 'compiler/regress-gvn': [SKIP], + 'compiler/regress-4': [SKIP], + 'compiler/regress-or': [SKIP], + 'compiler/regress-rep-change': [SKIP], + 'regress/regress-1117': [SKIP], + 'regress/regress-1849': [SKIP], + 'regress/regress-3247124': [SKIP], + 'regress/regress-91008': [SKIP], + 'regress/regress-91010': [SKIP], + 'regress/regress-91013': [SKIP], + 'regress/regress-99167': [SKIP], + + # BUG(v8:3457). + 'deserialize-reference': [PASS, FAIL], + + # BUG(v8:4016) + 'regress/regress-crbug-467047': [SKIP], + + # Slow tests. + 'array-concat': [PASS, SLOW], + 'array-indexing': [PASS, SLOW], + 'array-reduce': [PASS, SLOW], + 'array-sort': [PASS, SLOW], + 'array-splice': [PASS, SLOW], + 'bit-not': [PASS, SLOW], + 'compiler/alloc-number': [PASS, SLOW], + 'compiler/osr-with-args': [PASS, SLOW], + 'generated-transition-stub': [PASS, SLOW], + 'json2': [PASS, SLOW], + 'math-floor-of-div-nosudiv': [PASS, SLOW], + 'math-floor-of-div': [PASS, SLOW], + 'messages': [PASS, SLOW], + 'packed-elements': [PASS, SLOW], + 'regress/regress-2790': [PASS, SLOW], + 'regress/regress-331444': [PASS, SLOW], + 'regress/regress-490': [PASS, SLOW], + 'regress/regress-crbug-217858': [PASS, SLOW], + 'regress/regress-create-exception': [PASS, SLOW], + 'regress/regress-json-stringify-gc': [PASS, SLOW], + 'string-indexof-2': [PASS, SLOW], + 'unicodelctest-no-optimization': [PASS, SLOW], + 'unicodelctest': [PASS, SLOW], + 'unicode-test': [PASS, SLOW], + 'wasm/atomics': [PASS, SLOW], + 'whitespaces': [PASS, SLOW], + + # BUG(v8:7247). + 'regress/regress-779407': [PASS, SLOW, NO_VARIANTS], +}], # 'arch == arm64' + +['arch == arm64 and mode == debug and simulator_run', { + + # Pass but take too long with the simulator in debug mode. + 'array-sort': [PASS, SLOW], + 'packed-elements': [SKIP], + 'regexp-global': [SKIP], + 'math-floor-of-div': [PASS, SLOW], + 'math-floor-of-div-nosudiv': [PASS, SLOW], + 'unicodelctest': [PASS, SLOW], + 'unicodelctest-no-optimization': [PASS, SLOW], + # Issue 3219: + 'getters-on-elements': [PASS, ['gc_stress == True', FAIL]], +}], # 'arch == arm64 and mode == debug and simulator_run' + +############################################################################## +['asan == True', { + # Skip tests not suitable for ASAN. + 'big-array-literal': [SKIP], + 'big-object-literal': [SKIP], + 'regress/regress-crbug-178790': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=4639 + # The failed allocation causes an asan/msan/tsan error + 'es6/typedarray-construct-offset-not-smi': [SKIP], + + # Exception thrown during bootstrapping on ASAN builds, see issue 4236. + 'regress/regress-1132': [SKIP], + + # Flaky on ASAN builds: https://bugs.chromium.org/p/v8/issues/detail?id=6305 + 'regress/regress-430201': [SKIP], + 'regress/regress-430201b': [SKIP], + + # Stack overflow on windows. + 'es8/regress/regress-624300': [PASS, ['system == windows', SKIP]], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7102 + # Flaky due to huge string allocation. + 'regress/regress-748069': [SKIP], +}], # 'asan == True' + +############################################################################## +['msan == True', { + # Skip tests not suitable for MSAN. + 'big-array-literal': [SKIP], + # ICU upstream issues. + 'date': [SKIP], + 'deep-recursion': [SKIP], + 'regress/regress-builtinbust-7': [SKIP], + 'string-localecompare': [SKIP], + + # Too slow. + 'harmony/regexp-property-lu-ui': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7102 + # Flaky due to huge string allocation. + 'regress/regress-748069': [SKIP], + # Slow test. + 'regress/regress-779407': [PASS, SLOW], +}], # 'msan == True' + +############################################################################## +['tsan == True', { + # https://bugs.chromium.org/p/v8/issues/detail?id=7102 + # Flaky due to huge string allocation. + 'regress/regress-748069': [SKIP], + + # Allocates a large array buffer, which TSAN sometimes cannot handle. + 'regress/regress-599717': [SKIP], + + # BUG(v8:7042). Uses a lot of memory. + 'regress/regress-678917': [SKIP], + + # BUG(v8:8103). Uses a lot of memory. + 'regress/regress-852258': [SKIP], + + # BUG(v8:6924). The test uses a lot of memory. + 'regress/wasm/regress-694433': [SKIP], + 'es6/typedarray': [PASS, NO_VARIANTS], + 'regress/regress-752764': [PASS, NO_VARIANTS], +}], # 'tsan == True' + +############################################################################## +['arch == arm or arch == android_arm', { + + # Slow tests which times out in debug mode. + 'try': [PASS, ['mode == debug', SKIP]], + 'array-constructor': [PASS, ['mode == debug', SKIP]], + 'regress/regress-1122': [PASS, SLOW, ['mode == debug and arch == android_arm', SKIP]], + + # Flaky test that can hit compilation-time stack overflow in debug mode. + 'unicode-test': [PASS, ['mode == debug', PASS, FAIL]], + + # Slow in release mode on ARM. + 'compiler/regress-stacktrace-methods': [PASS, SLOW], + 'array-splice': [PASS, SLOW], + + # Long running tests. Skipping because having them timeout takes too long on + # the buildbot. + 'big-object-literal': [SKIP], + 'compiler/alloc-number': [SKIP], + 'regress/regress-490': [SKIP], + 'regress/regress-create-exception': [SKIP], + 'regress/regress-3247124': [SKIP], + + # Requires bigger stack size in the Genesis and if stack size is increased, + # the test requires too much time to run. However, the problem test covers + # should be platform-independent. + 'regress/regress-1132': [SKIP], + + # Currently always deopt on minus zero + 'math-floor-of-div-minus-zero': [SKIP], + + # Slow tests. + 'array-sort': [PASS, SLOW], + 'compiler/osr-with-args': [PASS, SLOW], + 'packed-elements': [PASS, SLOW], + 'regress/regress-2790': [PASS, SLOW], + 'regress/regress-91008': [PASS, SLOW], + 'regress/regress-json-stringify-gc': [PASS, SLOW], + 'string-indexof-2': [PASS, SLOW], + 'wasm/atomics': [PASS, SLOW], +}], # 'arch == arm or arch == android_arm' + +############################################################################## +['(arch == mipsel or arch == mips or arch == mips64el or arch == mips64) and simulator_run != True', { + # These tests fail occasionally on the buildbots because they consume + # a large amount of memory if executed in parallel. Therefore we + # run only a single instance of these tests + 'regress/regress-crbug-514081': [PASS, NO_VARIANTS], + 'regress/regress-599717': [PASS, NO_VARIANTS], + 'regress/regress-599414-array-concat-fast-path': [PASS, NO_VARIANTS], + 'array-functions-prototype-misc': [PASS, NO_VARIANTS], +}], # 'arch == mipsel or arch == mips or arch == mips64el or arch == mips64' + +############################################################################## +['arch == mipsel or arch == mips or arch == mips64el or arch == mips64 or arch == ppc or arch == ppc64', { + # These tests fail because qNaN and sNaN values are encoded differently on + # MIPS and ARM/x86 architectures + 'wasm/float-constant-folding': [SKIP], +}], + +############################################################################## +['arch == mipsel or arch == mips', { + + # Slow tests which times out in debug mode. + 'try': [PASS, ['mode == debug', SKIP]], + 'array-constructor': [PASS, ['mode == debug', SKIP]], + + # Slow in release mode on MIPS. + 'compiler/regress-stacktrace-methods': [PASS, SLOW], + 'array-splice': [PASS, SLOW], + + # Long running test. + 'string-indexof-2': [PASS, SLOW], + + # Long running tests. Skipping because having them timeout takes too long on + # the buildbot. + 'compiler/alloc-number': [SKIP], + 'regress/regress-490': [SKIP], + 'regress/regress-create-exception': [SKIP], + 'regress/regress-3247124': [SKIP], + + # Requires bigger stack size in the Genesis and if stack size is increased, + # the test requires too much time to run. However, the problem test covers + # should be platform-independent. + 'regress/regress-1132': [SKIP], + + # Currently always deopt on minus zero + 'math-floor-of-div-minus-zero': [SKIP], + + # Requires too much memory on MIPS. + 'regress/regress-752764': [SKIP], + 'regress/regress-779407': [SKIP], + 'harmony/bigint/regressions': [SKIP], + + # Pre-r6 MIPS32 doesn't have instructions needed to properly handle 64-bit + # atomic instructions. + 'wasm/atomics64-stress': [PASS, ['mips_arch_variant != r6', SKIP]], +}], # 'arch == mipsel or arch == mips' + +############################################################################## +['arch == mips64el or arch == mips64', { + + # Slow tests which times out in debug mode. + 'try': [PASS, ['mode == debug', SKIP]], + 'array-constructor': [PASS, ['mode == debug', SKIP]], + + # Slow in release mode on MIPS. + 'compiler/regress-stacktrace-methods': [PASS, SLOW], + 'array-splice': [PASS, SLOW], + + # Long running test. + 'string-indexof-2': [PASS, SLOW], + + # BUG(3251035): Timeouts in long looping crankshaft optimization + # tests. Skipping because having them timeout takes too long on the + # buildbot. + 'compiler/alloc-number': [PASS, SLOW], + 'compiler/array-length': [PASS, SLOW], + 'compiler/assignment-deopt': [PASS, SLOW], + 'compiler/deopt-args': [PASS, SLOW], + 'compiler/inline-compare': [PASS, SLOW], + 'compiler/inline-global-access': [PASS, SLOW], + 'compiler/optimized-function-calls': [PASS, SLOW], + 'compiler/pic': [PASS, SLOW], + 'compiler/property-calls': [PASS, SLOW], + 'compiler/recursive-deopt': [PASS, SLOW], + 'compiler/regress-4': [PASS, SLOW], + 'compiler/regress-funcaller': [PASS, SLOW], + 'compiler/regress-rep-change': [PASS, SLOW], + 'compiler/regress-arguments': [PASS, SLOW], + 'compiler/regress-funarguments': [PASS, SLOW], + 'compiler/regress-3249650': [PASS, SLOW], + 'compiler/simple-deopt': [PASS, SLOW], + 'regress/regress-490': [PASS, SLOW], + 'regress/regress-create-exception': [PASS, SLOW], + 'regress/regress-3218915': [PASS, SLOW], + 'regress/regress-3247124': [PASS, SLOW], + + # Requires bigger stack size in the Genesis and if stack size is increased, + # the test requires too much time to run. However, the problem test covers + # should be platform-independent. + 'regress/regress-1132': [SKIP], + + # Currently always deopt on minus zero + 'math-floor-of-div-minus-zero': [SKIP], + + # Requires too much memory on MIPS. + 'regress/regress-752764': [SKIP], + 'regress/regress-779407': [SKIP], +}], # 'arch == mips64el or arch == mips64' + +['(arch == mips64el or arch == mips64) and simulator_run', { + # Slow tests which have flaky timeout on simulator. + 'wasm/atomics64-stress': [SKIP], +}], # '(arch == mips64el or arch == mips64) and simulator_run' + +############################################################################## +['system == windows', { + # TODO(mstarzinger): Too slow with turbo fan. + 'big-object-literal': [SKIP], + 'math-floor-of-div': [PASS, ['mode == debug', SKIP]], + 'math-floor-of-div-nosudiv': [PASS, ['mode == debug', SKIP]], + 'unicodelctest': [PASS, ['mode == debug', SKIP]], + + # Setting the timezone and locale with environment variables unavailable + 'icu-date-to-string': [SKIP], + 'icu-date-lord-howe': [SKIP], + 'regress/regress-6288': [SKIP], + 'tzoffset-transition-apia': [SKIP], + 'tzoffset-transition-lord-howe': [SKIP], + 'tzoffset-transition-moscow': [SKIP], + 'tzoffset-transition-new-york': [SKIP], + 'tzoffset-transition-new-york-noi18n': [SKIP], + 'tzoffset-seoul': [SKIP], + 'tzoffset-seoul-noi18n': [SKIP], +}], # 'system == windows' + +############################################################################## +['system == android', { + # Tests consistently failing on Android. + # Unable to change locale on Android: + 'icu-date-to-string': [FAIL], + 'regress/regress-6288': [FAIL], + # OOM: + 'regress/regress-748069': [FAIL], + 'regress/regress-752764': [FAIL], + 'regress/regress-779407': [FAIL], + # Flaky OOM: + 'regress/regress-852258': [SKIP], +}], # 'system == android' + +############################################################################## +['system == macos', { + # BUG(v8:5333) + 'big-object-literal': [SKIP], +}], # 'system == macos' + +############################################################################## +['isolates', { + # Slow tests. + 'es6/typedarray-of': [PASS, SLOW], + 'regress/regress-crbug-854299': [PASS, SLOW], +}], # 'isolates' + +############################################################################## +['deopt_fuzzer == True', { + + # Skip tests that are not suitable for deoptimization fuzzing. + 'never-optimize': [SKIP], + 'readonly': [SKIP], + 'array-feedback': [SKIP], + 'deopt-recursive-eager-once': [SKIP], + 'deopt-recursive-lazy-once': [SKIP], + 'deopt-recursive-soft-once': [SKIP], + 'code-coverage-block-opt': [SKIP], + + # Bounds check triggers forced deopt for array constructors. + 'array-constructor-feedback': [SKIP], + + # Deopting uses just enough memory to make this one OOM. + 'regress/regress-3976': [SKIP], + + # Forced optimisation path tests. + 'shared-function-tier-up-turbo': [SKIP], + + # Fails deopt_fuzzer due to --deopt_every_n_times + 'es6/array-iterator-turbo': [SKIP] +}], # 'deopt_fuzzer == True' + +############################################################################## +['gc_fuzzer', { + 'regress/regress-336820': [SKIP], + 'regress/regress-748069': [SKIP], + 'regress/regress-778668': [SKIP], + 'ignition/regress-672027': [PASS, ['tsan', SKIP]], + 'string-replace-gc': [PASS, SLOW, ['mode == debug', SKIP]], + + # Unsuitable for GC fuzzing because coverage information is lost on GC. + 'code-coverage-ad-hoc': [SKIP], + 'code-coverage-precise': [SKIP], + + # Passes incompatible arguments. + 'd8/d8-arguments': [SKIP], + + # Fails allocation on tsan. + 'es6/classes': [PASS, ['tsan', SKIP]], + + # Tests that fail some assertions due to checking internal state sensitive + # to GC. We mark PASS,FAIL to not skip those tests on the endurance fuzzer. + 'array-literal-feedback': [PASS, FAIL], + 'compiler/dataview-neutered': [PASS, FAIL], + 'compiler/native-context-specialization-hole-check': [PASS, FAIL], + 'elements-transition-hoisting': [PASS, FAIL], + 'es6/collections-constructor-custom-iterator': [PASS, FAIL], + 'ignition/throw-if-not-hole': [PASS, FAIL], + 'keyed-load-with-symbol-key': [PASS, FAIL], + 'object-seal': [PASS, FAIL], + 'regress/regress-3709': [PASS, FAIL], + 'regress/regress-385565': [PASS, FAIL], + 'regress/regress-6948': [PASS, FAIL], + 'regress/regress-7014-1': [PASS, FAIL], + 'regress/regress-7014-2': [PASS, FAIL], + 'regress/regress-7510': [PASS, FAIL], + 'regress/regress-crbug-882233-2': [PASS, FAIL], + 'regress/regress-trap-allocation-memento': [PASS, FAIL], + 'regress/regress-unlink-closures-on-deopt': [PASS, FAIL], + 'shared-function-tier-up-turbo': [PASS, FAIL], +}], # 'gc_fuzzer' + +############################################################################## +['endurance_fuzzer', { + # BUG(v8:7400). + 'wasm/lazy-compilation': [SKIP], + + # BUG(v8:7429). + 'regress/regress-599414-array-concat-fast-path': [SKIP], + + # Often crashes due to memory consumption. + 'regress/regress-655573': [SKIP], + + # TSAN allocation failures. + 'deep-recursion': [PASS, ['tsan', SKIP]], + 'regress/regress-430201b': [PASS, ['tsan', SKIP]], + 'regress/regress-crbug-493779': [PASS, ['tsan', SKIP]], + 'regress/wasm/regress-763439': [PASS, ['tsan', SKIP]], +}], # 'endurance_fuzzer' + +############################################################################## +['predictable == True', { + + # Skip tests that are known to be non-deterministic. + 'd8/d8-worker-sharedarraybuffer': [SKIP], + 'd8/d8-os': [SKIP], + 'harmony/futex': [SKIP], + + # BUG(v8:7166). + 'd8/enable-tracing': [SKIP], + # Relies on async compilation which requires background tasks. + 'wasm/streaming-error-position': [SKIP], + # Intentionally non-deterministic using shared arraybuffers. + 'wasm/atomics-stress': [SKIP], + 'wasm/atomics64-stress': [SKIP], + 'wasm/futex': [SKIP], +}], # 'predictable == True' + +############################################################################## +['simulator_run and (arch == ppc or arch == ppc64 or arch == s390 or arch == s390x)', { + + # take too long with the simulator. + 'regress/regress-1132': [SKIP], + 'regress/regress-740784': [SKIP], + 'regress/regress-crbug-482998': [PASS, SLOW], + 'regress/regress-91008': [PASS, SLOW], + 'harmony/regexp-property-lu-ui': [PASS, SLOW], + 'whitespaces': [PASS, SLOW], + 'wasm/atomics-stress': [SKIP], + 'wasm/atomics64-stress': [SKIP], +}], # 'simulator_run and (arch == ppc or arch == ppc64 or arch == s390 or arch == s390x)' + +############################################################################## +['arch == ppc64', { + + # stack overflow + 'big-array-literal': [SKIP], + 'regress/regress-353551': [SKIP], +}], # 'arch == ppc64' + +############################################################################## +['arch == ppc64 or arch == ppc or arch == s390 or arch == s390x', { + + # TODO(ppc/s390): fix constant pool issue and implement tagging for reloc + 'wasm/compiled-module-serialization': [SKIP], + 'regress/wasm/regress-808980': [SKIP], + 'regress/wasm/regress-808848': [SKIP], +}], # 'arch == ppc64 or arch == ppc or arch == s390 or arch == s390x' + +############################################################################## +['variant == stress', { + # Slow tests. + 'array-natives-elements': [SKIP], + 'big-object-literal': [SKIP], + 'es6/array-iterator-turbo': [SKIP], + 'ignition/regress-599001-verifyheap': [SKIP], + 'unicode-test': [SKIP], + + # Flaky crash on Odroid devices: https://crbug.com/v8/7678 + 'regress/regress-336820': [PASS, ['arch == arm and not simulator_run', SKIP]], + + # Too slow for TSAN in stress mode. + 'es6/classes': [PASS, ['tsan', SKIP]], + 'regress/regress-1122': [PASS, ['tsan', SKIP]], + + # Too slow with gc_stress on arm64. + 'messages': [PASS, ['gc_stress and arch == arm64', SKIP]], + + # Slow on arm64 simulator: https://crbug.com/v8/7783 + 'string-replace-gc': [PASS, ['arch == arm64 and simulator_run', SKIP]], + + # Too memory hungry on Odroid devices. + 'regress/regress-678917': [PASS, ['arch == arm and not simulator_run', SKIP]], +}], # variant == stress + +############################################################################## +['variant == stress and (arch == arm or arch == arm64) and simulator_run', { + # Slow tests: https://crbug.com/v8/7783 + 'generated-transition-stub': [SKIP], + 'regress/regress-336820': [SKIP], + 'wasm/grow-memory': [SKIP], +}], # variant == stress and (arch == arm or arch == arm64) and simulator_run + +############################################################################## +['variant == nooptimization and (arch == arm or arch == arm64) and simulator_run', { + # Slow tests: https://crbug.com/v8/7783 + 'md5': [SKIP], + 'packed-elements': [SKIP], + 'regress/regress-crbug-319860': [SKIP], + 'wasm/asm-wasm-f32': [SKIP], + 'wasm/asm-wasm-f64': [SKIP], + 'wasm/grow-memory': [SKIP], +}], # variant == nooptimization and (arch == arm or arch == arm64) and simulator_run + +############################################################################## +['(arch == arm or arch == arm64)', { + # Flaky tests: https://crbug.com/v8/8090 + 'regress/regress-752764': [SKIP], +}], # (arch == arm or arch == arm64) + +############################################################################## +['gcov_coverage', { + # Tests taking too long. + 'array-functions-prototype-misc': [SKIP], + + # Stack overflow. + 'big-array-literal': [SKIP], +}], # 'gcov_coverage' + +############################################################################## +['variant == no_wasm_traps', { + # Skip stuff uninteresting for wasm traps + 'bugs/*': [SKIP], + 'compiler/*': [SKIP], + 'es6/*': [SKIP], + 'es7/*': [SKIP], + 'es8/*': [SKIP], + 'harmony/*': [SKIP], + 'ignition/*': [SKIP], + 'lithium/*': [SKIP], + 'third_party/*': [SKIP], + 'tools/*': [SKIP], + 'apply': [SKIP], + 'math-*': [SKIP], + 'unicode-test': [SKIP], + 'whitespaces': [SKIP], +}], # variant == no_wasm_traps + +############################################################################## +['no_harness', { + # skip assertion tests since the stack trace is broken if mjsunit is + # included in the snapshot + 'mjsunit-assertion-error' : [SKIP], +}], # no_harness + +############################################################################## +['arch != x64 or deopt_fuzzer', { + # Skip stress-deopt-count tests since it's in x64 only + 'compiler/stress-deopt-count-*': [SKIP], +}], # arch != x64 or deopt_fuzzer + +############################################################################## +# Liftoff is currently only sufficiently implemented on x64, ia32, arm64 and +# arm. +# TODO(clemensh): Implement on all other platforms (crbug.com/v8/6600). +['arch != x64 and arch != ia32 and arch != arm64 and arch != arm', { + 'wasm/liftoff': [SKIP], + 'wasm/tier-up-testing-flag': [SKIP], +}], # arch != x64 and arch != ia32 and arch != arm64 and arch != arm + +############################################################################## +['variant == slow_path and gc_stress', { + # Slow tests. + 'regress/regress-crbug-493779': [SKIP], + 'string-replace-gc': [SKIP], +}], # variant == slow_path + +############################################################################## +['arch == x64', { + # TODO: Flaky test: crbug.com/v8/7899 + 'wasm/asm-wasm-i32': [SKIP], + 'wasm/asm-wasm-f64': [SKIP], +}], # arch == x64 + +############################################################################## +['arch in [arm, android_arm, android_ia32, ia32, ppc, s390, s390x, mipsel, mips]', { + # TODO(ssauleau): implement BigInt<>Wasm conversion for other arch - + # crbug.com/v8/7741 + 'wasm/bigint': [SKIP], +}], # arch in [arm, android_arm, android_ia32, ia32, ppc, s390, s390x, mipsel, mips] + +############################################################################## +['arch not in [x64, arm, arm64] or system != linux', { + # Unwinding info writer is only supported on x64, arm, and arm64 Linux + 'regress/regress-913844': [SKIP], +}], + ] diff --git a/implementation-contributed/v8/mjsunit/regress/regress-3218530.js b/implementation-contributed/v8/mjsunit/regress/regress-3218530.js index e69de29bb2..54c66dfded 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-3218530.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-3218530.js @@ -0,0 +1,39 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This tests that a global key values are preserved when used in +// an expression which will bail out. + +var m = Math; +var p = "floor"; + +function test() { + var bignumber = 31363200000; + assertEquals(m[p](Math.round(bignumber/864E5)/7)+1, 52); +} + +test(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-3255.js b/implementation-contributed/v8/mjsunit/regress/regress-3255.js index e69de29bb2..3526d600c9 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-3255.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-3255.js @@ -0,0 +1,19 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --enable-slow-asserts + +var arr = []; +var str = new String('x'); + +function f(a,b) { + a[b] = 1; +} + +f(arr, 0); +f(str, 0); +f(str, 0); + +// This is just to trigger elements validation, object already broken. +%SetKeyedProperty(str, 1, 'y'); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-336820.js b/implementation-contributed/v8/mjsunit/regress/regress-336820.js index e69de29bb2..660a8fc314 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-336820.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-336820.js @@ -0,0 +1,37 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Flags: --max-old-space-size=1600 + +assertThrows((function() { + let str = "a".repeat(1e7); + let arr = new Array(2000); + for (let i = 0; i < 200; ++i) { + arr[i*10] = str; + } + let res = arr.join(':'); +}), RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-5888.js b/implementation-contributed/v8/mjsunit/regress/regress-5888.js index e69de29bb2..6481c79338 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-5888.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-5888.js @@ -0,0 +1,75 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(32, 32, false); + builder.addFunction("test", kSig_i_iii) + .addBodyWithEnd([ +// body: +kExprI64Const, 0xb4, 0x42, +kExprI64Const, 0x7a, +kExprI64Const, 0x42, +kExprI64Const, 0x7a, +kExprI64Ior, +kExprI64Ctz, +kExprI64Ctz, +kExprI64Shl, +kExprI64Mul, +kExprI64Const, 0x41, +kExprI64Ctz, +kExprI64Ctz, +kExprI64Shl, +kExprF32SConvertI64, +kExprI64Const, 0x42, +kExprI64Const, 0x02, +kExprI64Const, 0x7a, +kExprI64Mul, +kExprI64Const, 0x42, +kExprI64Ctz, +kExprI64Shl, +kExprI64Const, 0x7a, +kExprI64Ctz, +kExprI64Shl, +kExprI64Mul, +kExprI64Const, 0x41, +kExprI64Ctz, +kExprI64Ctz, +kExprI64Shl, +kExprF32SConvertI64, +kExprUnreachable, +kExprEnd, // @65 + ]) + .exportFunc(); + var module = new WebAssembly.Module(builder.toBuffer()); +})(); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(16, 32, false); + builder.addFunction("test", kSig_i_iii) + .addBodyWithEnd([ + // body: + kExprI64Const, 0x42, + kExprI64Const, 0x7a, + kExprI64Ctz, + kExprI64Mul, + kExprI64Ctz, + kExprI64Const, 0x41, + kExprI64Ctz, + kExprI64Ctz, + kExprI64Shl, + kExprI64Const, 0x41, + kExprI64Ctz, + kExprI64Ctz, + kExprI64Shl, + kExprF32SConvertI64, + kExprUnreachable, + kExprEnd, // @20 + ]) + .exportFunc(); + var module = new WebAssembly.Module(builder.toBuffer()); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-5911.js b/implementation-contributed/v8/mjsunit/regress/regress-5911.js index e69de29bb2..9d6d4ae5b8 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-5911.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-5911.js @@ -0,0 +1,31 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(32, 32, false); + builder.addFunction("test", kSig_i_iii) + .addBodyWithEnd([ + // body: + kExprI64Const, 0x42, + kExprI64Const, 0x7a, + kExprI64RemU, + kExprI64Const, 0x42, + kExprI64Const, 0x37, + kExprI64Mul, + kExprI64Const, 0x36, + kExprI64Mul, + kExprI64Const, 0x42, + kExprI64Ctz, + kExprI64Ctz, + kExprI64Shl, + kExprF32SConvertI64, + kExprUnreachable, + kExprEnd, // @21 + ]) + .exportFunc(); + var module = new WebAssembly.Module(builder.toBuffer()); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-6711.js b/implementation-contributed/v8/mjsunit/regress/regress-6711.js new file mode 100644 index 0000000000..c1b61c72a1 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-6711.js @@ -0,0 +1,21 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// ensure `delete this` throws before `super` is called. +assertThrows(()=>{ + new class extends Object { + constructor() { + delete this; + super(); + } + } +}, ReferenceError); + +// ensure `delete this` doesn't throw after `super` is called. +new class extends Object { + constructor() { + super(); + delete this; + } +} diff --git a/implementation-contributed/v8/mjsunit/regress/regress-687.js b/implementation-contributed/v8/mjsunit/regress/regress-687.js index e69de29bb2..9dffcc1a9e 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-687.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-687.js @@ -0,0 +1,74 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This regression includes a number of cases where we did not correctly +// update a accessor property to a data property using Object.defineProperty. + +var obj = { get value() {}, set value (v) { throw "Error";} }; +Object.defineProperty(obj, "value", + { value: 5, writable:true, configurable: true }); +var desc = Object.getOwnPropertyDescriptor(obj, "value"); +assertEquals(obj.value, 5); +assertTrue(desc.configurable); +assertTrue(desc.enumerable); +assertTrue(desc.writable); +assertEquals(desc.get, undefined); +assertEquals(desc.set, undefined); + + +var proto = { + get value() {}, + set value(v) { Object.defineProperty(this, "value", {value: v}); } +}; + +var create = Object.create(proto); + +assertEquals(create.value, undefined); +create.value = 4; +assertEquals(create.value, 4); + +// These tests where provided in bug 959, but are all related to the this issue. +var obj1 = {}; +Object.defineProperty(obj1, 'p', {get: undefined, set: undefined}); +assertTrue("p" in obj1); +desc = Object.getOwnPropertyDescriptor(obj1, "p"); +assertFalse(desc.configurable); +assertFalse(desc.enumerable); +assertEquals(desc.value, undefined); +assertEquals(desc.get, undefined); +assertEquals(desc.set, undefined); + + +var obj2 = { get p() {}}; +Object.defineProperty(obj2, 'p', {get: undefined}) +assertTrue("p" in obj2); +desc = Object.getOwnPropertyDescriptor(obj2, "p"); +assertTrue(desc.configurable); +assertTrue(desc.enumerable); +assertEquals(desc.value, undefined); +assertEquals(desc.get, undefined); +assertEquals(desc.set, undefined); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-813440.js b/implementation-contributed/v8/mjsunit/regress/regress-813440.js index e69de29bb2..f4df95daae 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-813440.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-813440.js @@ -0,0 +1,16 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --invoke-weak-callbacks --omit-quit --expose-wasm --allow-natives-syntax + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +const builder = new WasmModuleBuilder(); +builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, 42]); +const buffer = builder.toBuffer(); +// Start async compilation, but don't wait for it to finish. +const module = WebAssembly.compile(buffer); + +// This create the collator. +'퓛'.localeCompare(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-863810.js b/implementation-contributed/v8/mjsunit/regress/regress-863810.js index e69de29bb2..3bec6f5ae9 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-863810.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-863810.js @@ -0,0 +1,18 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-liftoff --no-wasm-tier-up --no-future --debug-code + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('main', kSig_i_v) + .addBody([ + kExprI64Const, 0xa3, 0x82, 0x83, 0x86, 0x8c, 0xd8, 0xae, 0xb5, 0x40, + kExprI32ConvertI64, + kExprI32Const, 0x00, + kExprI32Sub, + ]).exportFunc(); +const instance = builder.instantiate(); +print(instance.exports.main(1, 2, 3)); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-8708.js b/implementation-contributed/v8/mjsunit/regress/regress-8708.js new file mode 100644 index 0000000000..4faff3324c --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-8708.js @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --stack-size=100 + +let array = new Array(1); +array.splice(1, 0, array); + +assertThrows(() => array.flat(Infinity), RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-923723.js b/implementation-contributed/v8/mjsunit/regress/regress-923723.js new file mode 100644 index 0000000000..5a838e558f --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-923723.js @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --stack-size=50 + +function __f_3() { + try { + __f_3(); + } catch(e) { + eval("let fun = ({a} = {a: 30}) => {"); + } +} +assertThrows(__f_3); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-926036.js b/implementation-contributed/v8/mjsunit/regress/regress-926036.js new file mode 100644 index 0000000000..3c8f49c956 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-926036.js @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertThrows("async() => { for await (var a ;;) {} }", SyntaxError); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js index e69de29bb2..87b240227d 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-715455.js @@ -0,0 +1,25 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function MODULE() { + "use asm"; + function f() { + bogus_function_table[0 & LIMIT](); + } + return { f:f }; +} + +var bogus_function_table = [ Object ]; +var test_set = [ 0x3fffffff, 0x7fffffff, 0xffffffff ]; +for (var i = 0; i < test_set.length; ++i) { + bogus_function_table[i] = Object; + var src = MODULE.toString(); + src = src.replace(/MODULE/g, "Module" + i); + src = src.replace(/LIMIT/g, test_set[i]); + var module = eval("(" + src + ")"); + module(this).f(); + assertFalse(%IsAsmWasmCode(module)); +} diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js index e69de29bb2..d9fb4d51d2 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-772056.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +var builder = new WasmModuleBuilder(); +builder.addImportedTable("x", "table", 1, 10000000); +let module = new WebAssembly.Module(builder.toBuffer()); +let table = new WebAssembly.Table({element: "anyfunc", + initial: 1, maximum:1000000}); +let instance = new WebAssembly.Instance(module, {x: {table:table}}); + +assertThrows(() => table.grow(Infinity), TypeError); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-923264.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-923264.js new file mode 100644 index 0000000000..e8c0d43022 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-923264.js @@ -0,0 +1,27 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --verify-heap --expose-gc + +let paramName = ''; +for (let i=0; i < 2**10; i++) { + paramName += 'a'; +} + +let params = ''; +for (let i = 0; i < 2**10; i++) { + params += paramName + i + ','; +} + +let fn = eval(`( + class A { + constructor (${params}) { + function lazy() { + return function lazier() { return ${paramName+1} } + }; + return lazy; + } +})`); + +gc() diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-923265.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-923265.js new file mode 100644 index 0000000000..8e6125b34b --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-923265.js @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let a = {0: 5, 1: 4, 2: 3, length: 2}; +Object.freeze(a); + +assertThrows(() => Array.prototype.sort.call(a)); +assertPropertiesEqual({0: 5, 1: 4, 2: 3, length: 2}, a); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-923705.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-923705.js new file mode 100644 index 0000000000..9cdb98b15b --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-923705.js @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --verify-heap + +function __f_5() { + function __f_1() { + function __f_0() { + ({y = eval()}) => assertEquals()(); + } + } +} + +__f_5(); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-926819.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-926819.js new file mode 100644 index 0000000000..060c72f60e --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-926819.js @@ -0,0 +1,5 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertThrows("a(function(){{let f;function f}})", SyntaxError); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-926856.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-926856.js new file mode 100644 index 0000000000..a3fa934483 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-926856.js @@ -0,0 +1,18 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Need a fast array with enough elements to surpass +// kMaxRegularHeapObjectSize. +var size = 63392; +var a = []; +function build() { + for (let i = 0; i < size; i++) { + a.push(i); + } +} + +build(); + +function c(v) { return v + 0.5; } +a.map(c); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js b/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js index e69de29bb2..b1e92fa4ec 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/loop-stack-check.js @@ -0,0 +1,18 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addFunction("foo", kSig_i_ii) + .addBody([ + kExprLoop, 00, + kExprBrTable, 0xfb, 0xff, 0xff, 0xff, + ]) + .exportFunc(); + assertThrows(function() { builder.instantiate(); }); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-02256.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-02256.js index d1dae276d3..791d2a1d2d 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-02256.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-02256.js @@ -264,7 +264,6 @@ var __v_11 = this; var __v_12 = {}; var __v_13 = {}; try { - load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-module-__v_1.js"); __v_2 = 0x10000; } catch (e) { diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js index e69de29bb2..cea547d09c 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5531.js @@ -0,0 +1,21 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(1, 1, false); + builder.addFunction("foo", kSig_i_v) + .addBody([ + kExprI32Const, 0x00, + kExprI32Const, 0x0b, + kExprI32Const, 0x0f, + kExprBrTable, 0xcb, 0xcb, 0xcb, 0x00, 0x00, 0xcb, 0x00 // entries=1238475 + ]) + .exportFunc(); + assertThrows(function() { builder.instantiate(); }); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js index e69de29bb2..77c436119c 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5800.js @@ -0,0 +1,55 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function AddTest() { + let builder = new WasmModuleBuilder(); + + builder.addFunction("main", kSig_i_v) + .addBody([ + kExprBlock, kWasmStmt, + kExprI64Const, 0, + // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so + // that the 64-bit constant has a non-zero top half. In this bug, the + // top half was clobbering eax, leading to the function return 1 rather + // than 0. + kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10, + kExprI64Add, + kExprI64Eqz, + kExprBrIf, 0, + kExprI32Const, 0, + kExprReturn, + kExprEnd, + kExprI32Const, 0 + ]) + .exportFunc(); + let module = builder.instantiate(); + assertEquals(0, module.exports.main()); +})(); + +(function SubTest() { + let builder = new WasmModuleBuilder(); + + builder.addFunction("main", kSig_i_v) + .addBody([ + kExprBlock, kWasmStmt, + kExprI64Const, 0, + // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so + // that the 64-bit constant has a non-zero top half. In this bug, the + // top half was clobbering eax, leading to the function return 1 rather + // than 0. + kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10, + kExprI64Sub, + kExprI64Eqz, + kExprBrIf, 0, + kExprI32Const, 0, + kExprReturn, + kExprEnd, + kExprI32Const, 0 + ]) + .exportFunc(); + let module = builder.instantiate(); + assertEquals(0, module.exports.main()); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js index e69de29bb2..961e52d2dc 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5860.js @@ -0,0 +1,29 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --expose-wasm + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let module1 = (() => { + let builder = new WasmModuleBuilder(); + builder.addMemory(1, 1); + builder.addFunction('load', kSig_i_i) + .addBody([kExprI32Const, 0, kExprI32LoadMem, 0, 0]) + .exportAs('load'); + return new WebAssembly.Module(builder.toBuffer()); +})(); + +let module2 = (() => { + let builder = new WasmModuleBuilder(); + builder.addMemory(1, 1); + builder.addImport('A', 'load', kSig_i_i); + builder.addExportOfKind('load', kExternalFunction, 0); + return new WebAssembly.Module(builder.toBuffer()); +})(); + +let instance1 = new WebAssembly.Instance(module1); +let instance2 = new WebAssembly.Instance(module2, {A: instance1.exports}); + +assertEquals(0, instance2.exports.load()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js index e69de29bb2..c6013d3f86 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-5884.js @@ -0,0 +1,19 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(31, 31, false); + builder.addFunction('test', kSig_i_iii) + .addBodyWithEnd([ + // body: + kExprI64Const, 0x41, kExprI64Const, 0x41, kExprI64LtS, kExprI32Const, + 0x01, kExprI32StoreMem, 0x00, 0x41, kExprUnreachable, + kExprEnd, // @60 + ]) + .exportFunc(); + var module = builder.instantiate(); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6054.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6054.js index 7b309b6f82..3afb371131 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6054.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6054.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -load('test/mjsunit/wasm/wasm-constants.js'); load('test/mjsunit/wasm/wasm-module-builder.js'); (function() { diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js index e69de29bb2..ed728f5acc 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6164.js @@ -0,0 +1,18 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(31, 31, false); + builder.addFunction('test', kSig_l_v) + .addBodyWithEnd([ +// body: +kExprUnreachable, +kExprEnd, // @374 + ]) + .exportFunc(); + var module = builder.instantiate(); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js index e69de29bb2..a48e5aeef0 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-644682.js @@ -0,0 +1,25 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { +var builder = new WasmModuleBuilder(); +builder.addFunction("regression_644682", kSig_i_v) + .addBody([ + kExprBlock, // @1 + kExprI32Const, 0x3b, + kExprI32LoadMem, 0x00, 0x00, + kExprI32Const, 0x10, + kExprBrIf, 0x01, 0x00, // arity=1 depth0 + kExprI32Const, 0x45, + kExprI32Const, 0x3b, + kExprI64LoadMem16S, 0x00, 0x3b, + kExprBrIf, 0x01, 0x00 // arity=1 depth0 + ]) + .exportFunc(); +assertThrows(function() { builder.instantiate(); }); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-648079.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-648079.js index acc6146ef5..fbb5414480 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-648079.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-648079.js @@ -4,7 +4,6 @@ // Flags: --expose-wasm -load("test/mjsunit/wasm/wasm-constants.js"); load("test/mjsunit/wasm/wasm-module-builder.js"); // Non-standard opcodes. diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js index e69de29bb2..f42f431703 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-651961.js @@ -0,0 +1,23 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(1, 32, false); + builder.addFunction("foo", kSig_i_v) + .addBody([ + kExprMemorySize, kMemoryZero, + kExprI32Const, 0x10, + kExprMemoryGrow, kMemoryZero, + kExprI32Mul, + ]) + .exportFunc(); + var module = builder.instantiate(); + var result = module.exports.foo(); + assertEquals(1, result); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js index e69de29bb2..455139f0bb 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-654377.js @@ -0,0 +1,22 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(1, 1, false); + builder.addFunction("foo", kSig_i_v) + .addBody([ + kExprI32Const, 00, + kExprMemorySize, + kExprBrIf, 00, + kExprMemorySize, + kExprBr, 0xe7, 0xd2, 0xf2, 0xff, 0x1d + ]) + .exportFunc(); + assertThrows(function() { builder.instantiate(); }); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js index e69de29bb2..9643a86acb 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-663994.js @@ -0,0 +1,13 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + var module = builder.instantiate(); + assertTrue(typeof(module.exports) != "undefined"); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js index e69de29bb2..cae5122ca5 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-667745.js @@ -0,0 +1,388 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(0, 0, false); + builder.addFunction("test", kSig_i_iii) + .addBody([ +kExprI32Const, 0x0b, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x67, +kExprI32Const, 0x07, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Eq, +kExprI32RemU, +kExprI32Clz, +kExprI32Const, 0x25, +kExprI32Const, 0x82, 0x6c, +kExprI32Add, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Const, 0x70, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x70, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x67, +kExprI32Clz, +kExprI32Clz, +kExprI32GeS, +kExprI32Const, 0x67, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprDrop, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Const, 0x01, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprSelect, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x0e, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Const, 0x01, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprSelect, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x0e, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Const, 0x01, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprSelect, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x0e, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Const, 0x01, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprSelect, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x41, +kExprI32Const, 0x0e, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x4a, +kExprI32Const, 0x41, +kExprI32LtU, +kExprI32Const, 0x67, +kExprI32Clz, +kExprI32GtS, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Ne, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Const, 0x1a, +kExprI32Const, 0x71, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32ShrS, +kExprI32Clz, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprI32Clz, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Const, 0x4a, +kExprI32Const, 0x41, +kExprI32LtU, +kExprI32Const, 0x67, +kExprI32Clz, +kExprI32GtS, +kExprI32Const, 0x41, +kExprI32Const, 0x41, +kExprI32Ne, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Const, 0x41, +kExprI32Const, 0x1a, +kExprI32Const, 0x71, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32And, +kExprI32ShrS, +kExprI32Clz, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprI32Clz, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprI32Clz, +kExprUnreachable, +kExprCallFunction, 0x00, // function #0 +kExprCallFunction, 0x00, // function #0 +kExprNop, +kExprNop, +kExprNop, +kExprNop, +kExprReturn + ]) + .exportFunc(); + var module = builder.instantiate(); + assertTrue(module != undefined); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js index e69de29bb2..1ac3cc6f2a 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-684858.js @@ -0,0 +1,33 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var name = 'regression_684858'; + +function patchNameLength(buffer) { + var count = 0; + var view = new Uint8Array(buffer); + for (var i = 0, e = view.length - name.length; i <= e; ++i) { + var subs = String.fromCharCode.apply(null, view.slice(i, i + name.length)); + if (subs != name) continue; + ++count; + // One byte before this name, its length is encoded. + // Patch this to 127, making it out of bounds. + if (view.length >= 127) throw Error('cannot patch reliably'); + if (view[i - 1] != name.length) throw Error('unexpected length'); + view[i - 1] = 0x7f; + } + if (count != 1) throw Error('did not find name'); +} + +var builder = new WasmModuleBuilder(); +builder.addFunction(name, kSig_i_v) + .addBody([kExprI32Const, 2, kExprI32Const, 0, kExprI32DivU]) + .exportAs('main'); +var buffer = builder.toBuffer(); +patchNameLength(buffer); +var module = new WebAssembly.Module(buffer); +var instance = new WebAssembly.Instance(module); +assertThrows(() => instance.exports.main(), WebAssembly.RuntimeError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js index e69de29bb2..5e142b3417 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-688876.js @@ -0,0 +1,41 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(16, 32, false); + builder.addFunction('test', kSig_i_i) + .addBodyWithEnd([ + kExprI32Const, 0x41, + kExprI32Const, 0x45, + kExprI32Const, 0x41, + kExprI32DivU, + kExprI32LoadMem8S, 0x00, 0x3a, + kExprI32Const, 0x75, + kExprI32Const, 0x75, + kExprI32Const, 0x6e, + kExprI32Eqz, + kExprI32LoadMem8S, 0x00, 0x3a, + kExprI32Add, + kExprI32DivU, + kExprI32LoadMem8S, 0x00, 0x74, + kExprI32And, + kExprI32Eqz, + kExprI32And, +kExprMemoryGrow, 0x00, + kExprI32Const, 0x55, + kExprI32LoadMem8S, 0x00, 0x3a, + kExprI32LoadMem16U, 0x00, 0x71, + kExprI32Const, 0x00, + kExprI32RemU, + kExprI32And, +kExprI32Eqz, +kExprEnd, // @44 + ]) + .exportFunc(); + var module = builder.instantiate(); + assertThrows(() => {module.exports.test(1);}); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js index e69de29bb2..bcd25387b4 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-689450.js @@ -0,0 +1,24 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(16, 32, false); + builder.addFunction('test', kSig_i_i) + .addBodyWithEnd([ + kExprGetLocal, 0x00, + kExprI32Const, 0x29, + kExprI32Shl, + kExprI32Const, 0x18, + kExprI32ShrS, + kExprI32Const, 0x18, + kExprI32Shl, + kExprEnd, + ]) + .exportFunc(); + var module = builder.instantiate(); + assertEquals(0, module.exports.test(16)); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js index e69de29bb2..5edf25761f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-6931.js @@ -0,0 +1,29 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +load('test/mjsunit/wasm/wasm-module-builder.js'); + + +// This test checks for accidental sign extension. The Wasm spec says we do +// arbitrary precision unsigned arithmetic to compute the memory address, +// meaning this test should do 0xfffffffc + 8, which is 0x100000004 and out of +// bounds. However, if we interpret 0xfffffffc as -4, then the result is 4 and +// succeeds erroneously. + + +(function() { + let builder = new WasmModuleBuilder(); + builder.addMemory(1, 1, false); + builder.addFunction('test', kSig_v_v) + .addBody([ + kExprI32Const, 0x7c, // address = -4 + kExprI32Const, 0, + kExprI32StoreMem, 0, 8, // align = 0, offset = 8 + ]) + .exportFunc(); + let module = builder.instantiate(); + + assertTraps(kTrapMemOutOfBounds, module.exports.test); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js index e69de29bb2..8a70afa591 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-699485.js @@ -0,0 +1,21 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { +"use asm"; +var builder = new WasmModuleBuilder(); +builder.addMemory(0, 5, false); +builder.addFunction("regression_699485", kSig_i_v) + .addBody([ + kExprI32Const, 0x04, + kExprNop, + kExprMemoryGrow, 0x00, + ]).exportFunc(); +let module = builder.instantiate(); +assertEquals(0, module.exports.regression_699485()); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js index e69de29bb2..21a84bcf28 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-702460.js @@ -0,0 +1,50 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// Non-standard opcodes. +let kSig_s_v = makeSig([], [kWasmS128]); +let kExprS128LoadMem = 0xc0; + +(function() { +"use asm"; + var builder = new WasmModuleBuilder(); + builder.addFunction("regression_702460", kSig_i_v) + .addBody([ + kExprI32Const, 0x52, + kExprI32Const, 0x41, + kExprI32Const, 0x3c, + kExprI32Const, 0xdc, 0x01, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprSetLocal, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprMemoryGrow, 0x00, + kExprS128LoadMem, 0x00, 0x40, + kExprUnreachable, + kExprMemoryGrow, 0x00 + ]).exportFunc(); + assertThrows(() => builder.instantiate()); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js index e69de29bb2..58dff5e2f9 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7033.js @@ -0,0 +1,19 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_iii) + .addBodyWithEnd([ + kExprI32Const, 0x07, // i32.const 7 + kExprI32Const, 0x00, // i32.const 0 + kExprI32Const, 0x00, // i32.const 0 + kExprI32And, // i32.and + kExprI32And, // i32.and + kExprEnd, // - + ]) + .exportFunc(); +var module = builder.instantiate(); +assertEquals(0, module.exports.test()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js index e69de29bb2..73485494b3 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7035.js @@ -0,0 +1,30 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_iii) + .addBodyWithEnd([ + kExprI32Const, 0x00, // i32.const 0 + kExprI32Const, 0x00, // i32.const 0 + kExprI32Add, // i32.add -> 0 + kExprI32Const, 0x00, // i32.const 0 + kExprI32Const, 0x00, // i32.const 0 + kExprI32Add, // i32.add -> 0 + kExprI32Add, // i32.add -> 0 + kExprI32Const, 0x01, // i32.const 1 + kExprI32Const, 0x00, // i32.const 0 + kExprI32Add, // i32.add -> 1 + kExprBlock, 0x7f, // @39 i32 + kExprI32Const, 0x00, // i32.const 0 + kExprBr, 0x00, // depth=0 + kExprEnd, // @90 + kExprI32Add, // i32.add -> 1 + kExprI32Add, // i32.add -> 1 + kExprEnd + ]) + .exportFunc(); +var module = builder.instantiate(); +assertEquals(1, module.exports.test()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js index e69de29bb2..6d2cd351fb 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7049.js @@ -0,0 +1,53 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-gc + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// Build two instances, instance 2 is interpreted, and calls instance 1 (via +// C_WASM_ENTRY), instance 1 then calls JS, which triggers GC. + +let builder1 = new WasmModuleBuilder(); + +function call_gc() { + print('Triggering GC.'); + gc(); + print('Survived GC.'); +} +let func1_sig = makeSig(new Array(8).fill(kWasmI32), [kWasmI32]); +let imp = builder1.addImport('q', 'gc', kSig_v_v); +let func1 = builder1.addFunction('func1', func1_sig) + .addBody([ + kExprGetLocal, 0, // - + kExprCallFunction, imp + ]) + .exportFunc(); +let instance1 = builder1.instantiate({q: {gc: call_gc}}); + +let builder2 = new WasmModuleBuilder(); + +let func1_imp = builder2.addImport('q', 'func1', func1_sig); +let func2 = builder2.addFunction('func2', kSig_i_i) + .addBody([ + kExprGetLocal, 0, // 1 + kExprGetLocal, 0, // 2 + kExprGetLocal, 0, // 3 + kExprGetLocal, 0, // 4 + kExprGetLocal, 0, // 5 + kExprGetLocal, 0, // 6 + kExprGetLocal, 0, // 7 + kExprGetLocal, 0, // 8 + kExprCallFunction, func1_imp + ]) + .exportFunc(); + +let instance2 = builder2.instantiate({q: {func1: instance1.exports.func1}}); + +%RedirectToWasmInterpreter( + instance2, parseInt(instance2.exports.func2.name)); + +// Call with 1. This will be passed by the C_WASM_ENTRY via the stack, and the +// GC will try to dereference it (before the bug fix). +instance2.exports.func2(1); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js index e69de29bb2..dc90a0aba3 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-708714.js @@ -0,0 +1,22 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +var builder = new WasmModuleBuilder(); + +builder.addExplicitSection([kFunctionSectionCode, + // length + 7, + // functions count + 1, + // signature index (invalid LEB) + 0xff, 0xff, 0xff, 0xff, 0xff]); +builder.addExplicitSection([kStartSectionCode, + // length + 1, + // index + 0]); + +assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js index e69de29bb2..a6e03e0a0b 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-709684.js @@ -0,0 +1,77 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --allow-natives-syntax + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let importingModuleBinary1 = (() => { + var builder = new WasmModuleBuilder(); + builder.addImport('', 'f', kSig_i_v); + return new Int8Array(builder.toBuffer()); +})(); + +let importingModuleBinary2 = (() => { + var builder = new WasmModuleBuilder(); + builder.addImport('', 'f', kSig_i_v); + builder.addFunction('g', kSig_v_v) + .addBody([kExprNop]); + return new Int8Array(builder.toBuffer()); +})(); + +let importingModuleBinary3 = (() => { + var builder = new WasmModuleBuilder(); + builder.addImport('', 'f', kSig_i_v); + builder.addImport('', 'f2', kSig_i_v); + builder.addFunction('g', kSig_v_v) + .addBody([kExprNop]); + return new Int8Array(builder.toBuffer()); +})(); + +let importingModuleBinary4 = (() => { + var builder = new WasmModuleBuilder(); + builder.addFunction('g', kSig_v_v) + .addBody([kExprNop]); + return new Int8Array(builder.toBuffer()); +})(); + +const complexImportingModuleBinary1 = (() => { + let builder = new WasmModuleBuilder(); + + builder.addImport('a', 'b', kSig_v_v); + builder.addImportedMemory('c', 'd', 1); + builder.addImportedTable('e', 'f', 1); + builder.addImportedGlobal('g', '⚡', kWasmI32); + builder.addFunction('g', kSig_v_v) + .addBody([kExprNop]); + return builder.toBuffer(); +})(); + +const complexImportingModuleBinary2 = (() => { + let builder = new WasmModuleBuilder(); + + builder.addImport('a', 'b', kSig_v_v); + builder.addImportedMemory('c', 'd', 1); + builder.addImportedTable('e', 'f', 1); + builder.addImportedGlobal('g', '⚡', kWasmI32); + builder.addFunction('g', kSig_v_v) + .addBody([kExprNop]); + return builder.toBuffer(); +})(); + +var tests = [ + importingModuleBinary1, + importingModuleBinary2, + importingModuleBinary3, + importingModuleBinary4, + complexImportingModuleBinary1, + complexImportingModuleBinary2 +]; + +for (var index in tests) { + assertPromiseResult( + WebAssembly.compile(tests[index]), + m => assertTrue(m instanceof WebAssembly.Module), + assertUnreachable); +} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js index e69de29bb2..3bafe41c0f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-710844.js @@ -0,0 +1,22 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + "use asm"; + var builder = new WasmModuleBuilder(); + builder.addMemory(0, 5, true); + builder.addFunction("regression_710844", kSig_v_v) + .addBody([ + kExprI32Const, 0x03, + kExprNop, + kExprMemoryGrow, 0x00, + kExprI32Const, 0x13, + kExprNop, + kExprI32StoreMem8, 0x00, 0x10 + ]).exportFunc(); + let instance = builder.instantiate(); + instance.exports.regression_710844(); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js index e69de29bb2..beca86d378 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-711203.js @@ -0,0 +1,29 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(16, 32, false); + builder.addFunction("test", kSig_i_iii) + .addBodyWithEnd([ + // body: + kExprI64Const, 0, + kExprI64Const, 0x1, + kExprI64Clz, + kExprI64Sub, + kExprI64Const, 0x10, + kExprI64Const, 0x1b, + kExprI64Shl, + kExprI64Sub, + kExprI64Popcnt, + kExprI32ConvertI64, + kExprEnd, // @207 + ]) + .exportFunc(); + var module = builder.instantiate(); + const result = module.exports.test(1, 2, 3); + assertEquals(58, result); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js index e69de29bb2..85e93e07c9 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-715216b.js @@ -0,0 +1,12 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-interpret-all --wasm-lazy-compilation + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +var builder = new WasmModuleBuilder(); +builder.addFunction('f', kSig_v_v).addBody([]); +builder.addFunction('g', kSig_v_v).addBody([]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js index e69de29bb2..5868d76190 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-722445.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addFunction('f', kSig_v_v).addBody([ + kExprI32Const, 0, kExprBrTable, + // 0x80000000 in LEB: + 0x80, 0x80, 0x80, 0x80, 0x08, + // First break target. Creation of this node triggered the bug. + 0 +]); +assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js index e69de29bb2..b215b6021a 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724846.js @@ -0,0 +1,13 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// Flags: --wasm-max-mem-pages=49152 + +let builder = new WasmModuleBuilder(); +const num_pages = 49152; +builder.addMemory(num_pages, num_pages); +// num_pages * 64k (page size) > kMaxInt. +assertThrows(() => builder.instantiate(), RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js index e69de29bb2..5c4c421a1c 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724851.js @@ -0,0 +1,11 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let builder = new WasmModuleBuilder(); +builder.addFunction('f', kSig_i_v).addBody([kExprReturn]); +assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js index e69de29bb2..cbe5d35d54 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-724972.js @@ -0,0 +1,10 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addMemory(0, 0, true); +var instance = builder.instantiate(); +instance.exports.memory.buffer; diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js index e69de29bb2..3096334096 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727222.js @@ -0,0 +1,13 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addMemory(0, 0, false); +builder.addFunction('f', kSig_i_v) + .addBody([kExprMemorySize, kMemoryZero]) + .exportFunc(); +var instance = builder.instantiate(); +instance.exports.f(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js index e69de29bb2..e9ed441860 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-727560.js @@ -0,0 +1,17 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +{ + let builder = new WasmModuleBuilder(); + builder.addMemory(); + builder.exportMemoryAs("exported_mem"); + i1 = builder.instantiate(); +} +{ + let builder = new WasmModuleBuilder(); + builder.addImportedMemory("fil", "imported_mem"); + i2 = builder.instantiate({fil: {imported_mem: i1.exports.exported_mem}}); +} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js index e69de29bb2..8cabd515b3 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-729991.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let builder = new WasmModuleBuilder(); +builder.addCustomSection('BBBB', []); +builder.addCustomSection('AAAA', new Array(32).fill(0)); +let buffer = builder.toBuffer(); +// Shrink the buffer by 30 bytes (content of the unknown section named 'AAAA'). +buffer = buffer.slice(0, buffer.byteLength - 30); +// Instantiation should fail on the truncated buffer. +assertThrows(() => new WebAssembly.Module(buffer), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js index e69de29bb2..b861141db7 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734246.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let builder = new WasmModuleBuilder(); +builder.addExplicitSection([ + kUnknownSectionCode, + // section length + 0x0f, + // name length: 0xffffffff + 0xf9, 0xff, 0xff, 0xff, 0x0f +]); +assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js index e69de29bb2..d7486d2d1e 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-734345.js @@ -0,0 +1,27 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-gc + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +builder1 = new WasmModuleBuilder(); +builder1.addFunction('exp1', kSig_v_v).addBody([kExprUnreachable]).exportFunc(); + +builder2 = new WasmModuleBuilder(); +builder2.addImport('imp', 'imp', kSig_v_v); +builder2.addFunction('call_imp', kSig_v_v) + .addBody([kExprCallFunction, 0]) + .exportFunc(); + +export1 = builder1.instantiate().exports.exp1; +export2 = builder2.instantiate({imp: {imp: export1}}).exports.call_imp; +export1 = undefined; + +let a = [0]; +for (i = 0; i < 10; ++i) { + a = a.concat(new Array(i).fill(i)); + assertThrows(() => export2(), WebAssembly.RuntimeError); + gc(); +} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js index e69de29bb2..81f45fe6a5 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7353.js @@ -0,0 +1,28 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32); +builder.addFunction('grow', kSig_i_i).addBody([ + kExprGetLocal, 0, + kExprMemoryGrow, 0, +]).exportFunc(); +builder.addFunction('main', kSig_i_i).addBody([ + ...wasmI32Const(0x41), + kExprSetLocal, 0, + // Enter loop, such that values are spilled to the stack. + kExprLoop, kWasmStmt, + kExprEnd, + // Reload value. This must be loaded as 32 bit value. + kExprGetLocal, 0, + kExprI32LoadMem, 0, 0, +]).exportFunc(); +const instance = builder.instantiate(); +// Execute grow, such that the stack contains garbage data afterwards. +instance.exports.grow(1); +instance.exports.main(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js index e69de29bb2..f508585ebb 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7364.js @@ -0,0 +1,30 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const exportingModuleBinary = (() => { + const builder = new WasmModuleBuilder(); + builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, 42]).exportFunc(); + return builder.toBuffer(); +})(); + +const exportingModule = new WebAssembly.Module(exportingModuleBinary); +const exportingInstance = new WebAssembly.Instance(exportingModule); + +const reExportingModuleBinary = (() => { + const builder = new WasmModuleBuilder(); + const gIndex = builder.addImport('a', 'g', kSig_i_v); + builder.addExport('y', gIndex); + return builder.toBuffer(); +})(); + +const module = new WebAssembly.Module(reExportingModuleBinary); +const imports = { + a: {g: exportingInstance.exports.f}, +}; +const instance = new WebAssembly.Instance(module, imports); + +// Previously exported Wasm functions are re-exported with the same value +assertEquals(instance.exports.y, exportingInstance.exports.f); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js index e69de29bb2..0e027f3a57 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-736584.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let mem = new WebAssembly.Memory({initial: 0}); +let builder = new WasmModuleBuilder(); +builder.addImportedMemory("mod", "imported_mem"); +builder.addFunction('mem_size', kSig_i_v) + .addBody([kExprMemorySize, kMemoryZero]) + .exportFunc(); +let instance = builder.instantiate({mod: {imported_mem: mem}}); +instance.exports.mem_size(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js index e69de29bb2..b5cae8daa4 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7366.js @@ -0,0 +1,32 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction(undefined, kSig_i_iii).addBody([ + // Return the sum of all arguments. + kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kExprI32Add, kExprI32Add +]); +const sig = builder.addType(kSig_i_iii); +builder.addFunction(undefined, kSig_i_iii) + .addBody([ + ...wasmI32Const(1), // i32.const 0x1 + kExprSetLocal, 0, // set_local 0 + ...wasmI32Const(4), // i32.const 0x1 + kExprSetLocal, 1, // set_local 1 + ...wasmI32Const(16), // i32.const 0x1 + kExprSetLocal, 2, // set_local 2 + kExprLoop, kWasmStmt, // loop + kExprEnd, // end + kExprGetLocal, 0, // get_local 0 + kExprGetLocal, 1, // get_local 1 + kExprGetLocal, 2, // get_local 2 + kExprI32Const, 0, // i32.const 0 (func index) + kExprCallIndirect, sig, 0, // call indirect + ]) + .exportAs('main'); +builder.appendToTable([0]); +const instance = builder.instantiate(); +assertEquals(21, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js index e69de29bb2..e4c4fae895 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-737069.js @@ -0,0 +1,34 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +let binary = new Binary; + +binary.emit_header(); +binary.emit_section(kTypeSectionCode, section => { + section.emit_u32v(1); // number of types + section.emit_u8(kWasmFunctionTypeForm); + section.emit_u32v(0); // number of parameters + section.emit_u32v(0); // number of returns +}); +binary.emit_section(kFunctionSectionCode, section => { + section.emit_u32v(1); // number of functions + section.emit_u32v(0); // type index +}); + +binary.emit_u8(kCodeSectionCode); +binary.emit_u8(0x02); // section length +binary.emit_u8(0x01); // number of functions +binary.emit_u8(0x40); // function body size +// Function body is missing here. + +let buffer = new ArrayBuffer(binary.length); +let view = new Uint8Array(buffer); +for (let i = 0; i < binary.length; i++) { + view[i] = binary[i] | 0; +} +WebAssembly.validate(buffer); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js index e69de29bb2..a191c828d6 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-739768.js @@ -0,0 +1,32 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// Flags: --wasm-lazy-compilation + +let builder0 = new WasmModuleBuilder(); +builder0.setName('module_0'); +let sig_index = builder0.addType(kSig_i_v); +builder0.addFunction('main', kSig_i_i) + .addBody([ + kExprGetLocal, 0, // -- + kExprCallIndirect, sig_index, kTableZero + ]) // -- + .exportAs('main'); +builder0.setTableBounds(3, 3); +builder0.addExportOfKind('table', kExternalTable); +let module0 = new WebAssembly.Module(builder0.toBuffer()); +let instance0 = new WebAssembly.Instance(module0); + +let builder1 = new WasmModuleBuilder(); +builder1.setName('module_1'); +builder1.addFunction('main', kSig_i_v).addBody([kExprUnreachable]); +builder1.addImportedTable('z', 'table'); +builder1.addElementSegment(0, false, [0], true); +let module1 = new WebAssembly.Module(builder1.toBuffer()); +let instance1 = + new WebAssembly.Instance(module1, {z: {table: instance0.exports.table}}); +assertThrows( + () => instance0.exports.main(0), WebAssembly.RuntimeError, 'unreachable'); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js index e69de29bb2..71e1eb89bd 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7422.js @@ -0,0 +1,26 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +sig = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +builder.addFunction(undefined, sig).addBody([kExprGetLocal, 4]); +builder.addMemory(16, 32); +builder.addFunction('main', sig) + .addBody([ + kExprI32Const, 0, kExprSetLocal, 0, + // Compute five arguments to the function call. + kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, + kExprGetLocal, 4, kExprI32Const, 1, kExprI32Add, + // Now some intermediate computation to force the arguments to be spilled + // to the stack: + kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add, kExprGetLocal, 1, + kExprGetLocal, 1, kExprI32Add, kExprI32Add, kExprDrop, + // Now call the function. + kExprCallFunction, 0 + ]) + .exportFunc(); +var instance = builder.instantiate(); +assertEquals(11, instance.exports.main(2, 4, 6, 8, 10)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js index e69de29bb2..74e4d53a17 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7499.js @@ -0,0 +1,18 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32); +builder.addFunction(undefined, kSig_v_v).addBody([ + kExprI32Const, 0, // i32.const 0 + kExprI64LoadMem, 0, 0xff, 0xff, 0xff, 0xff, + 0x0f, // i64.load align=0 offset=0xffffffff + kExprDrop, // drop +]); +builder.addExport('main', 0); +const module = builder.instantiate(); +assertThrows( + () => module.exports.main(), WebAssembly.RuntimeError, /out of bounds/); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js index e69de29bb2..10ce500a44 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7508.js @@ -0,0 +1,20 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction(undefined, kSig_v_v).addLocals({i64_count: 1}).addBody([ + kExprI64Const, 0xeb, 0xd7, 0xaf, 0xdf, + 0xbe, 0xfd, 0xfa, 0xf5, 0x6b, // i64.const + kExprI32Const, 0, // i32.const + kExprIf, kWasmI32, // if i32 + kExprI32Const, 0, // i32.const + kExprElse, // else + kExprI32Const, 0, // i32.const + kExprEnd, // end + kExprBrIf, 0, // br_if depth=0 + kExprSetLocal, 0, // set_local 0 +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js index e69de29bb2..938ecbf252 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-752423.js @@ -0,0 +1,32 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +'use strict'; + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +var builder = new WasmModuleBuilder(); +builder.addImportedTable("x", "table", 1, 10000000); +builder.addFunction("main", kSig_i_i) + .addBody([ + kExprI32Const, 0, + kExprGetLocal, 0, + kExprCallIndirect, 0, kTableZero]) + .exportAs("main"); +let module = new WebAssembly.Module(builder.toBuffer()); +let table = new WebAssembly.Table({element: "anyfunc", + initial: 1, maximum:1000000}); +let instance = new WebAssembly.Instance(module, {x: {table:table}}); + +table.grow(0x40001); + +let instance2 = new WebAssembly.Instance(module, {x: {table:table}}); + +try { + instance2.exports.main(402982); // should be OOB +} catch (e) { + print("Correctly caught: ", e); +} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js index e69de29bb2..c9d4e2ca88 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7565.js @@ -0,0 +1,19 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +sig0 = makeSig([], [kWasmI32]); +builder.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([ + kExprLoop, kWasmI32, // loop i32 + kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const 0 --> f32:0 + kExprGetLocal, 0x00, // get_local 0 --> i64:0 + kExprF32SConvertI64, // f32.sconvert/i64 --> f32:0 + kExprF32Ge, // f32.ge --> i32:1 + kExprEnd, // end +]); +builder.addExport('main', 0); +const module = builder.instantiate(); +assertEquals(1, module.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js index e69de29bb2..28e554b87a 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-757217.js @@ -0,0 +1,19 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let builder = new WasmModuleBuilder(); +builder.addImport('','f', kSig_v_v); +builder.addExport('a', 0); +builder.addExport('b', 0); +var bytes = builder.toBuffer(); + +var m = new WebAssembly.Module(bytes); +assertTrue(m instanceof WebAssembly.Module); + +assertPromiseResult( + WebAssembly.compile(bytes) + .then(async_result => assertTrue(async_result instanceof WebAssembly.Module), + assertUnreachable)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js index e69de29bb2..876a76cad9 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7579.js @@ -0,0 +1,61 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +// Generate function 1 (out of 2). +sig0 = makeSig([], [kWasmI32]); +builder.addFunction(undefined, sig0) + .addBody([ + kExprI64Const, 0xc8, 0xda, 0x9c, 0xbc, 0xf8, 0xf0, 0xe1, 0xc3, 0x87, 0x7f, + kExprLoop, kWasmF64, + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + kExprCallFunction, 0x01, + ...wasmF64Const(0), + kExprEnd, + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + ...wasmF64Const(0), + kExprCallFunction, 0x01, + kExprI64Const, 0xb9, 0xf2, 0xe4, 0x01, + kExprI64LtS]); +// Generate function 2 (out of 2). +sig1 = makeSig(new Array(12).fill(kWasmF64), []); +builder.addFunction(undefined, sig1).addBody([]); +builder.addExport('main', 0); +const instance = builder.instantiate(); +assertEquals(1, instance.exports.main()); + +const builder2 = new WasmModuleBuilder(); +sig0 = makeSig([], [kWasmI32]); +builder2.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([ + kExprLoop, kWasmI32, // loop i32 + kExprGetLocal, 0, // get_local 3 + kExprF32SConvertI64, // f32.sconvert/i64 + kExprI32ReinterpretF32, // i32.reinterpret/f32 + kExprEnd // end +]); +builder2.addExport('main', 0); +const instance2 = builder2.instantiate(); +assertEquals(0, instance2.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js index e69de29bb2..d8b5e9d7fc 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7582.js @@ -0,0 +1,47 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addGlobal(kWasmI32, 1); +sig0 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +builder.addFunction(undefined, sig0) + .addBody([ +kExprF32Const, 0x01, 0x00, 0x00, 0x00, +kExprF32Const, 0x00, 0x00, 0x00, 0x00, +kExprF32Eq, // --> i32:0 +kExprF32Const, 0xc9, 0xc9, 0x69, 0xc9, +kExprF32Const, 0xc9, 0xc9, 0xc9, 0x00, +kExprF32Eq, // --> i32:0 i32:0 +kExprIf, kWasmF32, + kExprF32Const, 0x00, 0x00, 0x00, 0x00, +kExprElse, // @32 + kExprF32Const, 0x00, 0x00, 0x00, 0x00, + kExprEnd, // --> i32:0 f32:0 +kExprF32Const, 0xc9, 0x00, 0x00, 0x00, +kExprF32Const, 0xc9, 0xc9, 0xc9, 0x00, +kExprF32Const, 0xc9, 0xc9, 0xa0, 0x00, // --> i32:0 f32:0 f32 f32 f32 +kExprF32Eq, // --> i32:0 f32:0 f32 i32:0 +kExprIf, kWasmF32, + kExprF32Const, 0x00, 0x00, 0x00, 0x00, +kExprElse, + kExprF32Const, 0x00, 0x00, 0x00, 0x00, + kExprEnd, // --> i32:0 f32:0 f32 f32:0 +kExprF32Eq, // --> i32:0 f32:0 i32:0 +kExprIf, kWasmF32, + kExprF32Const, 0x00, 0x00, 0x00, 0x00, +kExprElse, + kExprF32Const, 0x00, 0x00, 0x00, 0x00, + kExprEnd, // --> i32:0 f32:0 f32:0 +kExprF32Const, 0xc9, 0xc9, 0xff, 0xff, // --> i32:0 f32:0 f32:0 f32 +kExprF32Eq, // --> i32:0 f32:0 i32:0 +kExprDrop, +kExprDrop, // --> i32:0 +kExprI32Const, 1, // --> i32:0 i32:1 +kExprI32GeU, // --> i32:0 + ]); +builder.addExport('main', 0); +const instance = builder.instantiate(); +assertEquals(0, instance.exports.main(1, 2, 3)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js index e69de29bb2..ef84b97859 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763439.js @@ -0,0 +1,21 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addMemory(0, 1234, false); +builder.addFunction('f', kSig_i_v) + .addBody([ + kExprI32Const, 0x1d, // -- + kExprMemoryGrow, 0x00, // -- + kExprI32LoadMem, 0x00, 0xff, 0xff, 0x45, // -- + ]) + .exportFunc(); + +var module = new WebAssembly.Module(builder.toBuffer()); +var instance1 = new WebAssembly.Instance(module); +instance1.exports.f(); +var instance2 = new WebAssembly.Instance(module); +instance2.exports.f(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js index e69de29bb2..c831a55fba 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-763697.js @@ -0,0 +1,14 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --no-experimental-wasm-simd + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let builder = new WasmModuleBuilder(); + builder.addFunction("main", kSig_i_i) + .addBody([kExprGetLocal, 0]) + .addLocals({s128_count: 1}); + + assertFalse(WebAssembly.validate(builder.toBuffer())); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js index e69de29bb2..3aaff40636 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-766003.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --wasm-interpret-all + +load('test/mjsunit/wasm/wasm-module-builder.js'); + + __v_6 = new WasmModuleBuilder(); +__v_6.addFunction('exp1', kSig_i_i).addBody([kExprUnreachable]).exportFunc(); + __v_7 = new WasmModuleBuilder(); + __v_7.addImport('__v_11', '__v_11', kSig_i_i); +try { +; } catch(e) {; } + __v_8 = __v_6.instantiate().exports.exp1; + __v_9 = __v_7.instantiate({__v_11: {__v_11: __v_8}}).exports.call_imp; diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js index e69de29bb2..71aaa45bfd 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-769637.js @@ -0,0 +1,16 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let builder = new WasmModuleBuilder(); +builder + .addMemory() + .addFunction("main", kSig_v_v) + .addBody([kExprI32Const, 4, + kExprI32Const, 8, + kExprI32StoreMem, 0, 16]) + .exportAs("main"); +let instance = builder.instantiate(); +assertTraps(kTrapMemOutOfBounds, instance.exports.main); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js index e69de29bb2..81b9e8f2a9 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-771243.js @@ -0,0 +1,38 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --wasm-interpret-all + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +assertThrows(() => { + __v_29 = 0; +function __f_1() { + __v_19 = new WasmModuleBuilder(); + if (__v_25) { + __v_23 = __v_19.addImport('__v_24', '__v_30', __v_25); + } + if (__v_18) { + __v_19.addMemory(); + __v_19.addFunction('load', kSig_i_i) + .addBody([ 0]) + .exportFunc(); + } + return __v_19; +} + (function TestExternalCallBetweenTwoWasmModulesWithoutAndWithMemory() { + __v_21 = __f_1(__v_18 = false, __v_25 = kSig_i_i); + __v_21.addFunction('plus_one', kSig_i_i) + .addBody([ + kExprGetLocal, 0, // - + kExprCallFunction, __v_29 ]) + .exportFunc(); + __v_32 = + __f_1(__v_18 = true, __v_25 = undefined); + __v_31 = __v_32.instantiate(); try { __v_32[__getRandomProperty()] = __v_0; delete __v_18[__getRandomProperty()]; delete __v_34[__getRandomProperty()]; } catch(e) {; }; + __v_20 = __v_21.instantiate( + {__v_24: {__v_30: __v_31.exports.load}}); + __v_20.exports.plus_one(); __v_33 = __v_43; +})(); +}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js index e69de29bb2..e8547c8175 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-772332.js @@ -0,0 +1,32 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --wasm-interpret-all + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +assertThrows(() => { +let __v_50315 = 0; +function __f_15356(__v_50316, __v_50317) { + let __v_50318 = new WasmModuleBuilder(); + if (__v_50317) { + let __v_50319 = __v_50318.addImport('import_module', 'other_module_fn', kSig_i_i); + } + __v_50318.addMemory(); + __v_50318.addFunction('load', kSig_i_i).addBody([ 0, 0, 0]).exportFunc(); + return __v_50318; +} + (function __f_15357() { + let __v_50320 = __f_15356(__v_50350 = false, __v_50351 = kSig_i_i); + __v_50320.addFunction('plus_one', kSig_i_i).addBody([kExprGetLocal, 0, kExprCallFunction, __v_50315, kExprI32Const, kExprI32Add, kExprReturn]).exportFunc(); + let __v_50321 = __f_15356(); + let __v_50324 = __v_50321.instantiate(); + let __v_50325 = __v_50320.instantiate({ + import_module: { + other_module_fn: __v_50324.exports.load + } + }); + __v_50325.exports.plus_one(); + })(); +}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js index e69de29bb2..69a1f68dc0 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-775366.js @@ -0,0 +1,29 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function BadTypeSection() { + var data = bytes( + kWasmH0, + kWasmH1, + kWasmH2, + kWasmH3, + + kWasmV0, + kWasmV1, + kWasmV2, + kWasmV3, + + kTypeSectionCode, + 5, + 2, + 0x60, + 0, + 0, + 13 + ); + + assertFalse(WebAssembly.validate(data)); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js index e69de29bb2..72638b1685 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7785.js @@ -0,0 +1,43 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --experimental-wasm-anyref + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function testAnyRefNull() { + const builder = new WasmModuleBuilder(); + builder.addFunction('main', kSig_r_v) + .addBody([kExprRefNull]) + .exportFunc(); + + var wire_bytes = builder.toBuffer(); + var module = new WebAssembly.Module(wire_bytes); + var buffer = %SerializeWasmModule(module); + module = %DeserializeWasmModule(buffer, wire_bytes); + var instance = new WebAssembly.Instance(module); + + assertEquals(null, instance.exports.main()); +})(); + +(function testAnyRefIsNull() { + const builder = new WasmModuleBuilder(); + builder.addFunction('main', kSig_i_r) + .addBody([kExprGetLocal, 0, kExprRefIsNull]) + .exportFunc(); + + var wire_bytes = builder.toBuffer(); + var module = new WebAssembly.Module(wire_bytes); + var buffer = %SerializeWasmModule(module); + module = %DeserializeWasmModule(buffer, wire_bytes); + var instance = new WebAssembly.Instance(module); + + assertEquals(0, instance.exports.main({'hello' : 'world'})); + assertEquals(0, instance.exports.main(1234)); + assertEquals(0, instance.exports.main(0)); + assertEquals(0, instance.exports.main(123.4)); + assertEquals(0, instance.exports.main(undefined)); + assertEquals(1, instance.exports.main(null)); + assertEquals(0, instance.exports.main(print)); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js index e69de29bb2..c7eb033d95 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-778917.js @@ -0,0 +1,19 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --wasm-interpret-all + +load("test/mjsunit/wasm/wasm-module-builder.js"); + + +const builder = new WasmModuleBuilder(); + +const index = builder.addFunction("huge_frame", kSig_v_v) + .addBody([kExprCallFunction, 0]) + .addLocals({f64_count: 49555}).exportFunc().index; +// We assume above that the function we added has index 0. +assertEquals(0, index); + +const module = builder.instantiate(); +assertThrows(module.exports.huge_frame, RangeError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js index e69de29bb2..008ab16159 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-782280.js @@ -0,0 +1,32 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_iii) + .addBodyWithEnd([ + kExprI32Const, 0, // 0 + kExprI32Const, 0, // 0, 0 + kExprI32Add, // 0 + 0 -> 0 + kExprI32Const, 0, // 0, 0 + kExprI32Const, 0, // 0, 0, 0 + kExprI32Add, // 0, 0 + 0 -> 0 + kExprDrop, // 0 + kExprDrop, // - + kExprI32Const, 0, // 0 + kExprI32Const, 0, // 0, 0 + kExprI32Add, // 0 + 0 -> 0 + kExprI32Const, 0, // 0, 0 + kExprI32Const, 1, // 0, 0, 1 + kExprI32Add, // 0, 0 + 1 -> 1 + kExprBlock, kWasmStmt, // 0, 1 + kExprBr, 0, // 0, 1 + kExprEnd, // 0, 1 + kExprI32Add, // 0 + 1 -> 1 + kExprEnd + ]) + .exportFunc(); +var module = builder.instantiate(); +assertEquals(1, module.exports.test()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js index e69de29bb2..acf4539aee 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-784050.js @@ -0,0 +1,24 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_v_v) + .addBodyWithEnd([ + kExprI32Const, 0x0, // const 0 + kExprI32Const, 0x0, // const 0 + kExprBrIf, 0x00, // br depth=0 + kExprLoop, 0x7f, // loop i32 + kExprBlock, 0x7f, // block i32 + kExprI32Const, 0x0, // const 0 + kExprBr, 0x00, // br depth=0 + kExprEnd, // end + kExprBr, 0x00, // br depth=0 + kExprEnd, // end + kExprUnreachable, // unreachable + kExprEnd, // end + ]) + .exportFunc(); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js index e69de29bb2..48f8b902f0 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-7914.js @@ -0,0 +1,17 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32, false); +builder.addFunction('main', kSig_i_v) + .addBody([ + ...wasmI32Const(10000), // i32.const 10000 + kExprMemoryGrow, 0, // grow_memory --> -1 + kExprI32Popcnt, // i32.popcnt --> 32 + ]) + .exportFunc(); +const instance = builder.instantiate(); +assertEquals(32, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js index e69de29bb2..73b47bdd78 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-791810.js @@ -0,0 +1,20 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_i) + .addBody([ + kExprGetLocal, 0x00, // get_local 0 + kExprBlock, kWasmStmt, // block + kExprBr, 0x00, // br depth=0 + kExprEnd, // end + kExprBlock, kWasmStmt, // block + kExprBr, 0x00, // br depth=0 + kExprEnd, // end + kExprBr, 0x00, // br depth=0 + ]) + .exportFunc(); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js index e69de29bb2..657b2c0013 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-793551.js @@ -0,0 +1,19 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_i) + .addBody([ + // body: + kExprGetLocal, 0, // get_local 0 + kExprGetLocal, 0, // get_local 0 + kExprLoop, kWasmStmt, // loop + kExprBr, 0, // br depth=0 + kExprEnd, // end + kExprUnreachable, // unreachable + ]) + .exportFunc(); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js index e69de29bb2..1470de4fc6 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-797846.js @@ -0,0 +1,13 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// We need a module with one valid function. +const builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_v_v).addBody([]); + +const buffer = builder.toBuffer(); +assertPromiseResult( + WebAssembly.compile(buffer), _ => Realm.createAllowCrossRealmAccess()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js index e69de29bb2..76afc88d8f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-800756.js @@ -0,0 +1,14 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32); +builder.addFunction(undefined, kSig_i_iii).addBody([ + kExprI32Const, 0, // i32.const 0 + kExprI32LoadMem8S, 0, 0, // i32.load8_s offset=0 align=0 + kExprI32Eqz, // i32.eqz +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js index e69de29bb2..105fd4bc38 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801785.js @@ -0,0 +1,21 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// Flags: --print-wasm-code + +const builder = new WasmModuleBuilder(); +builder.addMemory(8, 16); +builder.addFunction(undefined, kSig_i_i).addBody([ + // wasm to wasm call. + kExprGetLocal, 0, kExprCallFunction, 0x1 +]); +builder.addFunction(undefined, kSig_i_i).addBody([ + // load from to create trap code. + kExprGetLocal, 0, kExprI32LoadMem, 0, + // unreachable to create a runtime call. + kExprUnreachable +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js index e69de29bb2..0e0f5c249c 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-801850.js @@ -0,0 +1,10 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +let module = new WebAssembly.Module(builder.toBuffer()); +var worker = new Worker('onmessage = function() {};', {type: 'string'}); +worker.postMessage(module) diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js index e69de29bb2..aeaf850365 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-802244.js @@ -0,0 +1,21 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction(undefined, kSig_v_iii).addBody([ + kExprI32Const, 0x41, // i32.const 0x41 + kExprLoop, 0x7c, // loop f64 + kExprGetLocal, 0x00, // get_local 0 + kExprGetLocal, 0x01, // get_local 1 + kExprBrIf, 0x01, // br_if depth=1 + kExprGetLocal, 0x00, // get_local 0 + kExprI32Rol, // i32.rol + kExprBrIf, 0x00, // br_if depth=0 + kExprUnreachable, // unreachable + kExprEnd, // end + kExprUnreachable, // unreachable +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js index e69de29bb2..26b1413c3b 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803427.js @@ -0,0 +1,12 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +let module = new WebAssembly.Module(builder.toBuffer()); +var worker = new Worker('onmessage = function() {};', {type: 'string'}); +worker.postMessage(module) diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js index e69de29bb2..17325538f1 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-803788.js @@ -0,0 +1,26 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +let q_table = builder.addImportedTable("q", "table") +let q_base = builder.addImportedGlobal("q", "base", kWasmI32); +let q_fun = builder.addImport("q", "fun", kSig_v_v); +builder.addType(kSig_i_ii); +builder.addElementSegment(q_base, true, [ q_fun ]) +let module = new WebAssembly.Module(builder.toBuffer()); +let table = new WebAssembly.Table({ + element: "anyfunc", + initial: 10, +}); +let instance = new WebAssembly.Instance(module, { + q: { + base: 0, + table: table, + fun: () => (0) + } +}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js index e69de29bb2..78ee6bd1d2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8059.js @@ -0,0 +1,41 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-wasm-disable-structured-cloning + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function TestPostModule() { + let builder = new WasmModuleBuilder(); + builder.addFunction("add", kSig_i_ii) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .exportFunc(); + + let module = builder.toModule(); + + let workerScript = ` + onmessage = function(module) { + try { + let instance = new WebAssembly.Instance(module); + let result = instance.exports.add(40, 2); + postMessage(result); + } catch(e) { + postMessage('ERROR: ' + e); + } + } + `; + + let realm = Realm.create(); + Realm.shared = { m:module, s:workerScript }; + + let realmScript = ` + let worker = new Worker(Realm.shared.s, {type: 'string'}); + worker.postMessage(Realm.shared.m); + let message = worker.getMessage(); + worker.terminate(); + message; + `; + let message = Realm.eval(realm, realmScript); + assertEquals(42, message); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js index e69de29bb2..a54b88a5e1 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808012.js @@ -0,0 +1,13 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('test', kSig_i_i).addBody([kExprUnreachable]); +let module = new WebAssembly.Module(builder.toBuffer()); +var worker = new Worker('onmessage = function() {};', {type: 'string'}); +worker.postMessage(module); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js index e69de29bb2..57920de09d 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808848.js @@ -0,0 +1,66 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// The number of locals must be greater than the constant defined here: +// https://cs.chromium.org/chromium/src/v8/src/compiler/x64/code-generator-x64.cc?l=3146 +const kNumLocals = 128; + +function varuint32(val) { + let bytes = []; + for (let i = 0; i < 4; ++i) { + bytes.push(0x80 | ((val >> (7 * i)) & 0x7f)); + } + bytes.push((val >> (7 * 4)) & 0x7f); + return bytes; +} + +// Generate a function that calls the "get" import `kNumLocals` times, and +// stores each result in a local, then calls the "call" import `kNumLocals` +// times with the stored local values. +// +// The intention is to create a function that has a large stack frame. +let body = []; + +for (let i = 0; i < kNumLocals; ++i) { + body.push(kExprCallFunction, 0, kExprSetLocal, ...varuint32(i)); +} + +for (let i = 0; i < kNumLocals; ++i) { + body.push(kExprGetLocal, ...varuint32(i), kExprCallFunction, 1); +} + +let builder = new WasmModuleBuilder(); +builder.addImport('mod', 'get', kSig_i_v); +builder.addImport('mod', 'call', kSig_v_i); +builder. + addFunction('main', kSig_v_v). + addLocals({i32_count: kNumLocals}). + addBody(body). + exportAs('main'); +let m1_bytes = builder.toBuffer(); +let m1 = new WebAssembly.Module(m1_bytes); + +// Serialize the module and postMessage it to another thread. +let serialized_m1 = %SerializeWasmModule(m1); + +let worker_onmessage = function(msg) { + let {serialized_m1, m1_bytes} = msg; + + let m1_clone = %DeserializeWasmModule(serialized_m1, m1_bytes); + let imports = {mod: {get: () => 3, call: () => {}}}; + let i2 = new WebAssembly.Instance(m1_clone, imports); + i2.exports.main(); + postMessage('done'); +} +let workerScript = "onmessage = " + worker_onmessage.toString(); + +let worker = new Worker(workerScript, {type: 'string'}); +worker.postMessage({serialized_m1, m1_bytes}); + +// Wait for worker to finish. +print(worker.getMessage()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js index e69de29bb2..d78c07f36c 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-808980.js @@ -0,0 +1,27 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --throws + +load('test/mjsunit/wasm/wasm-module-builder.js'); +let kTableSize = 3; + +var builder = new WasmModuleBuilder(); +var sig_index1 = builder.addType(kSig_i_v); +builder.addFunction('main', kSig_i_ii).addBody([ + kExprGetLocal, + 0, + kExprCallIndirect, + sig_index1, + kTableZero +]).exportAs('main'); +builder.setTableBounds(kTableSize, kTableSize); +var m1_bytes = builder.toBuffer(); +var m1 = new WebAssembly.Module(m1_bytes); + +var serialized_m1 = %SerializeWasmModule(m1); +var m1_clone = %DeserializeWasmModule(serialized_m1, m1_bytes); +var i1 = new WebAssembly.Instance(m1_clone); + +i1.exports.main(123123); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js index e69de29bb2..dc78366ed8 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8094.js @@ -0,0 +1,29 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// Instantiate a throwing module. +var builder = new WasmModuleBuilder(); +builder.addException(kSig_v_v); +builder.addFunction("propel", kSig_v_v) + .addBody([kExprThrow, 0]) + .exportFunc(); +var instance = builder.instantiate(); + +// Catch the exception. +var exception; +try { + instance.exports.propel(); +} catch (e) { + exception = e; +} + +// Check that the exception is an instance of the correct error function and +// that no extraneous properties exist. Setting such properties could be +// observable by JavaScript and could break compatibility. +assertInstanceof(exception, WebAssembly.RuntimeError); +assertArrayEquals(["stack", "message"], Object.getOwnPropertyNames(exception)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js index e69de29bb2..7d21932ec4 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8095.js @@ -0,0 +1,24 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// Prepare a special error object to throw. +var error = new Error("my error"); +error.__proto__ = new Proxy(new Error(), { + has(target, property, receiver) { + assertUnreachable(); + } +}); + +// Throw it through a WebAssembly module. +var builder = new WasmModuleBuilder(); +builder.addImport('mod', 'fun', kSig_v_v); +builder.addFunction("funnel", kSig_v_v) + .addBody([kExprCallFunction, 0]) + .exportFunc(); +var instance = builder.instantiate({ mod: {fun: function() { throw error }}}); +assertThrows(instance.exports.funnel, Error); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js index e69de29bb2..ba49987de5 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-812005.js @@ -0,0 +1,15 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction(undefined, kSig_d_v).addBody([ + ...wasmF64Const(0), // f64.const 0 + ...wasmF64Const(0), // f64.const 0 + ...wasmI32Const(0), // i32.const 0 + kExprBrIf, 0x00, // br_if depth=0 + kExprF64Add // f64.add +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js index e69de29bb2..5b3281a150 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-817380.js @@ -0,0 +1,24 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder1 = new WasmModuleBuilder(); +builder1.addFunction('mul', kSig_i_ii) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Mul]) + .exportFunc(); +const mul = builder1.instantiate().exports.mul; +const table = new WebAssembly.Table({ + element: 'anyfunc', + initial: 10, +}); +const builder2 = new WasmModuleBuilder(); +const mul_import = builder2.addImport('q', 'wasm_mul', kSig_i_ii); +builder2.addImportedTable('q', 'table'); +const glob_import = builder2.addImportedGlobal('q', 'glob', kWasmI32); +builder2.addElementSegment(glob_import, true, [mul_import]); +builder2.instantiate( + {q: {glob: 0, js_div: i => i, wasm_mul: mul, table: table}}); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js index e69de29bb2..a32928ab0c 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-819869.js @@ -0,0 +1,11 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addFunction(undefined, kSig_i_i) + .addLocals({i32_count: 0xffffffff}) + .addBody([]); +assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js index e69de29bb2..214e71819f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-820802.js @@ -0,0 +1,20 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32); +builder.addGlobal(kWasmI32, 0); +const sig0 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +builder.addFunction(undefined, sig0).addBody([ + kExprI32Const, 1, // i32.const 1 + kExprI32Const, 0, // i32.const 0 + kExprI32Const, 3, // i32.const 3 + kExprI32GeU, // i32.ge_u + kExprI32Rol, // i32.rol +]); +builder.addExport('main', 0); +const instance = builder.instantiate(); +assertEquals(1, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js index e69de29bb2..9d712e6ddb 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-824681.js @@ -0,0 +1,19 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let chain = Promise.resolve(); +const builder = new WasmModuleBuilder(); +for (let i = 0; i < 50; ++i) { + builder.addFunction('fun' + i, kSig_i_v) + .addBody([...wasmI32Const(i)]) + .exportFunc(); +} +const buffer = builder.toBuffer(); +for (let i = 0; i < 100; ++i) { + chain = chain.then(() => WebAssembly.instantiate(buffer)); +} +chain.then(({module, instance}) => instance.exports.fun1155()) + .then(res => print('Result of executing fun1155: ' + res)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js index e69de29bb2..9a986d0839 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087a.js @@ -0,0 +1,9 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +PAGES = 10; +memory = new WebAssembly.Memory({initial: PAGES}); +buffer = memory.buffer; +memory.grow(0); +WebAssembly.validate(buffer); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js index e69de29bb2..266fd53219 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-825087b.js @@ -0,0 +1,10 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +PAGES = 10; +memory = new WebAssembly.Memory({initial: PAGES}); +buffer = memory.buffer; +buffer = new Uint8Array(buffer); +memory.grow(0); +WebAssembly.validate(buffer); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js index e69de29bb2..8576de2e79 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-827806.js @@ -0,0 +1,21 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +try { + (function () { + let m = new WasmModuleBuilder(); + m.addFunction("sub", kSig_i_ii) + m.instantiate(); + })(); +} catch (e) { + console.info("caught exception"); + console.info(e); +} +for (let i = 0; i < 150; i++) { + var m = new WasmModuleBuilder(); + m.addMemory(2); + m.instantiate(); +} diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js index e69de29bb2..2818ad350b 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-831463.js @@ -0,0 +1,21 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-interpret-all + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +const builder = new WasmModuleBuilder(); +const sig = builder.addType(kSig_i_i); +builder.addFunction('call', kSig_i_v) + .addBody([ + kExprI32Const, 0, kExprI32Const, 0, kExprCallIndirect, sig, kTableZero + ]) + .exportAs('call'); +builder.addImportedTable('imp', 'table'); +const table = new WebAssembly.Table({element: 'anyfunc', initial: 1}); +const instance = builder.instantiate({imp: {table: table}}); +assertThrows( + () => instance.exports.call(), WebAssembly.RuntimeError, + /function signature mismatch/); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js index e69de29bb2..145f415221 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834619.js @@ -0,0 +1,48 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function ExportedFunctionsImportedOrder() { + print(arguments.callee.name); + + let i1 = (() => { + let builder = new WasmModuleBuilder(); + builder.addFunction("f1", kSig_i_v) + .addBody( + [kExprI32Const, 1]) + .exportFunc(); + builder.addFunction("f2", kSig_i_v) + .addBody( + [kExprI32Const, 2]) + .exportFunc(); + return builder.instantiate(); + })(); + + let i2 = (() => { + let builder = new WasmModuleBuilder(); + builder.addImport("q", "f2", kSig_i_v); + builder.addImport("q", "f1", kSig_i_v); + builder.addFunction("main", kSig_i_i) + .addBody([ + kExprGetLocal, 0, + kExprCallIndirect, 0, kTableZero + ]) + .exportFunc(); + builder.addElementSegment(0, false, [0, 1, 1, 0]); + + return builder.instantiate({q: {f2: i1.exports.f2, f1: i1.exports.f1}}); + })(); + + print("--->calling 0"); + assertEquals(2, i2.exports.main(0)); + print("--->calling 1"); + assertEquals(1, i2.exports.main(1)); + print("--->calling 2"); + assertEquals(1, i2.exports.main(2)); + print("--->calling 3"); + assertEquals(2, i2.exports.main(3)); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js index e69de29bb2..45af23cde2 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834624.js @@ -0,0 +1,29 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-interpret-all + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +let instance; +(function DoTest() { + function call_main() { + instance.exports.main(); + } + let module = new WasmModuleBuilder(); + module.addImport('mod', 'func', kSig_v_i); + module.addFunction('main', kSig_v_i) + .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .exportFunc(); + instance = module.instantiate({ + mod: { + func: call_main + } + }); + try { + instance.exports.main(); + } catch (e) { + // ignore + } +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js index e69de29bb2..ad51b2a400 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-834693.js @@ -0,0 +1,19 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// flags: --wasm-lazy-compilation + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +var module = new WasmModuleBuilder(); +module.addMemory(); +module.addFunction("main", kSig_v_v) + .addBody([ + kExprI32Const, 20, + kExprI32Const, 29, + kExprMemoryGrow, kMemoryZero, + kExprI32StoreMem, 0, 0xFF, 0xFF, 0x7A]) + .exportAs("main"); +var instance = module.instantiate(); +assertTraps(kTrapMemOutOfBounds, instance.exports.main); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js index e69de29bb2..5ac58042e4 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-836141.js @@ -0,0 +1,19 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32); +builder.addFunction("test", kSig_i_v).addBody([ + kExprI32Const, 12, // i32.const 0 +]); + +let module = new WebAssembly.Module(builder.toBuffer()); +module.then = () => { + // Use setTimeout to get out of the promise chain. + setTimeout(assertUnreachable); +}; + +WebAssembly.instantiate(module); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js index e69de29bb2..ef1d3cfaf6 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-837417.js @@ -0,0 +1,17 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32); +builder.addFunction("test", kSig_i_v).addBody([ + kExprI32Const, 12, // i32.const 12 +]); + +WebAssembly.Module.prototype.then = resolve => { + assertUnreachable(); +}; + +WebAssembly.instantiate(builder.toBuffer()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js index e69de29bb2..ad1cf9f64f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-840757.js @@ -0,0 +1,20 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// Also enable predictable mode. Otherwise, concurrent recompilation will be +// enabled, and the code generator will not try to print the InliningStack +// (see CodeGenerator::AssembleSourcePosition). +// These preconditions make this test quite fragile, but it's the only way +// currently to reproduce the crash. +// Flags: --code-comments --predictable --print-wasm-code + +const builder = new WasmModuleBuilder(); +// Add a call instruction, because the segfault happens when processing source +// positions. +builder.addFunction('foo', kSig_v_v).addBody([]); +builder.addFunction('test', kSig_v_v).addBody([kExprCallFunction, 0]); + +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js index e69de29bb2..d54507cc59 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-842501.js @@ -0,0 +1,34 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-wasm-trap-handler + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +(function() { + const builder = new WasmModuleBuilder(); + builder.addMemory(16, 32); + // Generate function 1 (out of 1). + sig1 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); + builder.addFunction(undefined, sig1) + .addBodyWithEnd([ + // signature: i_iii + // body: + kExprI32Const, 0xe1, 0xc8, 0xd5, 0x01, + kExprI32Const, 0xe2, 0xe4, 0x00, + kExprI32Sub, + kExprF32Const, 0x00, 0x00, 0x00, 0x00, + kExprF32Const, 0xc9, 0xc9, 0xc9, 0x00, + kExprF32Eq, + kExprI32LoadMem, 0x01, 0xef, 0xec, 0x95, 0x93, 0x07, + kExprI32Add, + kExprIf, kWasmStmt, // @30 + kExprEnd, // @32 + kExprI32Const, 0xc9, 0x93, 0xdf, 0xcc, 0x7c, + kExprEnd, // @39 + ]); + builder.addExport('main', 0); + const instance = builder.instantiate(); + assertTraps(kTrapMemOutOfBounds, _ => instance.exports.main(1, 2, 3)); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js index e69de29bb2..ca22299254 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-843563.js @@ -0,0 +1,19 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +sig1 = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +const imp_idx = builder.addImport('q', 'imp', kSig_i_i); +builder.addExport('exp', imp_idx); +const module = builder.toModule(); + +function bad(a, b, c, d, e, f, g, h) { + print(JSON.stringify([a, b, c, d, e, f, g, h])); +} +const instance1 = new WebAssembly.Instance(module, {q: {imp: bad}}); +const instance2 = new WebAssembly.Instance(module, {q: {imp: i => i}}); + +print(instance1.exports.exp(5)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js index e69de29bb2..0488723e4f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8505.js @@ -0,0 +1,203 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --wasm-math-intrinsics --validate-asm --allow-natives-syntax + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +function verbose(args) { + // print(...args); +} + +//============================================= +// Global count of failures +//============================================= +let numFailures = 0; + +function reportFailure(name, vals, m, w) { + print(" error: " + name + "(" + vals + ") == " + w + ", expected " + m); + numFailures++; +} + +let global_imports = {Math: Math}; + +let inputs = [ + 1 / 0, + -1 / 0, + 0 / 0, + -2.70497e+38, + -1.4698e+37, + -1.22813e+35, + -1.34584e+34, + -1.0079e+32, + -6.49364e+26, + -3.06077e+25, + -1.46821e+25, + -1.17658e+23, + -1.9617e+22, + -2.7357e+20, + -9223372036854775808.0, // INT64_MIN + -1.48708e+13, + -1.89633e+12, + -4.66622e+11, + -2.22581e+11, + -1.45381e+10, + -2147483904.0, // First float32 after INT32_MIN + -2147483648.0, // INT32_MIN + -2147483520.0, // Last float32 before INT32_MIN + -1.3956e+09, + -1.32951e+09, + -1.30721e+09, + -1.19756e+09, + -9.26822e+08, + -5.09256e+07, + -964300.0, + -192446.0, + -28455.0, + -27194.0, + -20575.0, + -17069.0, + -9167.0, + -960.178, + -113.0, + -62.0, + -15.0, + -7.0, + -1.0, + -0.0256635, + -4.60374e-07, + -3.63759e-10, + -4.30175e-14, + -5.27385e-15, + -1.5707963267948966, + -1.48084e-15, + -2.220446049250313e-16, + -1.05755e-19, + -3.2995e-21, + -1.67354e-23, + -1.11885e-23, + -1.78506e-30, + -1.43718e-34, + -1.27126e-38, + -0.0, + 3e-88, + -2e66, + 0.0, + 2e66, + 1.17549e-38, + 1.56657e-37, + 4.08512e-29, + 6.25073e-22, + 4.1723e-13, + 1.44343e-09, + 1.5707963267948966, + 5.27004e-08, + 9.48298e-08, + 5.57888e-07, + 4.89988e-05, + 0.244326, + 1.0, + 12.4895, + 19.0, + 47.0, + 106.0, + 538.324, + 564.536, + 819.124, + 7048.0, + 12611.0, + 19878.0, + 20309.0, + 797056.0, + 1.77219e+09, + 2147483648.0, // INT32_MAX + 1 + 4294967296.0, // UINT32_MAX + 1 + 1.51116e+11, + 4.18193e+13, + 3.59167e+16, + 9223372036854775808.0, // INT64_MAX + 1 + 18446744073709551616.0, // UINT64_MAX + 1 + 3.38211e+19, + 2.67488e+20, + 1.78831e+21, + 9.20914e+21, + 8.35654e+23, + 1.4495e+24, + 5.94015e+25, + 4.43608e+30, + 2.44502e+33, + 1.38178e+37, + 1.71306e+37, + 3.31899e+38, + 3.40282e+38, +]; + +function assertBinop(name, math_func, wasm_func) { + let inputs2 = [ 1, 0.5, -1, -0.5, 0, -0, 1/0, -1/0, 0/0 ]; + for (val of inputs) { + verbose(" ", val); + for (val2 of inputs2) { + verbose(" ", val2); + let m = math_func(val, val2); + let w = wasm_func(val, val2); + if (!deepEquals(m, w)) reportFailure(name, [val, val2], m, w); + m = math_func(val2, val); + w = wasm_func(val2, val); + if (!deepEquals(m, w)) reportFailure(name, [val2, val], m, w); + } + } +} + +let stdlib = this; +function Module_exp(stdlib) { + "use asm"; + + var Stdlib = stdlib.Math.exp; + + function NAME(a, b) { + a = +a; + b = +b; + return +Stdlib(a, b); + } + + return {exp: exp}; +} + +function wasmBinop(name, sig) { + var builder = new WasmModuleBuilder(); + + var sig_index = builder.addType(sig); + builder.addImport('Math', name, sig_index); + builder.addFunction('main', sig_index) + .addBody([ + kExprGetLocal, 0, // -- + kExprGetLocal, 1, // -- + kExprCallFunction, 0 + ]) // -- + .exportAs('main'); + + return builder.instantiate(global_imports).exports.main; +} + +function asmBinop(name) { + let instance = Module_exp(stdlib); + assertTrue(%IsAsmWasmCode(Module_exp)); + + let asm_func = instance[name]; + if (typeof asm_func != "function") throw "asm[" + full_name + "] not found"; + return asm_func; +} + +(function TestF64() { + let name = 'exp'; + let math_func = Math[name]; + + let wasm_func = wasmBinop(name, kSig_d_dd); + assertBinop("(f64)" + name, math_func, wasm_func); + + let asm_func = asmBinop(name); + assertBinop("(f64)" + name, math_func, asm_func); +})(); + +assertEquals(0, numFailures); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js index e69de29bb2..da5f44925a 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-8533.js @@ -0,0 +1,84 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-shared-engine --no-wasm-disable-structured-cloning --allow-natives-syntax --experimental-wasm-threads + +load('test/mjsunit/wasm/wasm-module-builder.js'); + + +// In this test we start a worker which enters wasm and stays there in a loop. +// The main thread stays in JS and checks that its thread-in-wasm flag is not +// set. The main thread calls setTimeout after every check to give the worker a +// chance to be scheculed. +const sync_address = 12; +(function TestPostModule() { + let builder = new WasmModuleBuilder(); + let sig_index = builder.addType(kSig_v_v); + let import_id = builder.addImport('m', 'func', sig_index); + builder.addFunction('wait', kSig_v_v) + .addBody([ + // Calling the imported function sets the thread-in-wasm flag of the + // main thread. + kExprCallFunction, import_id, // -- + kExprLoop, kWasmStmt, // -- + kExprI32Const, sync_address, // -- + kExprI32LoadMem, 0, 0, // -- + kExprI32Eqz, + kExprBrIf, 0, // -- + kExprEnd, + ]) + .exportFunc(); + + builder.addFunction('signal', kSig_v_v) + .addBody([ + kExprI32Const, sync_address, // -- + kExprI32Const, 1, // -- + kExprI32StoreMem, 0, 0, // -- + ]) + .exportFunc(); + builder.addImportedMemory("m", "imported_mem", 0, 1, "shared"); + + let module = builder.toModule(); + let memory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true}); + + let workerScript = ` + onmessage = function(msg) { + try { + let worker_instance = new WebAssembly.Instance(msg.module, + {m: {imported_mem: msg.memory, + func: _ => 5}}); + postMessage("start running"); + worker_instance.exports.wait(); + postMessage("finished"); + } catch(e) { + postMessage('ERROR: ' + e); + } + } + `; + + let worker = new Worker(workerScript, {type: 'string'}); + worker.postMessage({module: module, memory: memory}); + + let main_instance = new WebAssembly.Instance( + module, {m: {imported_mem: memory, func: _ => 7}}); + + let counter = 0; + function CheckThreadNotInWasm() { + // We check the thread-in-wasm flag many times and reschedule ourselves in + // between to increase the chance that we read the flag set by the worker. + assertFalse(%IsThreadInWasm()); + counter++; + if (counter < 100) { + setTimeout(CheckThreadNotInWasm, 0); + } else { + main_instance.exports.signal(sync_address); + assertEquals('finished', worker.getMessage()); + worker.terminate(); + } + } + + assertFalse(%IsThreadInWasm()); + assertEquals('start running', worker.getMessage()); + CheckThreadNotInWasm(); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js index e69de29bb2..b0356a873f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854011.js @@ -0,0 +1,46 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('main', kSig_d_d) + .addBody([ + // Call with param 0 (converted to i64), to fill the stack with non-zero + // values. + kExprGetLocal, 0, kExprI64SConvertF64, // arg 0 + kExprGetLocal, 0, kExprI64SConvertF64, // arg 1 + kExprGetLocal, 0, kExprI64SConvertF64, // arg 2 + kExprGetLocal, 0, kExprI64SConvertF64, // arg 3 + kExprGetLocal, 0, kExprI64SConvertF64, // arg 4 + kExprGetLocal, 0, kExprI64SConvertF64, // arg 5 + kExprGetLocal, 0, kExprI64SConvertF64, // arg 6 + kExprGetLocal, 0, kExprI64SConvertF64, // arg 7 + kExprCallFunction, 1, // call #1 + // Now call with 0 constants. + // The bug was that they were written out as i32 values, thus the upper 32 + // bit were the previous values on that stack memory. + kExprI64Const, 0, // i64.const 0 [0] + kExprI64Const, 0, // i64.const 0 [1] + kExprI64Const, 0, // i64.const 0 [2] + kExprI64Const, 0, // i64.const 0 [3] + kExprI64Const, 0, // i64.const 0 [4] + kExprI64Const, 0, // i64.const 0 [5] + kExprI64Const, 0, // i64.const 0 [6] + kExprI64Const, 0, // i64.const 0 [7] + kExprCallFunction, 1, // call #1 + // Return the sum of the two returned values. + kExprF64Add + ]) + .exportFunc(); +builder.addFunction(undefined, makeSig(new Array(8).fill(kWasmI64), [kWasmF64])) + .addBody([ + kExprGetLocal, 7, // get_local 7 (last parameter) + kExprF64SConvertI64, // f64.convert_s/i64 + ]); +const instance = builder.instantiate(); +const big_num_1 = 2 ** 48; +const big_num_2 = 2 ** 56 / 3; +assertEquals(big_num_1, instance.exports.main(big_num_1)); +assertEquals(big_num_2, instance.exports.main(big_num_2)); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js index e69de29bb2..d6c4829acd 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-854050.js @@ -0,0 +1,27 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], [])) + .addLocals({i32_count: 7}) + .addBody([ + kExprGetLocal, 0, // get_local + kExprI32Const, 0, // i32.const 0 + kExprIf, kWasmStmt, // if + kExprUnreachable, // unreachable + kExprEnd, // end if + kExprGetLocal, 4, // get_local + kExprTeeLocal, 8, // tee_local + kExprBrIf, 0, // br_if depth=0 + kExprTeeLocal, 7, // tee_local + kExprTeeLocal, 0, // tee_local + kExprTeeLocal, 2, // tee_local + kExprTeeLocal, 8, // tee_local + kExprDrop, // drop + kExprLoop, kWasmStmt, // loop + kExprEnd, // end loop + ]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js index e69de29bb2..19e3bfcfb8 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-864509.js @@ -0,0 +1,61 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --liftoff --no-wasm-tier-up --no-future --wasm-tier-mask-for-testing=2 + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(1, 1); +// First function is Liftoff. The first parameter is used as memory offset. +builder.addFunction(undefined, kSig_v_i).addBody([ + kExprGetLocal, 0, // get_local 0 + kExprI32Const, 0, // i32.const 0 + kExprI32StoreMem, 0, 0, // i32.store offset=0 +]); +// Second function is Turbofan. It loads the sixth parameter from the stack +// into a register for the first argument. Even though it's a 32-bit value, it +// is loaded as 64-bit value on x64. +builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), [])) + .addBody([ + kExprGetLocal, 5, // get_local 5 + kExprCallFunction, 0 // call 0 + ]); +// The third function is Liftoff again. A value is spilled on the stack as i32, +// then used as a call argument, passed via the stack. The full 64-bit are +// copied on the stack, even though just 32-bit were written before. Hence, the +// stack slot is not zero-extended. +const gen_i32_code = [ + kExprTeeLocal, 0, // tee_local 0 + kExprGetLocal, 0, // get_local 0 + kExprI32Const, 1, // i32.const 1 + kExprI32Add // i32.add --> 2nd param +]; +builder.addFunction(undefined, kSig_v_v).addLocals({i32_count: 1}).addBody([ + // Generate six values on the stack, then six more to force the other six on + // the stack. + ...wasmI32Const(0), // i32.const 0 + ...wasmI32Const(1), // i32.const 1 + kExprI32Add, // i32.add --> 1st param + ...gen_i32_code, // --> 2nd param + ...gen_i32_code, // --> 3rd param + ...gen_i32_code, // --> 4th param + ...gen_i32_code, // --> 5th param + ...gen_i32_code, // --> 6th param + ...gen_i32_code, // --> garbage + ...gen_i32_code, // --> garbage + ...gen_i32_code, // --> garbage + ...gen_i32_code, // --> garbage + ...gen_i32_code, // --> garbage + ...gen_i32_code, // --> garbage + kExprDrop, // drop garbage + kExprDrop, // drop garbage + kExprDrop, // drop garbage + kExprDrop, // drop garbage + kExprDrop, // drop garbage + kExprDrop, // drop garbage + kExprCallFunction, 1 // call 1 +]).exportAs('three'); +const instance = builder.instantiate(); +instance.exports.three(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js index e69de29bb2..cc8bc5cc3e 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-875556.js @@ -0,0 +1,18 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// Flags: --expose-wasm --experimental-wasm-mv + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +(function() { + const builder = new WasmModuleBuilder(); + // Generate function 1 (out of 2). + sig1 = makeSig([kWasmI32], []); + builder.addFunction("main", sig1).addBodyWithEnd([ + // signature: v_i + // body: + kExprBlock, + ]); + assertThrows(function() { builder.instantiate(); }, WebAssembly.CompileError); +})(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js index e69de29bb2..f40388fcb4 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894307.js @@ -0,0 +1,15 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +const sig = makeSig([kWasmI32, kWasmI64, kWasmI64], [kWasmI64]); +builder.addFunction(undefined, sig) + .addBody([ + kExprGetLocal, 2, + kExprGetLocal, 1, + kExprI64Shl, +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js index e69de29bb2..02be0088cf 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-894374.js @@ -0,0 +1,19 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addMemory(16, 32, false); +const sig = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +builder.addFunction(undefined, sig) + .addBodyWithEnd([ + kExprMemorySize, 0, + kExprI32Const, 0, + kExprI64Const, 0, + kExprI64StoreMem8, 0, 0, + kExprEnd, + ]); +builder.addExport('main', 0); +builder.instantiate(); // shouldn't crash diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js index e69de29bb2..b795425b1f 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-910824.js @@ -0,0 +1,36 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addGlobal(kWasmI32, 1); +builder.addGlobal(kWasmF32, 1); +builder.addType(makeSig([kWasmI32, kWasmF32, kWasmF32, kWasmF64], [kWasmI32])); +builder.addFunction(undefined, 0 /* sig */) + .addLocals({i32_count: 504}) + .addBody([ +kExprGetGlobal, 0x00, +kExprSetLocal, 0x04, +kExprGetLocal, 0x04, +kExprI32Const, 0x01, +kExprI32Sub, +kExprGetGlobal, 0x00, +kExprI32Const, 0x00, +kExprI32Eqz, +kExprGetGlobal, 0x00, +kExprI32Const, 0x01, +kExprI32Const, 0x01, +kExprI32Sub, +kExprGetGlobal, 0x00, +kExprI32Const, 0x00, +kExprI32Eqz, +kExprGetGlobal, 0x00, +kExprI32Const, 0x00, +kExprI32Const, 0x01, +kExprI32Sub, +kExprGetGlobal, 0x01, +kExprUnreachable, +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js index e69de29bb2..e9d4026308 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-913804.js @@ -0,0 +1,16 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('main', kSig_v_v).addBody([ + kExprLoop, kWasmStmt, // loop + /**/ kExprBr, 0x01, // br depth=1 + /**/ kExprBlock, kWasmStmt, // block + /**/ /**/ kExprBr, 0x02, // br depth=2 + /**/ /**/ kExprEnd, // end [block] + /**/ kExprEnd // end [loop] +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js index e69de29bb2..30bb011364 100644 --- a/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-916869.js @@ -0,0 +1,13 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32])); +builder.addFunction('main', sig) + .addBody([kExprI32Const, 0x01, kExprI32SExtendI8]) + .exportFunc(); +const instance = builder.instantiate(); +assertEquals(1, instance.exports.main()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-922670.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-922670.js new file mode 100644 index 0000000000..2988eddf30 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-922670.js @@ -0,0 +1,31 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +const sig = builder.addType(makeSig([kWasmI32], [])); +builder.addFunction(undefined, sig) + .addLocals({i64_count: 1}) + .addBody([ + kExprLoop, kWasmI32, + kExprGetLocal, 1, + kExprI64Const, 1, + kExprLoop, kWasmI32, + kExprGetLocal, 0, + kExprI32Const, 1, + kExprI32Const, 1, + kExprIf, kWasmI32, + kExprI32Const, 1, + kExprElse, + kExprUnreachable, + kExprEnd, + kExprSelect, + kExprUnreachable, + kExprEnd, + kExprUnreachable, + kExprEnd, + kExprUnreachable +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-922933.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-922933.js new file mode 100644 index 0000000000..4d44509598 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-922933.js @@ -0,0 +1,51 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +const sig = builder.addType(makeSig([kWasmI64], [kWasmI64])); +builder.addFunction(undefined, sig) + .addLocals({i32_count: 14}).addLocals({i64_count: 17}).addLocals({f32_count: 14}) + .addBody([ + kExprBlock, kWasmStmt, + kExprBr, 0x00, + kExprEnd, + kExprBlock, kWasmStmt, + kExprI32Const, 0x00, + kExprSetLocal, 0x09, + kExprI32Const, 0x00, + kExprIf, kWasmStmt, + kExprBlock, kWasmStmt, + kExprI32Const, 0x00, + kExprSetLocal, 0x0a, + kExprBr, 0x00, + kExprEnd, + kExprBlock, kWasmStmt, + kExprBlock, kWasmStmt, + kExprGetLocal, 0x00, + kExprSetLocal, 0x12, + kExprBr, 0x00, + kExprEnd, + kExprGetLocal, 0x16, + kExprSetLocal, 0x0f, + kExprGetLocal, 0x0f, + kExprSetLocal, 0x17, + kExprGetLocal, 0x0f, + kExprSetLocal, 0x18, + kExprGetLocal, 0x17, + kExprGetLocal, 0x18, + kExprI64ShrS, + kExprSetLocal, 0x19, + kExprUnreachable, + kExprEnd, + kExprUnreachable, + kExprElse, + kExprUnreachable, + kExprEnd, + kExprUnreachable, + kExprEnd, + kExprUnreachable +]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-924843.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-924843.js new file mode 100644 index 0000000000..0549a769fb --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-924843.js @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32])); +builder.addFunction(undefined, sig) + .addBody([ + kExprGetLocal, 2, + kExprIf, kWasmStmt, + kExprBlock, kWasmStmt + ]); +builder.addExport('main', 0); +assertThrows(() => builder.instantiate(), WebAssembly.CompileError); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-924905.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-924905.js new file mode 100644 index 0000000000..9dbdf7e299 --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-924905.js @@ -0,0 +1,17 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +let builder = new WasmModuleBuilder(); +builder.addFunction("kaboom", kSig_i_v) + .addBody([ + kExprI32Const, 0, + kExprI32Const, 0, + kExprI32And, + kExprI32Const, 0, + kExprI32ShrU, + ]).exportFunc(); +let instance = builder.instantiate(); +assertEquals(0, instance.exports.kaboom()); diff --git a/implementation-contributed/v8/mjsunit/regress/wasm/regress-925671.js b/implementation-contributed/v8/mjsunit/regress/wasm/regress-925671.js new file mode 100644 index 0000000000..c6113c272e --- /dev/null +++ b/implementation-contributed/v8/mjsunit/regress/wasm/regress-925671.js @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-tier-mask-for-testing=1 + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +builder.addFunction('f0', kSig_v_v).addBody([]); +builder.addFunction('f1', kSig_v_v).addBody([]); +builder.instantiate(); diff --git a/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js b/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js index e69de29bb2..ea6f816f5d 100644 --- a/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js +++ b/implementation-contributed/v8/mjsunit/tools/compiler-trace-flags.js @@ -0,0 +1,35 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --trace-turbo --trace-turbo-graph +// Flags: --trace-turbo-cfg-file=test/mjsunit/tools/turbo.cfg +// Flags: --trace-turbo-path=test/mjsunit/tools + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// The idea behind this test is to make sure we do not crash when using the +// --trace-turbo flag given different sort of inputs, JS or WASM. + +(function testOptimizedJS() { + function add(a, b) { + return a + b; + } + + add(21, 21); + %OptimizeFunctionOnNextCall(add); + add(20, 22); +})(); + +(function testWASM() { + let builder = new WasmModuleBuilder(); + + builder.addFunction("add", kSig_i_ii) + .addBody([kExprGetLocal, 0, + kExprGetLocal, 1, + kExprI32Add]) + .exportFunc(); + + let instance = builder.instantiate(); + instance.exports.add(21, 21); +})(); diff --git a/implementation-contributed/v8/mjsunit/ubsan-fuzzerbugs.js b/implementation-contributed/v8/mjsunit/ubsan-fuzzerbugs.js new file mode 100644 index 0000000000..d2a21288ab --- /dev/null +++ b/implementation-contributed/v8/mjsunit/ubsan-fuzzerbugs.js @@ -0,0 +1,19 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// crbug.com/923466 +__v_5 = [ -1073741825, -2147483648]; +__v_5.sort(); + +// crbug.com/923642 +new RegExp("(abcd){2148473648,}", ""); + +// crbug.com/923626 +new Date(2146399200000).toString(); +new Date(2146940400000).toString(); +new Date(2147481600000).toString(); +new Date(2148022800000).toString(); + +// crbug.com/927212 +assertThrows(() => (2n).toString(-2147483657), RangeError); diff --git a/implementation-contributed/v8/test262/test262.status b/implementation-contributed/v8/test262/test262.status index fae6692cb8..34fc0a999e 100644 --- a/implementation-contributed/v8/test262/test262.status +++ b/implementation-contributed/v8/test262/test262.status @@ -1290,4 +1290,1330 @@ 'intl402/DateTimeFormat/prototype/resolvedOptions/basic': [SKIP], }], # system == windows +] + + /* + ********************************** test262-automation ********************************** + Summary: The two files have now diverged. + File Status: Partially curated & modified. + Source Status: Modified since its export. + Below is the current and modified source which was exported on Mon Feb 04 2019 19:40:41 GMT+0000 (Coordinated Universal Time) + */ + # Copyright 2011 the V8 project authors. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[ + +[ALWAYS, { + ###################### MISSING ES6 FEATURES ####################### + + # https://code.google.com/p/v8/issues/detail?id=4248 + 'language/expressions/compound-assignment/S11.13.2_A5.*': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A6.*': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.10_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.11_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.1_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.2_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.3_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.4_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.5_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.6_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.7_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.8_T4': [FAIL], + 'language/expressions/compound-assignment/S11.13.2_A7.9_T4': [FAIL], + 'language/statements/with/unscopables-inc-dec': [FAIL], + + # https://code.google.com/p/v8/issues/detail?id=4249 + 'language/expressions/assignment/S11.13.1_A7_T1': [FAIL], + 'language/expressions/assignment/S11.13.1_A7_T2': [FAIL], + 'language/expressions/assignment/S11.13.1_A7_T3': [FAIL], + 'language/expressions/postfix-increment/S11.3.1_A6_T3': [FAIL], + 'language/expressions/postfix-decrement/S11.3.2_A6_T3': [FAIL], + 'language/expressions/prefix-decrement/S11.4.5_A6_T3': [FAIL], + 'language/expressions/prefix-increment/S11.4.4_A6_T3': [FAIL], + + # https://code.google.com/p/v8/issues/detail?id=4250 + 'language/expressions/assignment/S11.13.1_A5*': [FAIL], + 'language/expressions/assignment/S11.13.1_A6*': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=4709 + 'built-ins/Promise/reject-function-name': [FAIL], + 'built-ins/Promise/resolve-function-name': [FAIL], + 'built-ins/Promise/all/resolve-element-function-name': [FAIL], + 'built-ins/Promise/executor-function-name': [FAIL], + 'built-ins/Proxy/revocable/revocation-function-name': [FAIL], + 'language/expressions/assignment/fn-name-lhs-cover': [FAIL], + 'language/expressions/assignment/fn-name-lhs-member': [FAIL], + 'language/expressions/function/name': [FAIL], + 'language/expressions/generators/name': [FAIL], + 'intl402/NumberFormat/prototype/format/format-function-name': [FAIL], + 'intl402/DateTimeFormat/prototype/format/format-function-name': [FAIL], + 'intl402/Collator/prototype/compare/compare-function-name': [FAIL], + + # https://code.google.com/p/v8/issues/detail?id=4251 + 'language/expressions/postfix-increment/S11.3.1_A5_T1': [FAIL], + 'language/expressions/postfix-increment/S11.3.1_A5_T2': [FAIL], + 'language/expressions/postfix-increment/S11.3.1_A5_T3': [FAIL], + 'language/expressions/postfix-increment/S11.3.1_A5_T4': [FAIL], + 'language/expressions/postfix-increment/S11.3.1_A5_T5': [FAIL], + 'language/expressions/postfix-decrement/S11.3.2_A5_*': [FAIL], + 'language/expressions/prefix-decrement/S11.4.5_A5_*': [FAIL], + 'language/expressions/prefix-increment/S11.4.4_A5_*': [FAIL], + 'language/statements/variable/binding-resolution': [FAIL], + + # https://code.google.com/p/v8/issues/detail?id=8771 + 'language/computed-property-names/class/static/method-number': [FAIL], + 'language/computed-property-names/class/static/method-string': [FAIL], + 'language/computed-property-names/class/static/method-symbol': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=4895 + 'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Get/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Get/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Get/infinity-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Get/BigInt/infinity-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/GetOwnProperty/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/GetOwnProperty/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/GetOwnProperty/enumerate-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/enumerate-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/HasProperty/infinity-with-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/infinity-with-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer-realm': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer': [FAIL], + # Some TypedArray methods throw due to the same bug, from Get + 'built-ins/TypedArray/prototype/every/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/find/predicate-may-detach-buffer': [FAIL], + 'built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer': [FAIL], + 'built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer': [FAIL], + 'built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer': [FAIL], + 'built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/map/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/some/callbackfn-detachbuffer': [FAIL], + 'built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer': [FAIL], + # DataView functions should also throw on detached buffers + 'built-ins/ArrayBuffer/prototype/byteLength/detached-buffer': [FAIL], + 'built-ins/DataView/detached-buffer': [FAIL], + 'built-ins/DataView/prototype/byteLength/detached-buffer': [FAIL], + 'built-ins/DataView/prototype/byteOffset/detached-buffer': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=4951 + 'language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order': [FAIL], + 'language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=896 + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/character-class-range-end': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/character-class-range-no-dash-end': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/character-class-range-no-dash-start': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/character-class-range-start': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-empty': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-empty-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-invalid': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-invalid-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces-value': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-separator': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-only': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-unclosed': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-unopened': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/grammar-extension-unopened-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-01': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-01-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-02': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-02-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-03': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-03-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-04': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-04-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-05': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-05-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-06': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-06-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-07': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-07-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-08': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-08-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-09': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-09-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-10': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-10-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-11': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-11-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-12': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-12-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-13': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-13-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-14': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/loose-matching-14-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-binary-property': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-binary-property-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-and-value': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-and-value-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-existing-value': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/non-existent-property-value-general-category': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-Block-with-value': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value': [FAIL_PHASE_ONLY], + 'built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated': [FAIL_PHASE_ONLY], + 'language/literals/regexp/early-err-pattern': [FAIL_PHASE_ONLY], + 'language/literals/regexp/invalid-braced-quantifier-exact': [FAIL_PHASE_ONLY], + 'language/literals/regexp/invalid-braced-quantifier-lower': [FAIL_PHASE_ONLY], + 'language/literals/regexp/invalid-braced-quantifier-range': [FAIL_PHASE_ONLY], + 'language/literals/regexp/invalid-optional-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/invalid-optional-negative-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/invalid-range-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/invalid-range-negative-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-2': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-2-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-3': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-3-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-4': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-4-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-5': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-duplicate-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-empty-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-empty-groupspecifier-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-2': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-3': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-4': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-5': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-6': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-numeric-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-unterminated-groupspecifier': [FAIL_PHASE_ONLY], + 'language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-dec-esc': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-class-escape': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-extended-pattern-char': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-identity-escape': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-legacy-octal-escape': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-non-empty-class-ranges': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-oob-decimal-escape': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-optional-lookahead': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-optional-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-optional-negative-lookahead': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-optional-negative-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-range-lookahead': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-range-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-range-negative-lookahead': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-invalid-range-negative-lookbehind': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-unicode-esc-bounds': [FAIL_PHASE_ONLY], + 'language/literals/regexp/u-unicode-esc-non-hex': [FAIL_PHASE_ONLY], + 'language/literals/regexp/unicode-escape-nls-err': [FAIL_PHASE_ONLY], + + # https://bugs.chromium.org/p/v8/issues/detail?id=4628 + 'language/eval-code/direct/non-definable-function-with-function': [FAIL], + 'language/eval-code/direct/non-definable-function-with-variable': [FAIL], + 'language/eval-code/indirect/non-definable-function-with-function': [FAIL], + 'language/eval-code/indirect/non-definable-function-with-variable': [FAIL], + 'language/global-code/script-decl-func-err-non-configurable': [FAIL], + 'language/global-code/script-decl-var-collision': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5116 + 'built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan': [PASS, FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=4698 + 'language/expressions/call/tco-call-args': [SKIP], + 'language/expressions/call/tco-cross-realm-class-construct': [SKIP], + 'language/expressions/call/tco-cross-realm-class-derived-construct': [SKIP], + 'language/expressions/call/tco-cross-realm-fun-call': [SKIP], + 'language/expressions/call/tco-cross-realm-fun-construct': [SKIP], + 'language/expressions/call/tco-member-args': [SKIP], + 'language/expressions/call/tco-non-eval-function': [SKIP], + 'language/expressions/call/tco-non-eval-function-dynamic': [SKIP], + 'language/expressions/call/tco-non-eval-global': [SKIP], + 'language/expressions/call/tco-non-eval-with': [SKIP], + 'language/expressions/comma/tco-final': [SKIP], + 'language/expressions/conditional/tco-cond': [SKIP], + 'language/expressions/conditional/tco-pos': [SKIP], + 'language/expressions/logical-and/tco-right': [SKIP], + 'language/expressions/logical-or/tco-right': [SKIP], + 'language/expressions/tagged-template/tco-call': [SKIP], + 'language/expressions/tagged-template/tco-member': [SKIP], + 'language/expressions/tco-pos': [SKIP], + 'language/statements/block/tco-stmt': [SKIP], + 'language/statements/block/tco-stmt-list': [SKIP], + 'language/statements/do-while/tco-body': [SKIP], + 'language/statements/for/tco-const-body': [SKIP], + 'language/statements/for/tco-let-body': [SKIP], + 'language/statements/for/tco-lhs-body': [SKIP], + 'language/statements/for/tco-var-body': [SKIP], + 'language/statements/if/tco-else-body': [SKIP], + 'language/statements/if/tco-if-body': [SKIP], + 'language/statements/labeled/tco': [SKIP], + 'language/statements/return/tco': [SKIP], + 'language/statements/switch/tco-case-body': [SKIP], + 'language/statements/switch/tco-case-body-dflt': [SKIP], + 'language/statements/switch/tco-dftl-body': [SKIP], + 'language/statements/try/tco-catch': [SKIP], + 'language/statements/try/tco-catch-finally': [SKIP], + 'language/statements/try/tco-finally': [SKIP], + 'language/statements/while/tco-body': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5327 + 'built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds': [FAIL], + 'built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds': [FAIL], + + # SharedArrayBuffer tests that require flags + 'built-ins/SharedArrayBuffer/*': ['--harmony-sharedarraybuffer'], + 'built-ins/Atomics/*': ['--harmony-sharedarraybuffer'], + 'built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer': ['--harmony-sharedarraybuffer'], + 'built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/buffer-does-not-have-arraybuffer-data-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/buffer-reference-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/byteoffset-is-negative-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/custom-proto-if-not-object-fallbacks-to-default-prototype-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/custom-proto-if-object-is-used-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/defined-bytelength-and-byteoffset-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/defined-byteoffset-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/defined-byteoffset-undefined-bytelength-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/excessive-bytelength-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/excessive-byteoffset-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/instance-extensibility-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/negative-bytelength-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/negative-byteoffset-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/newtarget-undefined-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/proto-from-ctor-realm-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/buffer/return-buffer-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/buffer/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/byteLength/return-bytelength-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/byteLength/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/byteOffset/return-byteoffset-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/byteOffset/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/index-is-out-of-range-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/negative-byteoffset-throws-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-symbol-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/return-value-clean-arraybuffer-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/return-values-custom-offset-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/return-values-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/this-has-no-dataview-internal-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/prototype/getInt32/to-boolean-littleendian-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/return-abrupt-tonumber-bytelength-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/return-abrupt-tonumber-bytelength-symbol-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/return-abrupt-tonumber-byteoffset-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/return-abrupt-tonumber-byteoffset-symbol-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/return-instance-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/toindex-bytelength-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/DataView/toindex-byteoffset-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab': ['--harmony-sharedarraybuffer'], + 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab': ['--harmony-sharedarraybuffer'], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8100 + 'built-ins/Atomics/notify/bigint/*': [SKIP], + 'built-ins/Atomics/wait/bigint/*': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=6049 + 'built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller': [FAIL_SLOPPY], + 'built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments': [FAIL_SLOPPY], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7184 + 'annexB/language/expressions/yield/star-iterable-return-emulates-undefined-throws-when-called': [FAIL], + 'annexB/language/statements/for-await-of/iterator-close-return-emulates-undefined-throws-when-called': [FAIL], + 'annexB/language/statements/for-of/iterator-close-return-emulates-undefined-throws-when-called': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7468 + 'language/statements/class/elements/privatename-not-valid-earlyerr-script-8': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5690 + 'language/expressions/call/eval-spread': [FAIL], + 'language/expressions/call/eval-spread-empty-leading': [FAIL], + 'language/expressions/call/eval-spread-empty-trailing': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8664 + 'intl402/Collator/missing-unicode-ext-value-defaults-to-true': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8717 + 'intl402/Segmenter/constructor/constructor/options-granularity-valid': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7472 + 'intl402/NumberFormat/currency-digits': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7483 + 'annexB/built-ins/Function/createdynfn-html-close-comment-params': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8260 + 'intl402/Locale/constructor-non-iana-canon': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8261 + 'intl402/Locale/constructor-options-language-valid': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8262 + 'intl402/Locale/constructor-parse-twice': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8246 + 'intl402/Locale/constructor-tag': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8243 + 'intl402/Locale/extensions-private': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8236 + 'intl402/Locale/likely-subtags': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8242 + 'intl402/Locale/extensions-grandfathered': [FAIL], + 'intl402/Locale/getters-grandfathered': [FAIL], + 'intl402/Locale/likely-subtags-grandfathered': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7831 + 'language/statements/generators/generator-created-after-decl-inst': [FAIL], + 'language/expressions/generators/generator-created-after-decl-inst': [FAIL], + 'language/expressions/async-generator/generator-created-after-decl-inst': [FAIL], + 'language/statements/async-generator/generator-created-after-decl-inst': [FAIL], + + # await tests that require flags + 'language/expressions/await/async-generator-interleaved': ['--harmony-await-optimization'], + 'language/expressions/await/await-monkey-patched-promise': ['--harmony-await-optimization'], + 'language/expressions/await/for-await-of-interleaved': ['--harmony-await-optimization'], + 'language/expressions/await/async-await-interleaved': ['--harmony-await-optimization'], + + # https://github.com/tc39/test262/issues/2033 + 'language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall': [SKIP], + 'language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1': [SKIP], + 'language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2': [SKIP], + 'language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall': [SKIP], + 'language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1': [SKIP], + 'language/expressions/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2': [SKIP], + 'language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall': [SKIP], + 'language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1': [SKIP], + 'language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2': [SKIP], + 'language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall': [SKIP], + 'language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1': [SKIP], + 'language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2': [SKIP], + + # https://github.com/tc39/test262/issues/2034 + 'language/expressions/postfix-decrement/arguments': [SKIP], + 'language/expressions/postfix-decrement/arguments-nostrict': [SKIP], + 'language/expressions/postfix-decrement/eval': [SKIP], + 'language/expressions/postfix-decrement/eval-nostrict': [SKIP], + 'language/expressions/postfix-increment/arguments': [SKIP], + 'language/expressions/postfix-increment/arguments-nostrict': [SKIP], + 'language/expressions/postfix-increment/eval': [SKIP], + 'language/expressions/postfix-increment/eval-nostrict': [SKIP], + 'language/expressions/prefix-decrement/arguments': [SKIP], + 'language/expressions/prefix-decrement/arguments-nostrict': [SKIP], + 'language/expressions/prefix-decrement/eval': [SKIP], + 'language/expressions/prefix-decrement/eval-nostrict': [SKIP], + 'language/expressions/prefix-increment/arguments': [SKIP], + 'language/expressions/prefix-increment/arguments-nostrict': [SKIP], + 'language/expressions/prefix-increment/eval': [SKIP], + 'language/expressions/prefix-increment/eval-nostrict': [SKIP], + + # https://github.com/tc39/proposal-class-fields/issues/215 + 'language/expressions/function/early-errors/invalid-names-call-expression-bad-reference': [FAIL], + 'language/expressions/function/early-errors/invalid-names-call-expression-this': [FAIL], + 'language/expressions/function/early-errors/invalid-names-member-expression-bad-reference': [FAIL], + 'language/expressions/function/early-errors/invalid-names-member-expression-this': [FAIL], + 'language/statements/function/early-errors/invalid-names-call-expression-bad-reference': [FAIL], + 'language/statements/function/early-errors/invalid-names-call-expression-this': [FAIL], + 'language/statements/function/early-errors/invalid-names-member-expression-bad-reference': [FAIL], + 'language/statements/function/early-errors/invalid-names-member-expression-this': [FAIL], + + ######################## NEEDS INVESTIGATION ########################### + + # These test failures are specific to the intl402 suite and need investigation + # to be either marked as bugs with issues filed for them or as deliberate + # incompatibilities if the test cases turn out to be broken or ambiguous. + # Some of these are related to v8:4361 in being visible side effects from Intl. + + # https://bugs.chromium.org/p/v8/issues/detail?id=7833 + 'built-ins/Atomics/wait/cannot-suspend-throws': [SKIP], + 'built-ins/Atomics/wait/undefined-index-defaults-to-zero': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=8258 + 'intl402/Locale/constructor-options-language-valid-undefined': [FAIL], + + ##################### DELIBERATE INCOMPATIBILITIES ##################### + + # https://github.com/tc39/ecma262/pull/889 + 'annexB/language/function-code/block-decl-func-skip-arguments': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=6538 + + # https://bugs.chromium.org/p/v8/issues/detail?id=6541 + 'language/export/escaped-as-export-specifier': [FAIL], + 'language/export/escaped-from': [FAIL], + 'language/expressions/object/method-definition/escaped-get': [FAIL], + 'language/expressions/object/method-definition/escaped-set': [FAIL], + 'language/import/escaped-as-import-specifier': [FAIL], + 'language/import/escaped-as-namespace-import': [FAIL], + 'language/import/escaped-from': [FAIL], + 'language/statements/for-await-of/escaped-of': [FAIL], + 'language/statements/for-of/escaped-of': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=6543 + 'language/statements/labeled/value-await-non-module-escaped': [FAIL], + 'language/statements/labeled/value-yield-non-strict-escaped': [FAIL], + 'language/expressions/async-arrow-function/escaped-async-line-terminator': [FAIL], + 'language/expressions/class/class-name-ident-await-escaped': [FAIL], + 'language/statements/class/class-name-ident-await-escaped': [FAIL], + + ############################ INVALID TESTS ############################# + + # Test makes unjustified assumptions about the number of calls to SortCompare. + # Test262 Bug: https://bugs.ecmascript.org/show_bug.cgi?id=596 + 'built-ins/Array/prototype/sort/bug_596_1': [PASS, FAIL_OK], + + # https://github.com/tc39/test262/pull/688#pullrequestreview-14025354 + 'built-ins/Function/internals/Construct/derived-this-uninitialized-realm': [FAIL], + + # Date tests that fail in CE(S)T timezone. + # https://bugs.chromium.org/p/v8/issues/detail?id=5449 + 'built-ins/Date/prototype/setFullYear/new-value-time-clip': [PASS, FAIL], + 'built-ins/Date/prototype/setMonth/new-value-time-clip': [PASS, FAIL], + + # Test against internals of harness; we plug in differently + 'harness/detachArrayBuffer': [SKIP], + 'harness/detachArrayBuffer-host-detachArrayBuffer': [SKIP], + + ############################ SKIPPED TESTS ############################# + + # These tests take a looong time to run. + 'built-ins/decodeURI/S15.1.3.1_A1.10_T1': [SKIP], + 'built-ins/decodeURI/S15.1.3.1_A1.11_T1': [SKIP], + 'built-ins/decodeURI/S15.1.3.1_A1.11_T2': [SKIP], + 'built-ins/decodeURI/S15.1.3.1_A1.12_T1': [SKIP], + 'built-ins/decodeURI/S15.1.3.1_A1.12_T2': [SKIP], + 'built-ins/decodeURI/S15.1.3.1_A2.5_T1': [SKIP], + 'built-ins/decodeURIComponent/S15.1.3.2_A1.11_T1': [SKIP], + 'built-ins/decodeURIComponent/S15.1.3.2_A1.12_T1': [SKIP], + 'built-ins/decodeURIComponent/S15.1.3.2_A2.5_T1': [SKIP], + 'language/literals/regexp/S7.8.5_A1.1_T2': [SKIP], + 'language/literals/regexp/S7.8.5_A1.4_T2': [SKIP], + 'language/literals/regexp/S7.8.5_A2.1_T2': [SKIP], + 'language/literals/regexp/S7.8.5_A2.4_T2': [SKIP], + 'built-ins/Array/prototype/slice/S15.4.4.10_A3_T1': [SKIP], + 'built-ins/Array/prototype/slice/S15.4.4.10_A3_T2': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=7187 + 'built-ins/Function/prototype/toString/line-terminator-normalisation-CR': [SKIP], + + ############################ SLOW TESTS ############################# + + 'annexB/built-ins/RegExp/RegExp-leading-escape-BMP': [PASS, SLOW], + 'annexB/built-ins/RegExp/RegExp-trailing-escape-BMP': [PASS, SLOW], + 'language/comments/S7.4_A5': [PASS, SLOW], + 'language/comments/S7.4_A6': [PASS, SLOW], + +}], # ALWAYS + +['no_i18n == True', { + # Unicode canonicalization is not available with i18n turned off. + 'built-ins/String/prototype/localeCompare/15.5.4.9_CE': [SKIP], + + # Unicode regexp case mapping is not available with i18n turned off. + 'language/literals/regexp/u-case-mapping': [SKIP], + + # BUG(v8:4437). + 'built-ins/String/prototype/normalize/return-normalized-string': [SKIP], + 'built-ins/String/prototype/normalize/return-normalized-string-from-coerced-form': [SKIP], + 'built-ins/String/prototype/normalize/return-normalized-string-using-default-parameter': [SKIP], + + # Case-conversion is not fully compliant to the Unicode spec with i18n off. + 'built-ins/String/prototype/toLocaleLowerCase/Final_Sigma_U180E': [FAIL], + 'built-ins/String/prototype/toLocaleLowerCase/special_casing_conditional': [FAIL], + 'built-ins/String/prototype/toLocaleLowerCase/supplementary_plane': [FAIL], + 'built-ins/String/prototype/toLowerCase/Final_Sigma_U180E': [FAIL], + 'built-ins/String/prototype/toLowerCase/special_casing_conditional': [FAIL], + 'built-ins/String/prototype/toLowerCase/supplementary_plane': [FAIL], + 'built-ins/String/prototype/toLocaleUpperCase/supplementary_plane': [FAIL], + 'built-ins/String/prototype/toUpperCase/supplementary_plane': [FAIL], + + # Locale-sensitive case-conversion is not available with i18n off. + 'intl402/String/prototype/toLocaleLowerCase/special_casing_Azeri': [FAIL], + 'intl402/String/prototype/toLocaleLowerCase/special_casing_Lithuanian': [FAIL], + 'intl402/String/prototype/toLocaleLowerCase/special_casing_Turkish': [FAIL], + 'intl402/String/prototype/toLocaleUpperCase/special_casing_Azeri': [FAIL], + 'intl402/String/prototype/toLocaleUpperCase/special_casing_Lithuanian': [FAIL], + 'intl402/String/prototype/toLocaleUpperCase/special_casing_Turkish': [FAIL], + + # Unicode property escapes unavailable without i18n + 'built-ins/RegExp/property-escapes/*': [SKIP], + 'built-ins/RegExp/named-groups/unicode-property-names': [SKIP], +}], # no_i18n == True + +['arch == arm or arch == mipsel or arch == mips or arch == arm64 or arch == mips64 or arch == mips64el', { + + # TODO(mstarzinger): Causes stack overflow on simulators due to eager + # compilation of parenthesized function literals. Needs investigation. + 'language/statements/function/S13.2.1_A1_T1': [SKIP], + + # BUG(3251225): Tests that timeout with --noopt. + 'built-ins/decodeURI/S15.1.3.1_A2.4_T1': [SKIP], + 'built-ins/decodeURI/S15.1.3.1_A2.5_T1': [SKIP], + 'built-ins/decodeURIComponent/S15.1.3.2_A2.4_T1': [SKIP], + 'built-ins/decodeURIComponent/S15.1.3.2_A2.5_T1': [SKIP], + 'built-ins/encodeURI/S15.1.3.3_A2.3_T1': [SKIP], + 'built-ins/encodeURIComponent/S15.1.3.4_A2.3_T1': [SKIP], +}], # 'arch == arm or arch == mipsel or arch == mips or arch == arm64' + +['byteorder == big', { + # Test failures on big endian platforms due to the way the tests + # are written + + # https://github.com/tc39/test262/issues/757 + 'built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type': [SKIP], +}], + +['asan == True', { + # BUG(v8:4653): Test262 tests which rely on quit() are not compatible with + # asan's --omit-quit flag. + 'built-ins/Promise/prototype/then/deferred-is-resolved-value': [SKIP], + 'language/expressions/dynamic-import/always-create-new-promise': [SKIP], + 'language/expressions/dynamic-import/assign-expr-get-value-abrupt-throws': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/additive-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/array-literal': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/arrow-function': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/await-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/await-identifier': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/call-expr-arguments': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/call-expr-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/call-expr-identifier': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/cover-call-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/identifier': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/import-meta': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/logical-and-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/logical-or-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/member-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/new-target': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/object-literal': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/tagged-function-call': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/ternary': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/this': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/unary-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/yield-assign-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/yield-expr': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/yield-identifier': [SKIP], + 'language/expressions/dynamic-import/assignment-expression/yield-star': [SKIP], + 'language/expressions/dynamic-import/await-import-evaluation': [SKIP], + 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-arrow-import-catch-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-await-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-await-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-await-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-await-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-return-await-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-function-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-await-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-await-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-async-gen-return-await-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-import-catch-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-import-catch-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-import-catch-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-labeled-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-labeled-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-block-labeled-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-do-while-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-do-while-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-do-while-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-else-import-catch-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-else-import-catch-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-else-import-catch-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-function-import-catch-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-function-import-catch-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-function-import-catch-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-if-import-catch-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-if-import-catch-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-if-import-catch-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/nested-while-import-catch-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/nested-while-import-catch-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/nested-while-import-catch-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror': [SKIP], + 'language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror': [SKIP], + 'language/expressions/dynamic-import/catch/top-level-import-catch-eval-script-code-target': [SKIP], + 'language/expressions/dynamic-import/catch/top-level-import-catch-file-does-not-exist': [SKIP], + 'language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import': [SKIP], + 'language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular': [SKIP], + 'language/expressions/dynamic-import/catch/top-level-import-catch-specifier-tostring-abrupt-rejects': [SKIP], + 'language/expressions/dynamic-import/custom-primitive': [SKIP], + 'language/expressions/dynamic-import/double-error-resolution': [SKIP], + 'language/expressions/dynamic-import/double-error-resolution-promise': [SKIP], + 'language/expressions/dynamic-import/escape-sequence-import': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-cls-anon': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-cls-named': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-cls-name-meth': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-cls-anon': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-cls-named': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-fn-anon': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-fn-named': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-gen-anon': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-gen-named': [SKIP], + 'language/expressions/dynamic-import/eval-export-dflt-expr-in': [SKIP], + 'language/expressions/dynamic-import/eval-rqstd-once': [SKIP], + 'language/expressions/dynamic-import/eval-self-once-module': [SKIP], + 'language/expressions/dynamic-import/eval-self-once-script': [SKIP], + 'language/expressions/dynamic-import/for-await-resolution-and-error-agen': [SKIP], + 'language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield': [SKIP], + 'language/expressions/dynamic-import/for-await-resolution-and-error': [SKIP], + 'language/expressions/dynamic-import/imported-self-update': [SKIP], + 'language/expressions/dynamic-import/indirect-resolution': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-define-own-property': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-extensible': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-direct': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-indirect': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-props-nrml': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-found-init': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-own-property-sym': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-str-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-str-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-sym-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-get-sym-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-has-property-str-found-init': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-has-property-str-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-has-property-sym-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-has-property-sym-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-no-iterator': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-object': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-reflect': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-prop-descs': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-prototype': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-set-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-set-prototype-of': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-set-prototype-of-null': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-set-same-values-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-set-same-values-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-set-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/await-ns-Symbol-toStringTag': [SKIP], + 'language/expressions/dynamic-import/namespace/default-property-not-set-own': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-define-own-property': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-extensible': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-direct': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-indirect': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-props-nrml': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-found-init': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-sym': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-str-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-str-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-found-init': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-not-found': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-no-iterator': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-object': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-reflect': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-prop-descs': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-prototype': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-set-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of-null': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-no-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-set-strict': [SKIP], + 'language/expressions/dynamic-import/namespace/promise-then-ns-Symbol-toStringTag': [SKIP], + 'language/expressions/dynamic-import/returns-promise': [SKIP], + 'language/expressions/dynamic-import/reuse-namespace-object': [SKIP], + 'language/expressions/dynamic-import/reuse-namespace-object-from-import': [SKIP], + 'language/expressions/dynamic-import/reuse-namespace-object-from-script': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-10-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-11-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-12-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-13-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-14-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-15-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-16-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-17-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-1-update-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-2-update-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-3-update-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-4-update-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-5-lhs-equals-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-6-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-7-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-8-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/invalid-asssignmenttargettype-reference-error-9-lhs-assignment-operator-assignment-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-while-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-while-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/top-level-no-new-call-expression': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/top-level-no-rest-param': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-args': [SKIP], + 'language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-no-trailing-comma': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/callexpression-arguments': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/callexpression-templateliteral': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-arrow-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-arrow-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-await-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-function-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-block-labeled-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-block-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-block-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-do-while-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-do-while-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-else-braceless-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-else-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-else-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-function-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-function-return-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-function-return-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-function-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-if-braceless-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-if-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-if-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-while-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-while-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-with-expression-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-with-expression-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-with-expression-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-with-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/nested-with-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/new-covered-expression-is-valid': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/top-level-nested-imports': [SKIP], + 'language/expressions/dynamic-import/syntax/valid/top-level-script-code-valid': [SKIP], + 'language/expressions/dynamic-import/update-to-dynamic-import': [SKIP], + 'language/expressions/dynamic-import/usage-from-eval': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-import-then-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-arrow-import-then-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-await-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-await-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-await-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-await-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-return-await-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-return-await-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-function-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-block-import-then-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-block-import-then-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-block-import-then-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-do-while-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-do-while-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-do-while-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-else-import-then-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-else-import-then-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-else-import-then-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-function-import-then-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-function-import-then-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-function-import-then-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-braceless-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-braceless-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-braceless-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-import-then-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-import-then-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-if-import-then-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/nested-while-import-then-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/nested-while-import-then-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/nested-while-import-then-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/syntax-nested-block-labeled-specifier-tostring': [SKIP], + 'language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt': [SKIP], + 'language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update': [SKIP], + 'language/expressions/dynamic-import/usage/top-level-import-then-eval-script-code-host-resolves-module-code': [SKIP], + 'language/expressions/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets': [SKIP], + 'language/expressions/dynamic-import/usage/top-level-import-then-returns-thenable': [SKIP], + 'language/expressions/dynamic-import/usage/top-level-import-then-specifier-tostring': [SKIP], +}], # asan == True + +['asan == True or msan == True or tsan == True', { + # https://bugs.chromium.org/p/v8/issues/detail?id=4639 + # The failed allocation causes an asan/msan/tsan error + 'built-ins/ArrayBuffer/allocation-limit': [SKIP], + 'built-ins/ArrayBuffer/length-is-too-large-throws': [SKIP], + 'built-ins/SharedArrayBuffer/allocation-limit': [SKIP], + 'built-ins/SharedArrayBuffer/length-is-too-large-throws': [SKIP], +}], # asan == True or msan == True or tsan == True + +['variant == interpreted_regexp', { + # Call stack exceeded: https://crbug.com/v8/8678 + 'built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u': [SKIP], + 'built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u': [SKIP], + 'built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u': [SKIP], +}], # variant == interpreted_regexp + +############################################################################## +['variant == jitless', { + # https://crbug.com/v8/7777 + 'built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u': [SKIP], + 'built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u': [SKIP], + 'built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u': [SKIP], +}], # variant == jitless + +['variant == no_wasm_traps', { + '*': [SKIP], +}], # variant == no_wasm_traps + +['variant != default or arch == arm or arch == arm64 or arch == mipsel or arch == mips or arch == mips64 or arch == mips64el', { + # These tests take a long time to run + 'built-ins/RegExp/property-escapes/generated/*': [SKIP], +}], # variant != default or arch == arm or arch == arm64 + +['system == windows', { + # https://crbug.com/856119 + 'intl402/DateTimeFormat/prototype/resolvedOptions/basic': [SKIP], +}], # system == windows + ] diff --git a/implementation-contributed/v8/test262/testcfg.py b/implementation-contributed/v8/test262/testcfg.py index 6674abbfce..8bec9965e2 100644 --- a/implementation-contributed/v8/test262/testcfg.py +++ b/implementation-contributed/v8/test262/testcfg.py @@ -46,14 +46,11 @@ FEATURE_FLAGS = { 'class-static-fields-public': '--harmony-class-fields', 'class-fields-private': '--harmony-private-fields', 'class-static-fields-private': '--harmony-private-fields', - 'Array.prototype.flat': '--harmony-array-flat', - 'Array.prototype.flatMap': '--harmony-array-flat', 'String.prototype.matchAll': '--harmony-string-matchall', 'Symbol.matchAll': '--harmony-string-matchall', 'numeric-separator-literal': '--harmony-numeric-separator', 'Intl.ListFormat': '--harmony-intl-list-format', 'Intl.Locale': '--harmony-locale', - 'Intl.RelativeTimeFormat': '--harmony-intl-relative-time-format', 'Intl.Segmenter': '--harmony-intl-segmenter', 'Symbol.prototype.description': '--harmony-symbol-description', 'globalThis': '--harmony-global', diff --git a/implementation-contributed/v8/wasm-js/wasm-js.status b/implementation-contributed/v8/wasm-js/wasm-js.status index e69de29bb2..16de4f9822 100644 --- a/implementation-contributed/v8/wasm-js/wasm-js.status +++ b/implementation-contributed/v8/wasm-js/wasm-js.status @@ -0,0 +1,23 @@ +# Copyright 2018 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +[ +[ALWAYS, { + # https://bugs.chromium.org/p/v8/issues/detail?id=8633 + 'limits': [SKIP], +}], # ALWAYS + +['arch == s390 or arch == s390x or system == aix', { + # https://bugs.chromium.org/p/v8/issues/detail?id=8402 + 'instance/constructor': [SKIP], + 'constructor/instantiate': [SKIP], +}], # 'arch == s390 or arch == s390x or system == aix' + +############################################################################## +['lite_mode or variant == jitless', { + # TODO(v8:7777): Re-enable once wasm is supported in jitless mode. + '*': [SKIP], +}], # lite_mode or variant == jitless + +]