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 - -]