diff --git a/implementation-contributed/v8/intl/intl.status b/implementation-contributed/v8/intl/intl.status index 471b1184c58555be60d984438beab715f69810c0..83e546db76c36a144068bd6aa9dd9c4a064a48ee 100644 --- a/implementation-contributed/v8/intl/intl.status +++ b/implementation-contributed/v8/intl/intl.status @@ -27,8 +27,12 @@ [ [ALWAYS, { - # TODO(jochen): The following test is flaky. +# TODO(jochen): The following test is flaky. 'overrides/caching': [PASS, FAIL], + + # https://code.google.com/p/v8/issues/detail?id=7481 + 'collator/check-kf-option': [FAIL], + 'collator/check-kn-option': [FAIL], }], # ALWAYS ['variant == no_wasm_traps', { diff --git a/implementation-contributed/v8/intl/locale/locale-constructor.js b/implementation-contributed/v8/intl/locale/locale-constructor.js index 3da9e291beaab8c2124ae21ff558c8074c67d4e4..bf2510553fbae49dd9fc1baaccac28a5c72ee647 100644 --- a/implementation-contributed/v8/intl/locale/locale-constructor.js +++ b/implementation-contributed/v8/intl/locale/locale-constructor.js @@ -86,9 +86,7 @@ assertThrows( }), Error); -// These don't throw yet, we need to implement language/script/region -// override logic first. -assertDoesNotThrow( +assertThrows( () => new Intl.Locale('en-US', { get language() { throw new Error('foo'); @@ -96,7 +94,7 @@ assertDoesNotThrow( }), Error); -assertDoesNotThrow( +assertThrows( () => new Intl.Locale('en-US', { get script() { throw new Error('foo'); @@ -104,7 +102,7 @@ assertDoesNotThrow( }), Error); -assertDoesNotThrow( +assertThrows( () => new Intl.Locale('en-US', { get region() { throw new Error('foo'); 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 774a3491463d01aa90ac956deec059c5f0b47f81..391b83ae0ad7f12cc0ca5139cdf0e5469de41eb6 100644 --- a/implementation-contributed/v8/intl/relative-time-format/resolved-options.js +++ b/implementation-contributed/v8/intl/relative-time-format/resolved-options.js @@ -13,10 +13,15 @@ assertEquals('long', rtf.resolvedOptions().style); assertEquals('always', rtf.resolvedOptions().numeric); // contains style, numeric and locale key -assertEquals(3, Object.getOwnPropertyNames(rtf.resolvedOptions()).length); +assertEquals(4, Object.getOwnPropertyNames(rtf.resolvedOptions()).length); // contains style, numeric and locale key -assertEquals(3, Object.getOwnPropertyNames(new Intl.RelativeTimeFormat('en').resolvedOptions()).length); +assertEquals( + 4, + Object.getOwnPropertyNames( + new Intl.RelativeTimeFormat("en").resolvedOptions() + ).length +); assertEquals( 'short', diff --git a/implementation-contributed/v8/mjsunit/compiler/array-multiple-receiver-maps.js b/implementation-contributed/v8/mjsunit/compiler/array-multiple-receiver-maps.js index 3ddff992f7afef0485364ceb24a04e4cc71223bd..c26aeda7dc86d8c179d942d8881835e2e1484207 100644 --- a/implementation-contributed/v8/mjsunit/compiler/array-multiple-receiver-maps.js +++ b/implementation-contributed/v8/mjsunit/compiler/array-multiple-receiver-maps.js @@ -3,7 +3,7 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --opt --no-always-opt -// Flags: --no-stress-background-compile +// Flags: --no-stress-background-compile --trace-opt --trace-deopt let id = 0; diff --git a/implementation-contributed/v8/mjsunit/es6/block-eval-var-over-let.js b/implementation-contributed/v8/mjsunit/es6/block-eval-var-over-let.js index e16d7a02a69a774a720daaa1415c9e6f981077eb..784f5d2f4205fdb1fbdd91f3de2f7ab550dee164 100644 --- a/implementation-contributed/v8/mjsunit/es6/block-eval-var-over-let.js +++ b/implementation-contributed/v8/mjsunit/es6/block-eval-var-over-let.js @@ -141,15 +141,15 @@ try { } assertTrue(caught); -caught = false -try { - (function() { - { - let x = 1; - eval('{ function x() {} }'); - } - })(); -} catch (e) { - caught = true; -} -assertFalse(caught); +// See ES#sec-web-compat-evaldeclarationinstantiation. Sloppy block functions +// inside of blocks in eval behave similar to regular sloppy block function +// hoisting: the var declaration on the function level is only created if +// it would not cause a syntax error. A masking let would cause a conflicting +// var declaration syntax error, and hence the var isn't introduced. +(function() { + { + let x = 1; + eval('{ function x() {} }'); + assertEquals(1, x); + } +})(); diff --git a/implementation-contributed/v8/mjsunit/es6/block-sloppy-function.js b/implementation-contributed/v8/mjsunit/es6/block-sloppy-function.js index d527a7debb1607d7905e7cd307c668b30614fbe3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/implementation-contributed/v8/mjsunit/es6/block-sloppy-function.js +++ b/implementation-contributed/v8/mjsunit/es6/block-sloppy-function.js @@ -1,671 +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. - -// Test Annex B 3.3 semantics for functions declared in blocks in sloppy mode. -// http://www.ecma-international.org/ecma-262/6.0/#sec-block-level-function-declarations-web-legacy-compatibility-semantics - -(function overridingLocalFunction() { - var x = []; - assertEquals('function', typeof f); - function f() { - x.push(1); - } - f(); - { - f(); - function f() { - x.push(2); - } - f(); - } - f(); - { - f(); - function f() { - x.push(3); - } - f(); - } - f(); - assertArrayEquals([1, 2, 2, 2, 3, 3, 3], x); -})(); - -(function newFunctionBinding() { - var x = []; - assertEquals('undefined', typeof f); - { - f(); - function f() { - x.push(2); - } - f(); - } - f(); - { - f(); - function f() { - x.push(3); - } - f(); - } - f(); - assertArrayEquals([2, 2, 2, 3, 3, 3], x); -})(); - -(function shadowingLetDoesntBind() { - let f = 1; - assertEquals(1, f); - { - let y = 3; - function f() { - y = 2; - } - f(); - assertEquals(2, y); - } - assertEquals(1, f); -})(); - -(function shadowingLetDoesntBindGenerator() { - let f = function *f() { - while(true) { - yield 1; - } - }; - assertEquals(1, f().next().value); - { - function *f() { - while(true) { - yield 2; - } - } - assertEquals(2, f().next().value); - } - assertEquals(1, f().next().value); -})(); - -(function shadowingClassDoesntBind() { - class f { } - assertEquals('class f { }', f.toString()); - { - let y = 3; - function f() { - y = 2; - } - f(); - assertEquals(2, y); - } - assertEquals('class f { }', f.toString()); -})(); - -(function shadowingConstDoesntBind() { - const f = 1; - assertEquals(1, f); - { - let y = 3; - function f() { - y = 2; - } - f(); - assertEquals(2, y); - } - assertEquals(1, f); -})(); - -(function shadowingVarBinds() { - var f = 1; - assertEquals(1, f); - { - let y = 3; - function f() { - y = 2; - } - f(); - assertEquals(2, y); - } - assertEquals('function', typeof f); -})(); - -(function complexParams(a = 0) { - { - let y = 3; - function f(b = 0) { - y = 2; - } - f(); - assertEquals(2, y); - } - assertEquals('function', typeof f); -})(); - -(function complexVarParams(a = 0) { - var f; - { - let y = 3; - function f(b = 0) { - y = 2; - } - f(); - assertEquals(2, y); - } - assertEquals('function', typeof f); -})(); - -(function conditional() { - if (true) { - function f() { return 1; } - } else { - function f() { return 2; } - } - assertEquals(1, f()); - - if (false) { - function g() { return 1; } - } else { - function g() { return 2; } - } - assertEquals(2, g()); -})(); - -(function skipExecution() { - { - function f() { return 1; } - } - assertEquals(1, f()); - { - function f() { return 2; } - } - assertEquals(2, f()); - L: { - assertEquals(3, f()); - break L; - function f() { return 3; } - } - assertEquals(2, f()); -})(); - -(function executionOrder() { - function getOuter() { - return f; - } - assertEquals('undefined', typeof getOuter()); - - { - assertEquals('function', typeof f); - assertEquals('undefined', typeof getOuter()); - function f () {} - assertEquals('function', typeof f); - assertEquals('function', typeof getOuter()); - } - - assertEquals('function', typeof getOuter()); -})(); - -(function reassignBindings() { - function getOuter() { - return f; - } - assertEquals('undefined', typeof getOuter()); - - { - assertEquals('function', typeof f); - assertEquals('undefined', typeof getOuter()); - f = 1; - assertEquals('number', typeof f); - assertEquals('undefined', typeof getOuter()); - function f () {} - assertEquals('number', typeof f); - assertEquals('number', typeof getOuter()); - f = ''; - assertEquals('string', typeof f); - assertEquals('number', typeof getOuter()); - } - - assertEquals('number', typeof getOuter()); -})(); - -// Test that shadowing arguments is fine -(function shadowArguments(x) { - assertArrayEquals([1], arguments); - { - assertEquals('function', typeof arguments); - function arguments() {} - assertEquals('function', typeof arguments); - } - assertEquals('function', typeof arguments); -})(1); - - -// Don't shadow simple parameter -(function shadowingParameterDoesntBind(x) { - assertEquals(1, x); - { - function x() {} - } - assertEquals(1, x); -})(1); - -// Don't shadow complex parameter -(function shadowingDefaultParameterDoesntBind(x = 0) { - assertEquals(1, x); - { - function x() {} - } - assertEquals(1, x); -})(1); - -// Don't shadow nested complex parameter -(function shadowingNestedParameterDoesntBind([[x]]) { - assertEquals(1, x); - { - function x() {} - } - assertEquals(1, x); -})([[1]]); - -// Don't shadow rest parameter -(function shadowingRestParameterDoesntBind(...x) { - assertArrayEquals([1], x); - { - function x() {} - } - assertArrayEquals([1], x); -})(1); - -// Don't shadow complex rest parameter -(function shadowingComplexRestParameterDoesntBind(...[x]) { - assertArrayEquals(1, x); - { - function x() {} - } - assertArrayEquals(1, x); -})(1); - -// Previous tests with a var declaration thrown in. -// Don't shadow simple parameter -(function shadowingVarParameterDoesntBind(x) { - var x; - assertEquals(1, x); - { - function x() {} - } - assertEquals(1, x); -})(1); - -// Don't shadow complex parameter -(function shadowingVarDefaultParameterDoesntBind(x = 0) { - var x; - assertEquals(1, x); - { - function x() {} - } - assertEquals(1, x); -})(1); - -// Don't shadow nested complex parameter -(function shadowingVarNestedParameterDoesntBind([[x]]) { - var x; - assertEquals(1, x); - { - function x() {} - } - assertEquals(1, x); -})([[1]]); - -// Don't shadow rest parameter -(function shadowingVarRestParameterDoesntBind(...x) { - var x; - assertArrayEquals([1], x); - { - function x() {} - } - assertArrayEquals([1], x); -})(1); - -// Don't shadow complex rest parameter -(function shadowingVarComplexRestParameterDoesntBind(...[x]) { - var x; - assertArrayEquals(1, x); - { - function x() {} - } - assertArrayEquals(1, x); -})(1); - - -// Hoisting is not affected by other simple parameters -(function irrelevantParameterBinds(y, z) { - assertEquals(undefined, x); - { - function x() {} - } - assertEquals('function', typeof x); -})(1); - -// Hoisting is not affected by other complex parameters -(function irrelevantComplexParameterBinds([y] = [], z) { - assertEquals(undefined, x); - { - function x() {} - } - assertEquals('function', typeof x); -})(); - -// Hoisting is not affected by rest parameters -(function irrelevantRestParameterBinds(y, ...z) { - assertEquals(undefined, x); - { - function x() {} - } - assertEquals('function', typeof x); -})(); - -// Hoisting is not affected by complex rest parameters -(function irrelevantRestParameterBinds(y, ...[z]) { - assertEquals(undefined, x); - { - function x() {} - } - assertEquals('function', typeof x); -})(); - - -// Test that shadowing function name is fine -{ - let called = false; - (function shadowFunctionName() { - if (called) assertUnreachable(); - called = true; - { - function shadowFunctionName() { - return 0; - } - assertEquals(0, shadowFunctionName()); - } - assertEquals(0, shadowFunctionName()); - })(); -} - -{ - let called = false; - (function shadowFunctionNameWithComplexParameter(...r) { - if (called) assertUnreachable(); - called = true; - { - function shadowFunctionNameWithComplexParameter() { - return 0; - } - assertEquals(0, shadowFunctionNameWithComplexParameter()); - } - assertEquals(0, shadowFunctionNameWithComplexParameter()); - })(); -} - -(function shadowOuterVariable() { - { - let f = 0; - (function () { - assertEquals(undefined, f); - { - assertEquals(1, f()); - function f() { return 1; } - assertEquals(1, f()); - } - assertEquals(1, f()); - })(); - assertEquals(0, f); - } -})(); - -(function notInDefaultScope() { - var y = 1; - (function innerNotInDefaultScope(x = y) { - assertEquals('undefined', typeof y); - { - function y() {} - } - assertEquals('function', typeof y); - assertEquals(1, x); - })(); -})(); - -(function noHoistingThroughNestedLexical() { - { - let f = 2; - { - let y = 3; - function f() { - y = 2; - } - f(); - assertEquals(2, y); - } - assertEquals(2, f); - } - assertThrows(()=>f, ReferenceError); -})(); - -// Only the first function is hoisted; the second is blocked by the first. -// Contrast overridingLocalFunction, in which the outer function declaration -// is not lexical and so the inner declaration is hoisted. -(function noHoistingThroughNestedFunctions() { - assertEquals(undefined, f); // Also checks that the var-binding exists - - { - assertEquals(4, f()); - - function f() { - return 4; - } - - { - assertEquals(5, f()); - function f() { - return 5; - } - assertEquals(5, f()); - } - - assertEquals(4, f()); - } - - assertEquals(4, f()); -})(); - -// B.3.5 interacts with B.3.3 to allow this. -(function hoistingThroughSimpleCatch() { - assertEquals(undefined, f); - - try { - throw 0; - } catch (f) { - { - assertEquals(4, f()); - - function f() { - return 4; - } - - assertEquals(4, f()); - } - - assertEquals(0, f); - } - - assertEquals(4, f()); -})(); - -(function noHoistingThroughComplexCatch() { - try { - throw 0; - } catch ({f}) { - { - assertEquals(4, f()); - - function f() { - return 4; - } - - assertEquals(4, f()); - } - } - - assertThrows(()=>f, ReferenceError); -})(); - -(function hoistingThroughWith() { - with ({f: 0}) { - assertEquals(0, f); - - { - assertEquals(4, f()); - - function f() { - return 4; - } - - assertEquals(4, f()); - } - - assertEquals(0, f); - } - - assertEquals(4, f()); -})(); - -// Test that hoisting from blocks does happen in global scope -function globalHoisted() { return 0; } -{ - function globalHoisted() { return 1; } -} -assertEquals(1, globalHoisted()); - -// Also happens when not previously defined -assertEquals(undefined, globalUndefinedHoisted); -{ - function globalUndefinedHoisted() { return 1; } -} -assertEquals(1, globalUndefinedHoisted()); -var globalUndefinedHoistedDescriptor = - Object.getOwnPropertyDescriptor(this, "globalUndefinedHoisted"); -assertFalse(globalUndefinedHoistedDescriptor.configurable); -assertTrue(globalUndefinedHoistedDescriptor.writable); -assertTrue(globalUndefinedHoistedDescriptor.enumerable); -assertEquals(1, globalUndefinedHoistedDescriptor.value()); - -// When a function property is hoisted, it should be -// made enumerable. -// BUG(v8:4451) -Object.defineProperty(this, "globalNonEnumerable", { - value: false, - configurable: true, - writable: true, - enumerable: false -}); -eval("{function globalNonEnumerable() { return 1; }}"); -var globalNonEnumerableDescriptor - = Object.getOwnPropertyDescriptor(this, "globalNonEnumerable"); -// BUG(v8:4451): Should be made non-configurable -assertTrue(globalNonEnumerableDescriptor.configurable); -assertTrue(globalNonEnumerableDescriptor.writable); -// BUG(v8:4451): Should be made enumerable -assertFalse(globalNonEnumerableDescriptor.enumerable); -assertEquals(1, globalNonEnumerableDescriptor.value()); - -// When a function property is hoisted, it should be overwritten and -// made writable and overwritten, even if the property was non-writable. -Object.defineProperty(this, "globalNonWritable", { - value: false, - configurable: true, - writable: false, - enumerable: true -}); -eval("{function globalNonWritable() { return 1; }}"); -var globalNonWritableDescriptor - = Object.getOwnPropertyDescriptor(this, "globalNonWritable"); -// BUG(v8:4451): Should be made non-configurable -assertTrue(globalNonWritableDescriptor.configurable); -// BUG(v8:4451): Should be made writable -assertFalse(globalNonWritableDescriptor.writable); -assertFalse(globalNonEnumerableDescriptor.enumerable); -// BUG(v8:4451): Should be overwritten -assertEquals(false, globalNonWritableDescriptor.value); - -// Test that hoisting from blocks does happen in an eval -eval(` - function evalHoisted() { return 0; } - { - function evalHoisted() { return 1; } - } - assertEquals(1, evalHoisted()); -`); - -// Test that hoisting from blocks happens from eval in a function -!function() { - eval(` - function evalInFunctionHoisted() { return 0; } - { - function evalInFunctionHoisted() { return 1; } - } - assertEquals(1, evalInFunctionHoisted()); - `); -}(); - -(function evalHoistingThroughSimpleCatch() { - try { - throw 0; - } catch (f) { - eval(`{ function f() { - return 4; - } }`); - - // assertEquals(0, f); - assertEquals(4, f()); - } - - // assertEquals(4, f()); - assertEquals(undefined, f); -})(); - -// This test is incorrect BUG(v8:5168). The commented assertions are correct. -(function evalHoistingThroughWith() { - with ({f: 0}) { - eval(`{ function f() { - return 4; - } }`); - - assertEquals(0, f); - } - - assertEquals(4, f()); -})(); - -let dontHoistGlobal; -{ function dontHoistGlobal() {} } -assertEquals(undefined, dontHoistGlobal); - -let dontHoistEval; -var throws = false; -try { - eval("{ function dontHoistEval() {} }"); -} catch (e) { - throws = true; -} -assertFalse(throws); - -// When the global object is frozen, silently don't hoist -// Currently this actually throws BUG(v8:4452) -Object.freeze(this); -{ - let throws = false; - try { - eval('{ function hoistWhenFrozen() {} }'); - } catch (e) { - throws = true; - } - assertFalse(this.hasOwnProperty("hoistWhenFrozen")); - assertThrows(() => hoistWhenFrozen, ReferenceError); - // Should be assertFalse BUG(v8:4452) - assertTrue(throws); -} diff --git a/implementation-contributed/v8/mjsunit/es6/unscopables.js b/implementation-contributed/v8/mjsunit/es6/unscopables.js index 782dd2d7a36d800029c367cc78d8bc4c1396207d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/implementation-contributed/v8/mjsunit/es6/unscopables.js +++ b/implementation-contributed/v8/mjsunit/es6/unscopables.js @@ -1,733 +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. - -var global = this; -var globalProto = Object.getPrototypeOf(global); - -// Number of objects being tested. There is an assert ensuring this is correct. -var objectCount = 21; - - -function runTest(f) { - function restore(object, oldProto) { - delete object[Symbol.unscopables]; - delete object.x; - delete object.x_; - delete object.y; - delete object.z; - Object.setPrototypeOf(object, oldProto); - } - - function getObject(i) { - var objects = [ - {}, - [], - function() {}, - function() { - return arguments; - }(), - function() { - 'use strict'; - return arguments; - }(), - Object(1), - Object(true), - Object('bla'), - new Date, - new RegExp, - new Set, - new Map, - new WeakMap, - new WeakSet, - new ArrayBuffer(10), - new Int32Array(5), - Object, - Function, - Date, - RegExp, - global - ]; - - assertEquals(objectCount, objects.length); - return objects[i]; - } - - // Tests depends on this not being there to start with. - delete Array.prototype[Symbol.unscopables]; - - if (f.length === 1) { - for (var i = 0; i < objectCount; i++) { - var object = getObject(i); - var oldObjectProto = Object.getPrototypeOf(object); - f(object); - restore(object, oldObjectProto); - } - } else { - for (var i = 0; i < objectCount; i++) { - for (var j = 0; j < objectCount; j++) { - var object = getObject(i); - var proto = getObject(j); - if (object === proto) { - continue; - } - var oldObjectProto = Object.getPrototypeOf(object); - var oldProtoProto = Object.getPrototypeOf(proto); - f(object, proto); - restore(object, oldObjectProto); - restore(proto, oldProtoProto); - } - } - } -} - -// Test array first, since other tests are changing -// Array.prototype[Symbol.unscopables]. -function TestArrayPrototypeUnscopables() { - var descr = Object.getOwnPropertyDescriptor(Array.prototype, - Symbol.unscopables); - assertFalse(descr.enumerable); - assertFalse(descr.writable); - assertTrue(descr.configurable); - assertEquals(null, Object.getPrototypeOf(descr.value)); - - var copyWithin = 'local copyWithin'; - var entries = 'local entries'; - var fill = 'local fill'; - var find = 'local find'; - var findIndex = 'local findIndex'; - var keys = 'local keys'; - var values = 'local values'; - - var array = []; - array.toString = 42; - - with (array) { - assertEquals('local copyWithin', copyWithin); - assertEquals('local entries', entries); - assertEquals('local fill', fill); - assertEquals('local find', find); - assertEquals('local findIndex', findIndex); - assertEquals('local keys', keys); - assertEquals('local values', values); - assertEquals(42, toString); - } -} -TestArrayPrototypeUnscopables(); - - - -function TestBasics(object) { - var x = 1; - var y = 2; - var z = 3; - object.x = 4; - object.y = 5; - - with (object) { - assertEquals(4, x); - assertEquals(5, y); - assertEquals(3, z); - } - - var truthyValues = [true, 1, 'x', {}, Symbol()]; - for (var truthyValue of truthyValues) { - object[Symbol.unscopables] = {x: truthyValue}; - with (object) { - assertEquals(1, x); - assertEquals(5, y); - assertEquals(3, z); - } - } - - var falsyValues = [false, 0, -0, NaN, '', null, undefined]; - for (var falsyValue of falsyValues) { - object[Symbol.unscopables] = {x: falsyValue, y: true}; - with (object) { - assertEquals(4, x); - assertEquals(2, y); - assertEquals(3, z); - } - } - - for (var xFalsy of falsyValues) { - for (var yFalsy of falsyValues) { - object[Symbol.unscopables] = {x: xFalsy, y: yFalsy}; - with (object) { - assertEquals(4, x); - assertEquals(5, y); - assertEquals(3, z); - } - } - } -} -runTest(TestBasics); - - -function TestUnscopableChain(object) { - var x = 1; - object.x = 2; - - with (object) { - assertEquals(2, x); - } - - object[Symbol.unscopables] = { - __proto__: {x: true} - }; - with (object) { - assertEquals(1, x); - } - - object[Symbol.unscopables] = { - __proto__: {x: undefined} - }; - with (object) { - assertEquals(2, x); - } -} -runTest(TestUnscopableChain); - - -function TestBasicsSet(object) { - var x = 1; - object.x = 2; - - with (object) { - assertEquals(2, x); - } - - object[Symbol.unscopables] = {x: true}; - with (object) { - assertEquals(1, x); - x = 3; - assertEquals(3, x); - } - - assertEquals(3, x); - assertEquals(2, object.x); -} -runTest(TestBasicsSet); - - -function TestOnProto(object, proto) { - var x = 1; - var y = 2; - var z = 3; - proto.x = 4; - - Object.setPrototypeOf(object, proto); - object.y = 5; - - with (object) { - assertEquals(4, x); - assertEquals(5, y); - assertEquals(3, z); - } - - proto[Symbol.unscopables] = {x: true}; - with (object) { - assertEquals(1, x); - assertEquals(5, y); - assertEquals(3, z); - } - - object[Symbol.unscopables] = {y: true}; - with (object) { - assertEquals(4, x); - assertEquals(2, y); - assertEquals(3, z); - } - - proto[Symbol.unscopables] = {y: true}; - object[Symbol.unscopables] = {x: true}; - with (object) { - assertEquals(1, x); - assertEquals(5, y); - assertEquals(3, z); - } - - proto[Symbol.unscopables] = {y: true}; - object[Symbol.unscopables] = {x: true, y: undefined}; - with (object) { - assertEquals(1, x); - assertEquals(5, y); - assertEquals(3, z); - } -} -runTest(TestOnProto); - - -function TestSetBlockedOnProto(object, proto) { - var x = 1; - object.x = 2; - - with (object) { - assertEquals(2, x); - } - - Object.setPrototypeOf(object, proto); - proto[Symbol.unscopables] = {x: true}; - with (object) { - assertEquals(1, x); - x = 3; - assertEquals(3, x); - } - - assertEquals(3, x); - assertEquals(2, object.x); -} -runTest(TestSetBlockedOnProto); - - -function TestNonObject(object) { - var x = 1; - var y = 2; - object.x = 3; - object.y = 4; - - object[Symbol.unscopables] = 'xy'; - with (object) { - assertEquals(3, x); - assertEquals(4, y); - } - - object[Symbol.unscopables] = null; - with (object) { - assertEquals(3, x); - assertEquals(4, y); - } -} -runTest(TestNonObject); - - -function TestChangeDuringWith(object) { - var x = 1; - var y = 2; - object.x = 3; - object.y = 4; - - with (object) { - assertEquals(3, x); - assertEquals(4, y); - object[Symbol.unscopables] = {x: true}; - assertEquals(1, x); - assertEquals(4, y); - } -} -runTest(TestChangeDuringWith); - - -function TestChangeDuringWithWithPossibleOptimization(object) { - var x = 1; - object.x = 2; - with (object) { - for (var i = 0; i < 1000; i++) { - if (i === 500) object[Symbol.unscopables] = {x: true}; - assertEquals(i < 500 ? 2: 1, x); - } - } -} -TestChangeDuringWithWithPossibleOptimization({}); - - -function TestChangeDuringWithWithPossibleOptimization2(object) { - var x = 1; - object.x = 2; - object[Symbol.unscopables] = {x: true}; - with (object) { - for (var i = 0; i < 1000; i++) { - if (i === 500) delete object[Symbol.unscopables]; - assertEquals(i < 500 ? 1 : 2, x); - } - } -} -TestChangeDuringWithWithPossibleOptimization2({}); - - -function TestChangeDuringWithWithPossibleOptimization3(object) { - var x = 1; - object.x = 2; - object[Symbol.unscopables] = {}; - with (object) { - for (var i = 0; i < 1000; i++) { - if (i === 500) object[Symbol.unscopables].x = true; - assertEquals(i < 500 ? 2 : 1, x); - } - } -} -TestChangeDuringWithWithPossibleOptimization3({}); - - -function TestChangeDuringWithWithPossibleOptimization4(object) { - var x = 1; - object.x = 2; - object[Symbol.unscopables] = {x: true}; - with (object) { - for (var i = 0; i < 1000; i++) { - if (i === 500) delete object[Symbol.unscopables].x; - assertEquals(i < 500 ? 1 : 2, x); - } - } -} -TestChangeDuringWithWithPossibleOptimization4({}); - - -function TestChangeDuringWithWithPossibleOptimization4(object) { - var x = 1; - object.x = 2; - object[Symbol.unscopables] = {x: true}; - with (object) { - for (var i = 0; i < 1000; i++) { - if (i === 500) object[Symbol.unscopables].x = undefined; - assertEquals(i < 500 ? 1 : 2, x); - } - } -} -TestChangeDuringWithWithPossibleOptimization4({}); - - -function TestAccessorReceiver(object, proto) { - var x = 'local'; - - Object.defineProperty(proto, 'x', { - get: function() { - assertEquals(object, this); - return this.x_; - }, - configurable: true - }); - proto.x_ = 'proto'; - - Object.setPrototypeOf(object, proto); - proto.x_ = 'object'; - - with (object) { - assertEquals('object', x); - } -} -runTest(TestAccessorReceiver); - - -function TestUnscopablesGetter(object) { - // This test gets really messy when object is the global since the assert - // functions are properties on the global object and the call count gets - // completely different. - if (object === global) return; - - var x = 'local'; - object.x = 'object'; - - var callCount = 0; - Object.defineProperty(object, Symbol.unscopables, { - get: function() { - callCount++; - return {}; - }, - configurable: true - }); - with (object) { - assertEquals('object', x); - } - // Once for HasBinding - assertEquals(1, callCount); - - callCount = 0; - Object.defineProperty(object, Symbol.unscopables, { - get: function() { - callCount++; - return {x: true}; - }, - configurable: true - }); - with (object) { - assertEquals('local', x); - } - // Once for HasBinding - assertEquals(1, callCount); - - callCount = 0; - Object.defineProperty(object, Symbol.unscopables, { - get: function() { - callCount++; - return callCount == 1 ? {} : {x: true}; - }, - configurable: true - }); - with (object) { - x = 1; - } - // Once for HasBinding - assertEquals(1, callCount); - assertEquals(1, object.x); - assertEquals('local', x); - with (object) { - x = 2; - } - // One more HasBinding. - assertEquals(2, callCount); - assertEquals(1, object.x); - assertEquals(2, x); -} -runTest(TestUnscopablesGetter); - - -var global = this; -function TestUnscopablesGetter2() { - var x = 'local'; - - var globalProto = Object.getPrototypeOf(global); - var protos = [{}, [], function() {}, global]; - var objects = [{}, [], function() {}]; - - protos.forEach(function(proto) { - objects.forEach(function(object) { - Object.defineProperty(proto, 'x', { - get: function() { - assertEquals(object, this); - return 'proto'; - }, - configurable: true - }); - - object.__proto__ = proto; - Object.defineProperty(object, 'x', { - get: function() { - assertEquals(object, this); - return 'object'; - }, - configurable: true - }); - - with (object) { - assertEquals('object', x); - } - - object[Symbol.unscopables] = {x: true}; - with (object) { - assertEquals('local', x); - } - - delete proto[Symbol.unscopables]; - delete object[Symbol.unscopables]; - }); - }); - - delete global.x; - Object.setPrototypeOf(global, globalProto); -} -TestUnscopablesGetter2(); - - -function TestSetterOnBlacklisted(object, proto) { - var x = 'local'; - Object.defineProperty(proto, 'x', { - set: function(x) { - assertUnreachable(); - }, - get: function() { - return 'proto'; - }, - configurable: true - }); - Object.setPrototypeOf(object, proto); - Object.defineProperty(object, 'x', { - get: function() { - return this.x_; - }, - set: function(x) { - this.x_ = x; - }, - configurable: true - }); - object.x_ = 1; - - with (object) { - x = 2; - assertEquals(2, x); - } - - assertEquals(2, object.x); - - object[Symbol.unscopables] = {x: true}; - - with (object) { - x = 3; - assertEquals(3, x); - } - - assertEquals(2, object.x); -} -runTest(TestSetterOnBlacklisted); - - -function TestObjectsAsUnscopables(object, unscopables) { - var x = 1; - object.x = 2; - - with (object) { - assertEquals(2, x); - object[Symbol.unscopables] = unscopables; - assertEquals(2, x); - } -} -runTest(TestObjectsAsUnscopables); - - -function TestAccessorOnUnscopables(object) { - var x = 1; - object.x = 2; - - var calls = 0; - var unscopables = { - get x() { - calls++; - return calls === 1 ? true : undefined; - } - }; - - with (object) { - assertEquals(2, x); - object[Symbol.unscopables] = unscopables; - assertEquals(1, x); - assertEquals(2, x); - } - assertEquals(2, calls); -} -runTest(TestAccessorOnUnscopables); - - -function TestLengthUnscopables(object, proto) { - var length = 2; - with (object) { - assertEquals(1, length); - object[Symbol.unscopables] = {length: true}; - assertEquals(2, length); - delete object[Symbol.unscopables]; - assertEquals(1, length); - } -} -TestLengthUnscopables([1], Array.prototype); -TestLengthUnscopables(function(x) {}, Function.prototype); -TestLengthUnscopables(new String('x'), String.prototype); - - -function TestFunctionNameUnscopables(object) { - var name = 'local'; - with (object) { - assertEquals('f', name); - object[Symbol.unscopables] = {name: true}; - assertEquals('local', name); - delete object[Symbol.unscopables]; - assertEquals('f', name); - } -} -TestFunctionNameUnscopables(function f() {}); - - -function TestFunctionPrototypeUnscopables() { - var prototype = 'local'; - var f = function() {}; - var g = function() {}; - Object.setPrototypeOf(f, g); - var fp = f.prototype; - var gp = g.prototype; - with (f) { - assertEquals(fp, prototype); - f[Symbol.unscopables] = {prototype: true}; - assertEquals('local', prototype); - delete f[Symbol.unscopables]; - assertEquals(fp, prototype); - } -} -TestFunctionPrototypeUnscopables(function() {}); - - -function TestFunctionArgumentsUnscopables() { - var func = function() { - var arguments = 'local'; - var args = func.arguments; - with (func) { - assertEquals(args, arguments); - func[Symbol.unscopables] = {arguments: true}; - assertEquals('local', arguments); - delete func[Symbol.unscopables]; - assertEquals(args, arguments); - } - } - func(1); -} -TestFunctionArgumentsUnscopables(); - - -function TestArgumentsLengthUnscopables() { - var func = function() { - var length = 'local'; - with (arguments) { - assertEquals(1, length); - arguments[Symbol.unscopables] = {length: true}; - assertEquals('local', length); - } - } - func(1); -} -TestArgumentsLengthUnscopables(); - - -function TestFunctionCallerUnscopables() { - var func = function() { - var caller = 'local'; - with (func) { - assertEquals(TestFunctionCallerUnscopables, caller); - func[Symbol.unscopables] = {caller: true}; - assertEquals('local', caller); - delete func[Symbol.unscopables]; - assertEquals(TestFunctionCallerUnscopables, caller); - } - } - func(1); -} -TestFunctionCallerUnscopables(); - - -function TestGetUnscopablesGetterThrows() { - var object = { - get x() { - assertUnreachable(); - } - }; - function CustomError() {} - Object.defineProperty(object, Symbol.unscopables, { - get: function() { - throw new CustomError(); - } - }); - assertThrows(function() { - with (object) { - x; - } - }, CustomError); -} -TestGetUnscopablesGetterThrows(); - - -function TestGetUnscopablesGetterThrows2() { - var object = { - get x() { - assertUnreachable(); - } - }; - function CustomError() {} - - object[Symbol.unscopables] = { - get x() { - throw new CustomError(); - } - }; - assertThrows(function() { - with (object) { - x; - } - }, CustomError); -} -TestGetUnscopablesGetterThrows(); diff --git a/implementation-contributed/v8/mjsunit/es8/async-function-stacktrace.js b/implementation-contributed/v8/mjsunit/es8/async-function-stacktrace.js index ab6dd2633b9ac1e50525f72432d5895b3bc893b0..e9358c26791313bec7a5e4f5610c761fb2e24b98 100644 --- a/implementation-contributed/v8/mjsunit/es8/async-function-stacktrace.js +++ b/implementation-contributed/v8/mjsunit/es8/async-function-stacktrace.js @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Flags: --noasync-stack-traces + async function test(func, funcs) { try { await func(); @@ -81,21 +83,19 @@ async function runTests() { try { await reject(); } catch (e) { throw new Error("FAIL"); } } }).c4, ["c4"]); - // TODO(caitp): We should infer anonymous async functions as the empty - // string, not as the name of a function they're passed as a parameter to. await test(async x => { throw new Error("FAIL") }, - ["test", "test", "runTests"]); + ["test", "runTests"]); await test(async() => { throw new Error("FAIL") }, - ["test", "test", "runTests"]); + ["test", "runTests"]); await test(async(a) => { throw new Error("FAIL") }, - ["test", "test", "runTests"]); + ["test", "runTests"]); await test(async(a, b) => { throw new Error("FAIL") }, - ["test", "test", "runTests"]); + ["test", "runTests"]); - await test(async x => { await 1; throw new Error("FAIL") }, ["test"]); - await test(async() => { await 1; throw new Error("FAIL") }, ["test"]); - await test(async(a) => { await 1; throw new Error("FAIL") }, ["test"]); - await test(async(a, b) => { await 1; throw new Error("FAIL") }, ["test"]); + await test(async x => { await 1; throw new Error("FAIL") }, []); + await test(async() => { await 1; throw new Error("FAIL") }, []); + await test(async(a) => { await 1; throw new Error("FAIL") }, []); + await test(async(a, b) => { await 1; throw new Error("FAIL") }, []); await test(async x => { await 1; @@ -104,7 +104,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); await test(async() => { await 1; @@ -113,7 +113,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); await test(async(a) => { await 1; @@ -122,7 +122,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); await test(async(a, b) => { await 1; @@ -131,7 +131,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); await test(async x => { await 1; @@ -140,7 +140,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); await test(async() => { await 1; @@ -149,7 +149,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); await test(async(a) => { await 1; @@ -158,7 +158,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); await test(async(a, b) => { await 1; @@ -167,7 +167,7 @@ async function runTests() { } catch (e) { throw new Error("FAIL"); } - }, ["test"]); + }, []); } runTests().catch(e => { diff --git a/implementation-contributed/v8/mjsunit/modules-namespace1.js b/implementation-contributed/v8/mjsunit/modules-namespace1.js index 9c2ce93504e65ef7ef0194e4e8b5e3280fb45a4a..82b1e528ad33a9ddc13270367e3fda192dd5147e 100644 --- a/implementation-contributed/v8/mjsunit/modules-namespace1.js +++ b/implementation-contributed/v8/mjsunit/modules-namespace1.js @@ -53,9 +53,9 @@ assertEquals( {value: "Module", configurable: false, writable: false, enumerable: false}, Reflect.getOwnPropertyDescriptor(foo, Symbol.toStringTag)); -// Nonexistant properties. -let nonexistant = ["gaga", 123, Symbol('')]; -for (let key of nonexistant) { +// Nonexistent properties. +let nonexistent = ["gaga", 123, Symbol('')]; +for (let key of nonexistent) { assertSame(undefined, Reflect.getOwnPropertyDescriptor(foo, key)); assertTrue(Reflect.deleteProperty(foo, key)); assertFalse(Reflect.set(foo, key, true)); diff --git a/implementation-contributed/v8/mjsunit/object-seal.js b/implementation-contributed/v8/mjsunit/object-seal.js index f685b41927a0e86170bc130c3a9ca1f26ac8a191..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/implementation-contributed/v8/mjsunit/object-seal.js +++ b/implementation-contributed/v8/mjsunit/object-seal.js @@ -1,391 +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. - -// Tests the Object.seal and Object.isSealed methods - ES 19.1.2.17 and -// ES 19.1.2.13 - -// Flags: --allow-natives-syntax --opt --noalways-opt - -// Test that we return obj if non-object is passed as argument -var non_objects = new Array(undefined, null, 1, -1, 0, 42.43, Symbol("test")); -for (var key in non_objects) { - assertSame(non_objects[key], Object.seal(non_objects[key])); -} - -// Test that isFrozen always returns true for non-objects -for (var key in non_objects) { - assertTrue(Object.isSealed(non_objects[key])); -} - -// Test normal data properties. -var obj = { x: 42, z: 'foobar' }; -var desc = Object.getOwnPropertyDescriptor(obj, 'x'); -assertTrue(desc.writable); -assertTrue(desc.configurable); -assertEquals(42, desc.value); - -desc = Object.getOwnPropertyDescriptor(obj, 'z'); -assertTrue(desc.writable); -assertTrue(desc.configurable); -assertEquals('foobar', desc.value); - -assertTrue(Object.isExtensible(obj)); -assertFalse(Object.isSealed(obj)); - -Object.seal(obj); - -// Make sure we are no longer extensible. -assertFalse(Object.isExtensible(obj)); -assertTrue(Object.isSealed(obj)); - -// We should not be frozen, since we are still able to -// update values. -assertFalse(Object.isFrozen(obj)); - -// We should not allow new properties to be added. -obj.foo = 42; -assertEquals(obj.foo, undefined); - -desc = Object.getOwnPropertyDescriptor(obj, 'x'); -assertTrue(desc.writable); -assertFalse(desc.configurable); -assertEquals(42, desc.value); - -desc = Object.getOwnPropertyDescriptor(obj, 'z'); -assertTrue(desc.writable); -assertFalse(desc.configurable); -assertEquals("foobar", desc.value); - -// Since writable is not affected by seal we should still be able to -// update the values. -obj.x = "43"; -assertEquals("43", obj.x); - -// Test on accessors. -var obj2 = {}; -function get() { return 43; }; -function set() {}; -Object.defineProperty(obj2, 'x', { get: get, set: set, configurable: true }); - -desc = Object.getOwnPropertyDescriptor(obj2, 'x'); -assertTrue(desc.configurable); -assertEquals(undefined, desc.value); -assertEquals(set, desc.set); -assertEquals(get, desc.get); - -assertTrue(Object.isExtensible(obj2)); -assertFalse(Object.isSealed(obj2)); -Object.seal(obj2); - -// Since this is an accessor property the object is now effectively both -// sealed and frozen (accessors has no writable attribute). -assertTrue(Object.isFrozen(obj2)); -assertFalse(Object.isExtensible(obj2)); -assertTrue(Object.isSealed(obj2)); - -desc = Object.getOwnPropertyDescriptor(obj2, 'x'); -assertFalse(desc.configurable); -assertEquals(undefined, desc.value); -assertEquals(set, desc.set); -assertEquals(get, desc.get); - -obj2.foo = 42; -assertEquals(obj2.foo, undefined); - -// Test seal on arrays. -var arr = new Array(42,43); - -desc = Object.getOwnPropertyDescriptor(arr, '0'); -assertTrue(desc.configurable); -assertTrue(desc.writable); -assertEquals(42, desc.value); - -desc = Object.getOwnPropertyDescriptor(arr, '1'); -assertTrue(desc.configurable); -assertTrue(desc.writable); -assertEquals(43, desc.value); - -assertTrue(Object.isExtensible(arr)); -assertFalse(Object.isSealed(arr)); -Object.seal(arr); -assertTrue(Object.isSealed(arr)); -assertFalse(Object.isExtensible(arr)); -// Since the values in the array is still writable this object -// is not frozen. -assertFalse(Object.isFrozen(arr)); - -desc = Object.getOwnPropertyDescriptor(arr, '0'); -assertFalse(desc.configurable); -assertTrue(desc.writable); -assertEquals(42, desc.value); - -desc = Object.getOwnPropertyDescriptor(arr, '1'); -assertFalse(desc.configurable); -assertTrue(desc.writable); -assertEquals(43, desc.value); - -arr[0] = 'foo'; - -// We should be able to overwrite the existing value. -assertEquals('foo', arr[0]); - - -// Test that isSealed returns the correct value even if configurable -// has been set to false on all properties manually and the extensible -// flag has also been set to false manually. -var obj3 = { x: 42, y: 'foo' }; - -assertFalse(Object.isFrozen(obj3)); - -Object.defineProperty(obj3, 'x', {configurable: false, writable: true}); -Object.defineProperty(obj3, 'y', {configurable: false, writable: false}); -Object.preventExtensions(obj3); - -assertTrue(Object.isSealed(obj3)); - - -// Make sure that an object that has a configurable property -// is not classified as sealed. -var obj4 = {}; -Object.defineProperty(obj4, 'x', {configurable: true, writable: false}); -Object.defineProperty(obj4, 'y', {configurable: false, writable: false}); -Object.preventExtensions(obj4); - -assertFalse(Object.isSealed(obj4)); - -// Make sure that Object.seal returns the sealed object. -var obj4 = {}; -assertTrue(obj4 === Object.seal(obj4)); - -// -// Test that built-in array functions can't modify a sealed array. -// -obj = [1, 2, 3]; -var objControl = [4, 5, 6]; - -// Allow these functions to set up monomorphic calls, using custom built-ins. -var push_call = function(a) { a.push(10); return a; } -var pop_call = function(a) { return a.pop(); } -for (var i = 0; i < 3; i++) { - push_call(obj); - pop_call(obj); -} - -Object.seal(obj); -assertThrows(function() { push_call(obj); }, TypeError); -assertThrows(function() { pop_call(obj); }, TypeError); - -// But the control object is fine at these sites. -assertDoesNotThrow(function() { push_call(objControl); }); -assertDoesNotThrow(function() { pop_call(objControl); }); - -assertDoesNotThrow(function() { obj.push(); }); -assertThrows(function() { obj.push(3); }, TypeError); -assertThrows(function() { obj.pop(); }, TypeError); -assertThrows(function() { obj.shift(3); }, TypeError); -assertDoesNotThrow(function() { obj.unshift(); }); -assertThrows(function() { obj.unshift(1); }, TypeError); -assertThrows(function() { obj.splice(0, 0, 100, 101, 102); }, TypeError); -assertDoesNotThrow(function() { obj.splice(0,0); }); - -assertDoesNotThrow(function() { objControl.push(3); }); -assertDoesNotThrow(function() { objControl.pop(); }); -assertDoesNotThrow(function() { objControl.shift(3); }); -assertDoesNotThrow(function() { objControl.unshift(); }); -assertDoesNotThrow(function() { objControl.splice(0, 0, 100, 101, 102); }); - -// Verify that crankshaft still does the right thing. -obj = [1, 2, 3]; - -push_call = function(a) { a.push(1000); return a; } -// Include a call site that doesn't have a custom built-in. -var shift_call = function(a) { a.shift(1000); return a; } -for (var i = 0; i < 3; i++) { - push_call(obj); - shift_call(obj); -} - -%OptimizeFunctionOnNextCall(push_call); -%OptimizeFunctionOnNextCall(shift_call); -push_call(obj); -shift_call(obj); -assertOptimized(push_call); -assertOptimized(shift_call); -Object.seal(obj); -assertThrows(function() { push_call(obj); }, TypeError); -assertThrows(function() { shift_call(obj); }, TypeError); -assertUnoptimized(push_call); -assertUnoptimized(shift_call); -assertDoesNotThrow(function() { push_call(objControl); }); -assertDoesNotThrow(function() { shift_call(objControl); }); - -// Verify special behavior of splice on sealed objects. -obj = [1,2,3]; -Object.seal(obj); -assertDoesNotThrow(function() { obj.splice(0,1,100); }); -assertEquals(100, obj[0]); -assertDoesNotThrow(function() { obj.splice(0,2,1,2); }); -assertDoesNotThrow(function() { obj.splice(1,2,1,2); }); -// Count of items to delete is clamped by length. -assertDoesNotThrow(function() { obj.splice(1,2000,1,2); }); -assertThrows(function() { obj.splice(0,0,1); }, TypeError); -assertThrows(function() { obj.splice(1,2000,1,2,3); }, TypeError); - -// Test that the enumerable attribute is unperturbed by sealing. -obj = { x: 42, y: 'foo' }; -Object.defineProperty(obj, 'y', {enumerable: false}); -Object.seal(obj); -assertTrue(Object.isSealed(obj)); -assertFalse(Object.isFrozen(obj)); -desc = Object.getOwnPropertyDescriptor(obj, 'x'); -assertTrue(desc.enumerable); -desc = Object.getOwnPropertyDescriptor(obj, 'y'); -assertFalse(desc.enumerable); - -// Fast properties should remain fast -obj = { x: 42, y: 'foo' }; -assertTrue(%HasFastProperties(obj)); -Object.seal(obj); -assertTrue(Object.isSealed(obj)); -assertFalse(Object.isFrozen(obj)); -assertTrue(%HasFastProperties(obj)); - -// Sealed objects should share maps where possible -obj = { prop1: 1, prop2: 2 }; -obj2 = { prop1: 3, prop2: 4 }; -assertTrue(%HaveSameMap(obj, obj2)); -Object.seal(obj); -Object.seal(obj2); -assertTrue(Object.isSealed(obj)); -assertTrue(Object.isSealed(obj2)); -assertFalse(Object.isFrozen(obj)); -assertFalse(Object.isFrozen(obj2)); -assertTrue(%HaveSameMap(obj, obj2)); - -// Sealed objects should share maps even when they have elements -obj = { prop1: 1, prop2: 2, 75: 'foo' }; -obj2 = { prop1: 3, prop2: 4, 150: 'bar' }; -assertTrue(%HaveSameMap(obj, obj2)); -Object.seal(obj); -Object.seal(obj2); -assertTrue(Object.isSealed(obj)); -assertTrue(Object.isSealed(obj2)); -assertFalse(Object.isFrozen(obj)); -assertFalse(Object.isFrozen(obj)); -assertTrue(%HaveSameMap(obj, obj2)); - -// Setting elements after sealing should not be allowed -obj = { prop: 'thing' }; -Object.seal(obj); -assertTrue(Object.isSealed(obj)); -assertFalse(Object.isFrozen(obj)); -obj[0] = 'hello'; -assertFalse(obj.hasOwnProperty(0)); - -// Sealing an object in dictionary mode should work -// Also testing that getter/setter properties work after sealing -obj = { }; -for (var i = 0; i < 100; ++i) { - obj['x' + i] = i; -} -var accessorDidRun = false; -Object.defineProperty(obj, 'accessor', { - get: function() { return 42 }, - set: function() { accessorDidRun = true }, - configurable: true, - enumerable: true -}); - -assertFalse(%HasFastProperties(obj)); -Object.seal(obj); -assertFalse(%HasFastProperties(obj)); -assertTrue(Object.isSealed(obj)); -assertFalse(Object.isFrozen(obj)); -assertFalse(Object.isExtensible(obj)); -for (var i = 0; i < 100; ++i) { - desc = Object.getOwnPropertyDescriptor(obj, 'x' + i); - assertFalse(desc.configurable); -} -assertEquals(42, obj.accessor); -assertFalse(accessorDidRun); -obj.accessor = 'ignored value'; -assertTrue(accessorDidRun); - -// Sealing arguments should work -var func = function(arg) { - Object.seal(arguments); - assertTrue(Object.isSealed(arguments)); -}; -func('hello', 'world'); -func('goodbye', 'world'); - -// Sealing sparse arrays -var sparseArr = [0, 1]; -sparseArr[10000] = 10000; -Object.seal(sparseArr); -assertTrue(Object.isSealed(sparseArr)); - -// Accessors on fast object should behavior properly after sealing -obj = {}; -Object.defineProperty(obj, 'accessor', { - get: function() { return 42 }, - set: function() { accessorDidRun = true }, - configurable: true, - enumerable: true -}); -assertTrue(%HasFastProperties(obj)); -Object.seal(obj); -assertTrue(Object.isSealed(obj)); -assertTrue(%HasFastProperties(obj)); -assertEquals(42, obj.accessor); -accessorDidRun = false; -obj.accessor = 'ignored value'; -assertTrue(accessorDidRun); - -// Test for regression in mixed accessor/data property objects. -// The strict function is one such object. -assertTrue(Object.isSealed(Object.seal(function(){"use strict";}))); - -// Also test a simpler case -obj = {}; -Object.defineProperty(obj, 'accessor2', { - get: function() { return 42 }, - set: function() { accessorDidRun = true }, - configurable: true, - enumerable: true -}); -obj.data = 'foo'; -assertTrue(%HasFastProperties(obj)); -Object.seal(obj); -assertTrue(%HasFastProperties(obj)); -assertTrue(Object.isSealed(obj)); - -function Sealed() {} -Object.seal(Sealed); -assertDoesNotThrow(function() { return new Sealed(); }); -Sealed.prototype.prototypeExists = true; -assertTrue((new Sealed()).prototypeExists); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-408036.js b/implementation-contributed/v8/mjsunit/regress/regress-408036.js deleted file mode 100644 index a4dfade25d1dbc4f24f69cb2a12f69b5818b9cba..0000000000000000000000000000000000000000 --- a/implementation-contributed/v8/mjsunit/regress/regress-408036.js +++ /dev/null @@ -1,5 +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: --expose-natives-as 1 diff --git a/implementation-contributed/v8/mjsunit/regress/regress-6288.js b/implementation-contributed/v8/mjsunit/regress/regress-6288.js index 96499d9378f85c5f92e22fbd814a7f9083626e88..5f550c31c8b72d021fcc1148a5c738c0e0d0dd4b 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-6288.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-6288.js @@ -4,7 +4,10 @@ // Environment Variables: LC_ALL=pt-BR.UTF8 +// The data files packaged with d8 currently have Brazillian Portuguese +// DateTimeFormat but not Collation + if (this.Intl) { - assertEquals('pt-BR', Intl.Collator().resolvedOptions().locale); + assertEquals('pt', Intl.Collator().resolvedOptions().locale); assertEquals('pt-BR', Intl.DateTimeFormat().resolvedOptions().locale); } diff --git a/implementation-contributed/v8/mjsunit/regress/regress-897512.js b/implementation-contributed/v8/mjsunit/regress/regress-897512.js index 0e676a06c2a6d6f02fd42b8bb0f4852bc29a3426..649ee2b922d1b8d80ca21fbac6c912553acc89aa 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-897512.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-897512.js @@ -20,5 +20,4 @@ assertEquals(o51.length, 39); // Sort triggers the bug. o51.sort(); -// TODO(chromium:897512): The length should be 39. -assertEquals(o51.length, 101); +assertEquals(o51.length, 39); diff --git a/implementation-contributed/v8/mjsunit/regress/regress-crbug-860788.js b/implementation-contributed/v8/mjsunit/regress/regress-crbug-860788.js index 55d243eac6265475a92a92b9d4336e70fe5e7f97..fe0dcb83af9e2257b05bad2c2e6cb948f55558b4 100644 --- a/implementation-contributed/v8/mjsunit/regress/regress-crbug-860788.js +++ b/implementation-contributed/v8/mjsunit/regress/regress-crbug-860788.js @@ -26,5 +26,5 @@ try { } catch(e) { print("Caught: " + e); } try { var obj = {prop: 7}; - assertThrows("nonexistant(obj)"); + assertThrows("nonexistent(obj)"); } catch(e) { print("Caught: " + e); } diff --git a/implementation-contributed/v8/mjsunit/testcfg.py b/implementation-contributed/v8/mjsunit/testcfg.py index 422210365e4eebb2d067bcca3dd443f5fa81fd33..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/implementation-contributed/v8/mjsunit/testcfg.py +++ b/implementation-contributed/v8/mjsunit/testcfg.py @@ -1,308 +0,0 @@ -# Copyright 2008 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. - -from collections import OrderedDict -import itertools -import os -import re - -from testrunner.local import statusfile -from testrunner.local import testsuite -from testrunner.objects import testcase -from testrunner.outproc import base as outproc - -FILES_PATTERN = re.compile(r"//\s+Files:(.*)") -ENV_PATTERN = re.compile(r"//\s+Environment Variables:(.*)") -SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") -MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) -NO_HARNESS_PATTERN = re.compile(r"^// NO HARNESS$", flags=re.MULTILINE) - - -# Flags known to misbehave when combining arbitrary mjsunit tests. Can also -# be compiled regular expressions. -COMBINE_TESTS_FLAGS_BLACKLIST = [ - '--check-handle-count', - '--enable-tracing', - re.compile('--experimental.*'), - '--expose-trigger-failure', - re.compile('--harmony.*'), - '--mock-arraybuffer-allocator', - '--print-ast', - re.compile('--trace.*'), - '--wasm-lazy-compilation', -] - -class TestSuite(testsuite.TestSuite): - def ListTests(self): - tests = [] - for dirname, dirs, files in os.walk(self.root, followlinks=True): - for dotted in [x for x in dirs if x.startswith('.')]: - dirs.remove(dotted) - dirs.sort() - files.sort() - for filename in files: - if (filename.endswith(".js") and - filename != "mjsunit.js" and - filename != "mjsunit_suppressions.js"): - fullpath = os.path.join(dirname, filename) - relpath = fullpath[len(self.root) + 1 : -3] - testname = relpath.replace(os.path.sep, "/") - test = self._create_test(testname) - tests.append(test) - return tests - - def _test_combiner_class(self): - return TestCombiner - - def _test_class(self): - return TestCase - - def _suppressed_test_class(self): - return SuppressedTestCase - - -class TestCase(testcase.D8TestCase): - def __init__(self, *args, **kwargs): - super(TestCase, self).__init__(*args, **kwargs) - - source = self.get_source() - - files_list = [] # List of file names to append to command arguments. - files_match = FILES_PATTERN.search(source); - # Accept several lines of 'Files:'. - while True: - if files_match: - files_list += files_match.group(1).strip().split() - files_match = FILES_PATTERN.search(source, files_match.end()) - else: - break - files = [ os.path.normpath(os.path.join(self.suite.root, '..', '..', f)) - for f in files_list ] - testfilename = os.path.join(self.suite.root, - self.path + self._get_suffix()) - if SELF_SCRIPT_PATTERN.search(source): - files = ( - ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] + - files) - - if NO_HARNESS_PATTERN.search(source): - mjsunit_files = [] - else: - mjsunit_files = [os.path.join(self.suite.root, "mjsunit.js")] - - files_suffix = [] - if MODULE_PATTERN.search(source): - files_suffix.append("--module") - files_suffix.append(testfilename) - - self._source_files = files - self._source_flags = self._parse_source_flags(source) - self._mjsunit_files = mjsunit_files - self._files_suffix = files_suffix - self._env = self._parse_source_env(source) - - def _parse_source_env(self, source): - env_match = ENV_PATTERN.search(source) - env = {} - if env_match: - for env_pair in env_match.group(1).strip().split(): - var, value = env_pair.split('=') - env[var] = value - return env - - def _get_source_flags(self): - return self._source_flags - - def _get_files_params(self): - files = list(self._source_files) - if not self._test_config.no_harness: - files += self._mjsunit_files - files += self._files_suffix - if self._test_config.isolates: - files += ['--isolate'] + files - - return files - - def _get_cmd_env(self): - return self._env - - def _get_source_path(self): - return os.path.join(self.suite.root, self.path + self._get_suffix()) - - -class TestCombiner(testsuite.TestCombiner): - def get_group_key(self, test): - """Combine tests with the same set of flags. - Ignore: - 1. Some special cases where it's not obvious what to pass in the command. - 2. Tests with flags that can cause failure even inside try-catch wrapper. - 3. Tests that use async functions. Async functions can be scheduled after - exiting from try-catch wrapper and cause failure. - """ - if (len(test._files_suffix) > 1 or - test._env or - not test._mjsunit_files or - test._source_files): - return None - - source_flags = test._get_source_flags() - if ('--expose-trigger-failure' in source_flags or - '--throws' in source_flags): - return None - - source_code = test.get_source() - # Maybe we could just update the tests to await all async functions they - # call? - if 'async' in source_code: - return None - - # TODO(machenbach): Remove grouping if combining tests in a flag-independent - # way works well. - return 1 - - def _combined_test_class(self): - return CombinedTest - - -class CombinedTest(testcase.D8TestCase): - """Behaves like normal mjsunit tests except: - 1. Expected outcome is always PASS - 2. Instead of one file there is a try-catch wrapper with all combined tests - passed as arguments. - """ - def __init__(self, name, tests): - super(CombinedTest, self).__init__(tests[0].suite, '', name, - tests[0]._test_config) - self._tests = tests - - def _prepare_outcomes(self, force_update=True): - self._statusfile_outcomes = outproc.OUTCOMES_PASS_OR_TIMEOUT - self.expected_outcomes = outproc.OUTCOMES_PASS_OR_TIMEOUT - - def _get_shell_flags(self): - """In addition to standard set of shell flags it appends: - --disable-abortjs: %AbortJS can abort the test even inside - trycatch-wrapper, so we disable it. - --es-staging: We blacklist all harmony flags due to false positives, - but always pass the staging flag to cover the mature features. - --omit-quit: Calling quit() in JS would otherwise early terminate. - --quiet-load: suppress any stdout from load() function used by - trycatch-wrapper. - """ - return [ - '--test', - '--disable-abortjs', - '--es-staging', - '--omit-quit', - '--quiet-load', - ] - - def _get_cmd_params(self): - return ( - super(CombinedTest, self)._get_cmd_params() + - ['tools/testrunner/trycatch_loader.js', '--'] + - self._tests[0]._mjsunit_files + - ['--'] + - [t._files_suffix[0] for t in self._tests] - ) - - def _merge_flags(self, flags): - """Merges flags from a list of flags. - - Flag values not starting with '-' are merged with the preceeding flag, - e.g. --foo 1 will become --foo=1. All other flags remain the same. - - Returns: A generator of flags. - """ - if not flags: - return - # Iterate over flag pairs. ['-'] is a sentinel value for the last iteration. - for flag1, flag2 in itertools.izip(flags, flags[1:] + ['-']): - if not flag2.startswith('-'): - assert '=' not in flag1 - yield flag1 + '=' + flag2 - elif flag1.startswith('-'): - yield flag1 - - def _is_flag_blacklisted(self, flag): - for item in COMBINE_TESTS_FLAGS_BLACKLIST: - if isinstance(item, basestring): - if item == flag: - return True - elif item.match(flag): - return True - return False - - def _get_combined_flags(self, flags_gen): - """Combines all flags - dedupes, keeps order and filters some flags. - - Args: - flags_gen: Generator for flag lists. - Returns: A list of flags. - """ - merged_flags = self._merge_flags(list(itertools.chain(*flags_gen))) - unique_flags = OrderedDict((flag, True) for flag in merged_flags).keys() - return [ - flag for flag in unique_flags - if not self._is_flag_blacklisted(flag) - ] - - def _get_source_flags(self): - # Combine flags from all source files. - return self._get_combined_flags( - test._get_source_flags() for test in self._tests) - - def _get_statusfile_flags(self): - # Combine flags from all status file entries. - return self._get_combined_flags( - test._get_statusfile_flags() for test in self._tests) - - -class SuppressedTestCase(TestCase): - """The same as a standard mjsunit test case with all asserts as no-ops.""" - def __init__(self, *args, **kwargs): - super(SuppressedTestCase, self).__init__(*args, **kwargs) - self._mjsunit_files.append( - os.path.join(self.suite.root, "mjsunit_suppressions.js")) - - def _prepare_outcomes(self, *args, **kwargs): - super(SuppressedTestCase, self)._prepare_outcomes(*args, **kwargs) - # Skip tests expected to fail. We suppress all asserts anyways, but some - # tests are expected to fail with type errors or even dchecks, and we - # can't differentiate that. - if statusfile.FAIL in self._statusfile_outcomes: - self._statusfile_outcomes = [statusfile.SKIP] - - def _get_extra_flags(self, *args, **kwargs): - return ( - super(SuppressedTestCase, self)._get_extra_flags(*args, **kwargs) + - ['--disable-abortjs'] - ) - - -def GetSuite(*args, **kwargs): - return TestSuite(*args, **kwargs) diff --git a/implementation-contributed/v8/wasm-js/wasm-js.status b/implementation-contributed/v8/wasm-js/wasm-js.status index 4593a73c6e720fa7d290fb96a93243cfcbfbfc5f..856a50aed0ec8db9ad314a940deb04e2cc05c076 100644 --- a/implementation-contributed/v8/wasm-js/wasm-js.status +++ b/implementation-contributed/v8/wasm-js/wasm-js.status @@ -9,8 +9,11 @@ 'table/grow': [FAIL], 'table/get-set': [FAIL], 'module/customSections': [FAIL], - 'global/constructor': [FAIL], - 'global/value-get-set': [FAIL], +}], # ALWAYS + +[ALWAYS, { + # https://bugs.chromium.org/p/v8/issues/detail?id=8633 + 'limits': [SKIP], }], # ALWAYS ['arch == s390 or arch == s390x or system == aix', { @@ -18,4 +21,10 @@ '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 + ]