diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:39:11 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:46:25 +0100 |
commit | 6ca81ad72a3c6fdf16c683335be748f22aaa9a0d (patch) | |
tree | 33c8ee75f729aed76c2c0b89c63f9bf1b4dd66aa /deps/v8/test/mjsunit | |
parent | 1eee0b8bf8bba39b600fb16a9223e545e3bac2bc (diff) | |
download | node-new-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.gz |
deps: update V8 to 7.9.317.20
PR-URL: https://github.com/nodejs/node/pull/30020
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/test/mjsunit')
281 files changed, 4280 insertions, 1238 deletions
diff --git a/deps/v8/test/mjsunit/asm/regress-1013920.js b/deps/v8/test/mjsunit/asm/regress-1013920.js new file mode 100644 index 0000000000..f7a2e57d1d --- /dev/null +++ b/deps/v8/test/mjsunit/asm/regress-1013920.js @@ -0,0 +1,17 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function asm(stdlib, foreign, heap) { + "use asm"; + var heap32 = new stdlib.Uint32Array(heap); + function f() { return 0; } + return {f : f}; +} + +var heap = Reflect.construct( + SharedArrayBuffer, + [1024 * 1024], + ArrayBuffer.prototype.constructor); + +asm(this, {}, heap); diff --git a/deps/v8/test/mjsunit/bit-not.js b/deps/v8/test/mjsunit/bit-not.js index d0316a71ea..4ef1b7c2e3 100644 --- a/deps/v8/test/mjsunit/bit-not.js +++ b/deps/v8/test/mjsunit/bit-not.js @@ -62,16 +62,3 @@ testBitNot(0x80000000 - 0.12345, "float6"); testBitNot("0", "string0"); testBitNot("2.3", "string2.3"); testBitNot("-9.4", "string-9.4"); - - -// Try to test that we can deal with allocation failures in -// the fast path and just use the slow path instead. -function TryToGC() { - var x = 0x40000000; - // Put in an eval to foil Crankshaft. - eval(""); - for (var i = 0; i < 1000000; i++) { - assertEquals(~0x40000000, ~x); - } -} -TryToGC(); diff --git a/deps/v8/test/mjsunit/code-coverage-block-async.js b/deps/v8/test/mjsunit/code-coverage-block-async.js new file mode 100644 index 0000000000..111be213b6 --- /dev/null +++ b/deps/v8/test/mjsunit/code-coverage-block-async.js @@ -0,0 +1,122 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-always-opt --no-stress-flush-bytecode +// Flags: --no-stress-incremental-marking +// Files: test/mjsunit/code-coverage-utils.js + +%DebugToggleBlockCoverage(true); + +TestCoverage( +"await expressions", +` +async function f() { // 0000 + await 42; // 0050 + await 42; // 0100 +}; // 0150 +f(); // 0200 +%PerformMicrotaskCheckpoint(); // 0250 +`, +[{"start":0,"end":299,"count":1}, + {"start":0,"end":151,"count":1}] +); + +TestCoverage( +"for-await-of statements", +` +!async function() { // 0000 + for await (var x of [0,1,2,3]) { // 0050 + nop(); // 0100 + } // 0150 +}(); // 0200 +%PerformMicrotaskCheckpoint(); // 0250 +`, +[{"start":0,"end":299,"count":1}, + {"start":1,"end":201,"count":1}, + {"start":83,"end":153,"count":4}] +); + +TestCoverage( +"https://crbug.com/981313", +` +class Foo { // 0000 + async timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + } // 0200 +} // 0000 +new Foo().timeout(); // 0300 +`, +[ {"start":0, "end":349, "count":1}, + {"start":52, "end":203, "count":1}, + {"start":158,"end":182, "count":1}]); + +TestCoverage( + "test async generator coverage", +` +class Foo { // 0000 + async *timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + } // 0200 +} // 0000 +new Foo().timeout(); // 0300 +`, + [ {"start":0, "end":349, "count":1}, + {"start":52, "end":203, "count":1}, + {"start":158,"end":182, "count":0}]); + +TestCoverage( + "test async generator coverage with next call", +` +class Foo { // 0000 + async *timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + } // 0200 +} // 0000 +new Foo().timeout().next(); // 0300 +`, + [ {"start":0, "end":349, "count":1}, + {"start":52, "end":203, "count":1}, + {"start":158,"end":182, "count":1}]); + +TestCoverage( + "test two consecutive returns", +` +class Foo { // 0000 + timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + return new Promise( // 0200 + (r) => setTimeout(r, 10)); // 0000 + } // 0300 +} // 0000 +new Foo().timeout(); // 0400 +`, +[ {"start":0,"end":449,"count":1}, + {"start":52,"end":303,"count":1}, + {"start":184,"end":302,"count":0}, + {"start":158,"end":182,"count":1}] ); + + +TestCoverage( + "test async generator with two consecutive returns", +` +class Foo { // 0000 + async *timeout() { // 0000 + return new Promise( // 0100 + (r) => setTimeout(r, 10)); // 0000 + return new Promise( // 0200 + (r) => setTimeout(r, 10)); // 0000 + } // 0300 +} // 0000 +new Foo().timeout().next(); // 0400 +`, +[ {"start":0,"end":449,"count":1}, + {"start":52,"end":303,"count":1}, + {"start":184,"end":302,"count":0}, + {"start":158,"end":182,"count":1}] ); + +%DebugToggleBlockCoverage(false); diff --git a/deps/v8/test/mjsunit/code-coverage-block.js b/deps/v8/test/mjsunit/code-coverage-block.js index a7bad5bf11..6cf81bcce0 100644 --- a/deps/v8/test/mjsunit/code-coverage-block.js +++ b/deps/v8/test/mjsunit/code-coverage-block.js @@ -206,21 +206,6 @@ TestCoverage( ); TestCoverage( -"for-await-of statements", -` -!async function() { // 0000 - for await (var x of [0,1,2,3]) { // 0050 - nop(); // 0100 - } // 0150 -}(); // 0200 -%PerformMicrotaskCheckpoint(); // 0250 -`, -[{"start":0,"end":299,"count":1}, - {"start":1,"end":201,"count":1}, - {"start":83,"end":153,"count":4}] -); - -TestCoverage( "while and do-while statements", ` function g() {} // 0000 @@ -659,20 +644,6 @@ try { // 0200 ); TestCoverage( -"await expressions", -` -async function f() { // 0000 - await 42; // 0050 - await 42; // 0100 -}; // 0150 -f(); // 0200 -%PerformMicrotaskCheckpoint(); // 0250 -`, -[{"start":0,"end":299,"count":1}, - {"start":0,"end":151,"count":1}] -); - -TestCoverage( "LogicalOrExpression assignment", ` const a = true || 99 // 0000 @@ -1097,4 +1068,19 @@ f(43); // 0450 {"start":204,"end":226,"count":1}] ); +TestCoverage( +"https://crbug.com/v8/9857", +`function foo() {}`, +[{"start":0,"end":17,"count":1}, + {"start":0,"end":17,"count":0}] +); + +TestCoverage( +"https://crbug.com/v8/9857", +`function foo() {function bar() {}}; foo()`, +[{"start":0,"end":41,"count":1}, + {"start":0,"end":34,"count":1}, + {"start":16,"end":33,"count":0}] +); + %DebugToggleBlockCoverage(false); diff --git a/deps/v8/test/mjsunit/compiler/concurrent-inlining-1.js b/deps/v8/test/mjsunit/compiler/concurrent-inlining-1.js new file mode 100644 index 0000000000..9cbdbc863f --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/concurrent-inlining-1.js @@ -0,0 +1,26 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// This test ensures that we manage to serialize the global.gaga function for +// compilation and therefore are able to inline it. Since the call feedback in +// bar is megamorphic, this relies on recording the correct accumulator hint for +// the named load of obj.gaga while serializing bar (in turn while serializing +// foo). + +const global = this; +global.gaga = function gaga() { return true; }; + +function bar(obj) { return obj.gaga(); }; +function foo() { return %TurbofanStaticAssert(bar(global)); } + +%PrepareFunctionForOptimization(foo); +%PrepareFunctionForOptimization(bar); +%PrepareFunctionForOptimization(global.gaga); + +bar({gaga() {}}); +foo(); +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/mjsunit/compiler/concurrent-inlining-2.js b/deps/v8/test/mjsunit/compiler/concurrent-inlining-2.js new file mode 100644 index 0000000000..e3e63d195c --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/concurrent-inlining-2.js @@ -0,0 +1,26 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// This test ensures that we manage to serialize the global.gaga function for +// compilation and therefore are able to inline it. Since the call feedback in +// bar is megamorphic, this relies on recording the correct accumulator hint for +// the named load of obj.gaga while serializing bar (in turn while serializing +// foo). + +const global = this; +global.gaga = function gaga() { return true; }; + +function bar(obj) { return obj.gaga(); } +function foo(obj) { obj.gaga; %TurbofanStaticAssert(bar(obj)); } + +%PrepareFunctionForOptimization(foo); +%PrepareFunctionForOptimization(bar); +%PrepareFunctionForOptimization(global.gaga); + +bar({gaga() {}}); +foo(global); +%OptimizeFunctionOnNextCall(foo); +foo(global); diff --git a/deps/v8/test/mjsunit/compiler/promise-constructor.js b/deps/v8/test/mjsunit/compiler/promise-constructor.js index ab2d720755..27deeda9d5 100644 --- a/deps/v8/test/mjsunit/compiler/promise-constructor.js +++ b/deps/v8/test/mjsunit/compiler/promise-constructor.js @@ -2,7 +2,7 @@ // 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-inline-promise-constructor +// Flags: --allow-natives-syntax // We have to patch mjsunit because normal assertion failures just throw // exceptions which are swallowed in a then clause. diff --git a/deps/v8/test/mjsunit/compiler/regress-9017.js b/deps/v8/test/mjsunit/compiler/regress-9017.js index 7cbd4e0178..c484e177c6 100644 --- a/deps/v8/test/mjsunit/compiler/regress-9017.js +++ b/deps/v8/test/mjsunit/compiler/regress-9017.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --noturbo-inlining --noturbo-verify-allocation +// This test invokes optimization manually, no need for stress modes: +// Flags: --nostress-opt --noalways-opt // Ensure that very large stack frames can be used successfully. // The flag --noturbo-verify-allocation is to make this run a little faster; it diff --git a/deps/v8/test/mjsunit/d8/d8-performance-measure-memory.js b/deps/v8/test/mjsunit/d8/d8-performance-measure-memory.js new file mode 100644 index 0000000000..baf6479fff --- /dev/null +++ b/deps/v8/test/mjsunit/d8/d8-performance-measure-memory.js @@ -0,0 +1,47 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test the performance.measureMemory() function of d8. This test only makes +// sense with d8. + +load('test/mjsunit/mjsunit.js'); + +function assertLessThanOrEqual(a, b) { + assertTrue(a <= b, `Expected ${a} <= ${b}`); +} + +function checkMeasureMemoryResult(result) { + assertTrue('total' in result); + assertTrue('jsMemoryEstimate' in result.total); + assertTrue('jsMemoryRange' in result.total); + assertEquals('number', typeof result.total.jsMemoryEstimate); + assertEquals(2, result.total.jsMemoryRange.length); + assertEquals('number', typeof result.total.jsMemoryRange[0]); + assertEquals('number', typeof result.total.jsMemoryRange[1]); + assertLessThanOrEqual(result.total.jsMemoryRange[0], + result.total.jsMemoryRange[1]); + assertLessThanOrEqual(result.total.jsMemoryRange[0], + result.total.jsMemoryEstimate); + assertLessThanOrEqual(result.total.jsMemoryEstimate, + result.total.jsMemoryRange[1]); +} + +if (this.performance && performance.measureMemory) { + assertPromiseResult((async () => { + let result = await performance.measureMemory(); + checkMeasureMemoryResult(result); + })()); + + assertPromiseResult((async () => { + let result = await performance.measureMemory({detailed: false}); + checkMeasureMemoryResult(result); + })()); + + assertPromiseResult((async () => { + let result = await performance.measureMemory({detailed: true}); + // TODO(ulan): Also check the detailed results once measureMemory + // supports them. + checkMeasureMemoryResult(result); + })()); +} diff --git a/deps/v8/test/mjsunit/es6/array-iterator-detached.js b/deps/v8/test/mjsunit/es6/array-iterator-detached.js index f385039b4d..4e4f664373 100644 --- a/deps/v8/test/mjsunit/es6/array-iterator-detached.js +++ b/deps/v8/test/mjsunit/es6/array-iterator-detached.js @@ -17,7 +17,7 @@ function Baseline() { %NeverOptimizeFunction(Baseline); assertThrows(Baseline, TypeError, - "Cannot perform Array Iterator.prototype.next on a neutered ArrayBuffer"); + "Cannot perform Array Iterator.prototype.next on a detached ArrayBuffer"); function Turbo(count = 10000) { let array = Array(10000); @@ -45,4 +45,4 @@ Turbo(10); %OptimizeFunctionOnNextCall(Turbo); assertThrows(Turbo, TypeError, - "Cannot perform Array Iterator.prototype.next on a neutered ArrayBuffer"); + "Cannot perform Array Iterator.prototype.next on a detached ArrayBuffer"); diff --git a/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js b/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js index b2ebfce6c9..8d896b93a2 100644 --- a/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js +++ b/deps/v8/test/mjsunit/es6/block-conflicts-sloppy.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Test for conflicting variable bindings. +// Stress-testing this test is very slow and provides no useful coverage. +// Flags: --nostress-opt --noalways-opt function CheckException(e) { var string = e.toString(); diff --git a/deps/v8/test/mjsunit/es6/block-const-assign.js b/deps/v8/test/mjsunit/es6/block-const-assign.js index 541dc0d97b..5700d69d04 100644 --- a/deps/v8/test/mjsunit/es6/block-const-assign.js +++ b/deps/v8/test/mjsunit/es6/block-const-assign.js @@ -29,6 +29,9 @@ // when using an immutable binding in an assigment or with // prefix/postfix decrement/increment operators. +// Optimization stress is not useful for early syntax errors. +// Flags: --nostress-opt --noalways-opt + "use strict"; const decls = [ @@ -135,7 +138,8 @@ let usecontexts = [ function Test(program, error) { program = "'use strict'; " + program; try { - print(program, " // throw " + error.name); + // If you need to debug this test, enable the following line: + // print(program, " // throw " + error.name); eval(program); } catch (e) { assertInstanceof(e, error); diff --git a/deps/v8/test/mjsunit/es6/iterator-eager-deopt.js b/deps/v8/test/mjsunit/es6/iterator-eager-deopt.js new file mode 100644 index 0000000000..fe004c8c6d --- /dev/null +++ b/deps/v8/test/mjsunit/es6/iterator-eager-deopt.js @@ -0,0 +1,69 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The GetIterator bytecode is used to implement a part of the iterator +// protocol (https://tc39.es/ecma262/#sec-getiterator). Here, the +// bytecode performs multiple operations including some that have side-effects +// and may deoptimize eagerly or lazily. +// This test ensures the eager deoptimization is handled correctly. + +// Flags: --allow-natives-syntax --no-always-opt + +var getIteratorCount = 0; +var iteratorCount = 0; +var iteratorAfterEagerDeoptCount = 0; + +function foo(obj) { + // The following for-of loop uses the iterator protocol to iterate + // over the 'obj'. + // The GetIterator bytecode invovlves 3 steps: + // 1. method = GetMethod(obj, @@iterator) + // 2. iterator = Call(method, obj) + // 3. if(!IsJSReceiver(iterator)) throw SymbolIteratorInvalid. + for(var x of obj){} +} + +// This iterator gets inlined when the 'foo' function is JIT compiled for +// the first time. +var iterator = function() { + iteratorCount++; + return { + next: function() { + return { done: true }; + } + } +} + +var iteratorAfterEagerDeopt = function() { + iteratorAfterEagerDeoptCount++; + return { + next: function() { + return { done: true }; + } + } +} + +// Here, retrieval of function at @@iterator has side effect (increments the +// 'getIteratorCount'). Changing the value of 'iterator' in the JIT compiled +// 'foo' causes deoptimization after the count is incremented. Now the deopt +// cannot resume at the beginning of the bytecode because it would end up in +// incrementing the count again. +let y = { get [Symbol.iterator] () { + getIteratorCount++; + return iterator; + } + }; + +%PrepareFunctionForOptimization(foo); +foo(y); +foo(y); +%OptimizeFunctionOnNextCall(foo); + +// Change the value of 'iterator' to trigger eager deoptimization of 'foo'. +iterator = iteratorAfterEagerDeopt +foo(y); +assertUnoptimized(foo); +assertEquals(getIteratorCount, 3); +assertEquals(iteratorCount, 2); +assertEquals(iteratorAfterEagerDeoptCount, 1); diff --git a/deps/v8/test/mjsunit/es6/iterator-invalid-receiver-opt.js b/deps/v8/test/mjsunit/es6/iterator-invalid-receiver-opt.js new file mode 100644 index 0000000000..fac416b5b5 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/iterator-invalid-receiver-opt.js @@ -0,0 +1,51 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The GetIterator bytecode is used to implement a part of the iterator +// protocol (https://tc39.es/ecma262/#sec-getiterator). +// Here, call to the @@iterator property returns invalid JS receiver. +// This test ensures that the optimized version of the GetIterator bytecode +// incorporates exception handling mechanism without deoptimizing. + +// Flags: --allow-natives-syntax --opt + +var iteratorCount = 0; +var exceptionCount = 0; + +function foo(obj) { + // The following for-of loop uses the iterator protocol to iterate + // over the 'obj'. + // The GetIterator bytecode invovlves 3 steps: + // 1. method = GetMethod(obj, @@iterator) + // 2. iterator = Call(method, obj) + // 3. if(!IsJSReceiver(iterator)) throw SymbolIteratorInvalid. + try{ + for(let a of obj){ + assertUnreachable(); + } + } catch(e){ + exceptionCount++; + } +} + +// This iterator retuns '3' which is not a valid JSReceiver +var iterator = function() { + iteratorCount++; + return 3; +} + +let y = { + get [Symbol.iterator]() { + return iterator; + } +}; + +%PrepareFunctionForOptimization(foo); +foo(y); +foo(y); +%OptimizeFunctionOnNextCall(foo); +foo(y); +assertOptimized(foo); +assertEquals(iteratorCount, 3); +assertEquals(exceptionCount, 3); diff --git a/deps/v8/test/mjsunit/es6/iterator-lazy-deopt.js b/deps/v8/test/mjsunit/es6/iterator-lazy-deopt.js new file mode 100644 index 0000000000..f2b39a208d --- /dev/null +++ b/deps/v8/test/mjsunit/es6/iterator-lazy-deopt.js @@ -0,0 +1,71 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The GetIterator bytecode is used to implement a part of the iterator +// protocol (https://tc39.es/ecma262/#sec-getiterator). Here, the +// bytecode performs multiple operations including some that have side-effects +// and may deoptimize eagerly or lazily. +// This test ensures the lazy deoptimization is handled correctly. + +// Flags: --allow-natives-syntax --no-always-opt + +var triggerLazyDeopt = false +var iteratorCount = 0; +var iteratorAfterLazyDeoptCount = 0; +var getIteratorCount = 0; + +function foo(obj) { + // The following for-of loop uses the iterator protocol to iterate + // over the 'obj'. + // The GetIterator bytecode invovlves 3 steps: + // 1. method = GetMethod(obj, @@iterator) + // 2. iterator = Call(method, obj) + // 3. if(!IsJSReceiver(iterator)) throw SymbolIteratorInvalid. + for(var x of obj){} +} + +// This iterator gets inlined when the 'foo' function is JIT compiled for +// the first time. +var iterator = function() { + iteratorCount++; + return { + next: function() { + return { done: true }; + } + } +} + +iteratorAfterLazyDeopt = function() { + iteratorAfterLazyDeoptCount++; + return { + next: function() { + return { done: true }; + } + } +} +// Here, retrieval of function at @@iterator has side effect (increments the +// 'getIteratorCount').The lazy deoptimization is triggerred by setting the +// 'triggerLazyDeopt' to true after the count is incremented. Now the deopt +// cannot resume at the beginning of the bytecode because it would end up in +// incrementing the count again. +let y = { get [Symbol.iterator] () { + getIteratorCount++; + if(triggerLazyDeopt) { + %DeoptimizeFunction(foo); + iterator = iteratorAfterLazyDeopt + } + return iterator; + } + }; + +%PrepareFunctionForOptimization(foo); +foo(y); +foo(y); +%OptimizeFunctionOnNextCall(foo); +triggerLazyDeopt = true; +foo(y); +assertUnoptimized(foo); +assertEquals(getIteratorCount, 3); +assertEquals(iteratorCount, 2); +assertEquals(iteratorAfterLazyDeoptCount, 1); diff --git a/deps/v8/test/mjsunit/es6/large-classes-properties.js b/deps/v8/test/mjsunit/es6/large-classes-properties.js index fe3fb13b8f..c725d8376e 100644 --- a/deps/v8/test/mjsunit/es6/large-classes-properties.js +++ b/deps/v8/test/mjsunit/es6/large-classes-properties.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax +// This gets very slow with stress flags, and triggers optimization anyway: +// Flags: --nostress-opt --noalways-opt (function testLargeClassesProperties(){ // This is to test for dictionary mode when there more than diff --git a/deps/v8/test/mjsunit/global-proxy-globalThis.js b/deps/v8/test/mjsunit/global-proxy-globalThis.js new file mode 100644 index 0000000000..3b53d74792 --- /dev/null +++ b/deps/v8/test/mjsunit/global-proxy-globalThis.js @@ -0,0 +1,91 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + %OptimizeFunctionOnNextCall(foo); + assertSame(foo(), foo); +} + +// detachGlobal, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + assertSame(foo(), foo); + Realm.navigate(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return globalThis.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} diff --git a/deps/v8/test/mjsunit/global-proxy-this.js b/deps/v8/test/mjsunit/global-proxy-this.js new file mode 100644 index 0000000000..32e7868650 --- /dev/null +++ b/deps/v8/test/mjsunit/global-proxy-this.js @@ -0,0 +1,91 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + %OptimizeFunctionOnNextCall(foo); + assertSame(foo(), foo); +} + +// detachGlobal, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + assertSame(foo(), foo); + Realm.detachGlobal(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + assertSame(foo(), foo); + Realm.navigate(realm); + %PrepareFunctionForOptimization(foo); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// detachGlobal, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.detachGlobal(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} + +// navigate, old and new map +{ + const realm = Realm.createAllowCrossRealmAccess(); + const foo = Realm.eval(realm, "function foo() { return this.foo }; foo"); + + %PrepareFunctionForOptimization(foo); + assertSame(foo(), foo); + Realm.navigate(realm); + assertThrows(foo); + %OptimizeFunctionOnNextCall(foo); + assertThrows(foo); +} diff --git a/deps/v8/test/mjsunit/harmony/modules-import-15-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-import-15-top-level-await.mjs new file mode 100644 index 0000000000..1feb3dae27 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-15-top-level-await.mjs @@ -0,0 +1,58 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await --allow-natives-syntax +// Flags: --harmony-dynamic-import + +var ran = false; + +async function test1() { + try { + let x = await import('modules-skip-8.mjs'); + %AbortJS('failure: should be unreachable'); + } catch(e) { + assertEquals('x is not defined', e.message); + ran = true; + } +} + +test1(); +%PerformMicrotaskCheckpoint(); +assertTrue(ran); + +ran = false; + +async function test2() { + try { + let x = await import('modules-skip-9.mjs'); + %AbortJS('failure: should be unreachable'); + } catch(e) { + assertInstanceof(e, SyntaxError); + assertEquals( + "The requested module 'modules-skip-empty.mjs' does not provide an " + + "export named 'default'", + e.message); + ran = true; + } +} + +test2(); +%PerformMicrotaskCheckpoint(); +assertTrue(ran); + +ran = false; + +async function test3() { + try { + let x = await import('nonexistent-file.mjs'); + %AbortJS('failure: should be unreachable'); + } catch(e) { + assertTrue(e.startsWith('Error reading')); + ran = true; + } +} + +test3(); +%PerformMicrotaskCheckpoint(); +assertTrue(ran); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-15.mjs b/deps/v8/test/mjsunit/harmony/modules-import-15.mjs index b4febd5787..8b313d6017 100644 --- a/deps/v8/test/mjsunit/harmony/modules-import-15.mjs +++ b/deps/v8/test/mjsunit/harmony/modules-import-15.mjs @@ -3,6 +3,9 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --harmony-dynamic-import +// +// Note: This test fails with top level await due to test1, which tries to +// import a module using top level await and expects it to fail. var ran = false; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-1.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-1.mjs new file mode 100644 index 0000000000..9c9dfc385b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-1.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, ['1', '2', '3', '4']); + +import 'modules-skip-1-rqstd-order.mjs'; +import 'modules-skip-2-rqstd-order.mjs'; +import 'modules-skip-3-rqstd-order.mjs'; +import 'modules-skip-4-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-2.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-2.mjs new file mode 100644 index 0000000000..374660ec79 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-2.mjs @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_dir_a', '2_dir_a', '3_dir_a', '4_dir_a', + '1', '2', '3', '4', + '1_dir_b', '2_dir_b', '3_dir_b', '4_dir_b']); + +import 'modules-skip-1-rqstd-order-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order-top-level-await.mjs'; +import 'modules-skip-4-rqstd-order-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-3.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-3.mjs new file mode 100644 index 0000000000..f145a75d5b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-3.mjs @@ -0,0 +1,13 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1', '2_dir_a', '3', '4_dir_a', '2', '4', '2_dir_b', '4_dir_b']); + +import 'modules-skip-1-rqstd-order.mjs'; +import 'modules-skip-2-rqstd-order-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order.mjs'; +import 'modules-skip-4-rqstd-order-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-4.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-4.mjs new file mode 100644 index 0000000000..57e6e54310 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-4.mjs @@ -0,0 +1,17 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_dir_a', '2_dir_a', '3_dir_a', '4_dir_a', + '1', '2', '3', '4', + '1_dir_b', '2_dir_b', '3_dir_b', '4_dir_b', + '1_ind', '2_ind', '3_ind', '4_ind', +]); + +import 'modules-skip-1-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-4-rqstd-order-indirect-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-5.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-5.mjs new file mode 100644 index 0000000000..e018705c33 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-5.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1', '2_dir_a', '3_dir_a', '4', + '2', '3', '2_dir_b', '3_dir_b', + '2_ind', +]); + +import 'modules-skip-1-rqstd-order.mjs'; +import 'modules-skip-2-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order-top-level-await.mjs'; +import 'modules-skip-4-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-6.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-6.mjs new file mode 100644 index 0000000000..8d3ed1f255 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-6.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_dir_a', '2_dir_a', '3', '4_dir_a', + '1', '2', '4', '1_dir_b', '2_dir_b', + '4_dir_b', '2_ind', +]); + +import 'modules-skip-1-rqstd-order-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order-indirect-top-level-await.mjs'; +import 'modules-skip-3-rqstd-order.mjs'; +import 'modules-skip-4-rqstd-order-top-level-await.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-7.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-7.mjs new file mode 100644 index 0000000000..64bbeb1eb4 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-7.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_udir_a', '1_udir_b', '2', +]); + +import 'modules-skip-1-rqstd-order-unreached-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-8.mjs b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-8.mjs new file mode 100644 index 0000000000..0d9fe3e381 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-rqstd-order-top-level-await-8.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-top-level-await + +assertEquals(globalThis.test262, [ + '1_udir_a', '1_udir_b', '2', '1_uind' +]); + +import 'modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs'; +import 'modules-skip-2-rqstd-order.mjs'; diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-1.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-1.mjs new file mode 100644 index 0000000000..c8efa5d94e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-1.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --harmony-dynamic-import --harmony-top-level-await + +let promise_resolved = false; +let m = import('modules-skip-1.mjs'); +m.then( + () => { promise_resolved = true; }, + () => { %AbortJS('Promise rejected'); }); +await m; + +assertEquals(promise_resolved, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-2.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-2.mjs new file mode 100644 index 0000000000..0f74aa7ca9 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-2.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let m = import('modules-skip-1.mjs'); +let m_namespace = await m; + +assertEquals(42, m_namespace.life()); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-3.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-3.mjs new file mode 100644 index 0000000000..44c8145127 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-3.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let m1 = import('modules-skip-1.mjs'); +let m1_namespace = await m1; + +let m2 = import('modules-skip-3.mjs'); +let m2_namespace = await m2; + +assertEquals(42, m1_namespace.life()); +assertEquals('42', m2_namespace.stringlife); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-4.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-4.mjs new file mode 100644 index 0000000000..29730fa4a5 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-4.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-1-top-level-await.mjs' + +assertEquals(42, m.life()); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-5.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-5.mjs new file mode 100644 index 0000000000..f1e7813346 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-5.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-2-top-level-await.mjs' + +assertEquals(42, m.life()); +assertEquals('42', m.stringlife); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-6.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-6.mjs new file mode 100644 index 0000000000..f852895e4b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-6.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-3-top-level-await.mjs' + +assertEquals(42, m.life()); +assertEquals('42', m.stringlife); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-7.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-7.mjs new file mode 100644 index 0000000000..26f1440774 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-7.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --harmony-top-level-await --harmony-dynamic-import + +import * as m from 'modules-skip-6-top-level-await.mjs'; + +assertEquals(m.m1.life(), m.m2.life()); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-8.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-8.mjs new file mode 100644 index 0000000000..aa80c73edd --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-8.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +import * as m from 'modules-skip-7-top-level-await.mjs' + +assertEquals(42, m.life); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-cycle.mjs new file mode 100644 index 0000000000..0ec478e59b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-cycle.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --harmony-top-level-await --harmony-dynamic-import + +import * as m1 from 'modules-skip-1-top-level-await-cycle.mjs' +import * as m2 from 'modules-skip-2-top-level-await-cycle.mjs' +import * as m3 from 'modules-skip-3-top-level-await-cycle.mjs' + +assertSame(m1.m1.m.m.life, m1.m2.m.m.life); +assertSame(m1.m1.m.m.life, m2.m.m.life); +assertSame(m1.m1.m.m.life, m3.m.m.life); + +let m4 = await import('modules-skip-1.mjs'); +assertSame(m1.m1.m.m.life, m4.life); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-1.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-1.mjs new file mode 100644 index 0000000000..1e22f15758 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-1.mjs @@ -0,0 +1,18 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let ran = false; +let m = import('modules-skip-2.mjs'); +await m.then( + () => { + assertUnreachable(); + }, + (e) => { + assertEquals(e.message, '42 is not the answer'); + ran = true; + }); + +assertEquals(ran, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-2.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-2.mjs new file mode 100644 index 0000000000..476cfbee15 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-2.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let ran = false; +try { + await import('modules-skip-2.mjs'); + assertUnreachable(); +} catch (e) { + assertEquals(e.message, '42 is not the answer'); + ran = true; +} + +assertEquals(ran, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-3.mjs b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-3.mjs new file mode 100644 index 0000000000..20de7ef06e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-import-top-level-await-exception-3.mjs @@ -0,0 +1,16 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-dynamic-import --harmony-top-level-await + +let ran = false; +try { + await import('modules-skip-4-top-level-await.mjs'); + assertUnreachable(); +} catch (e) { + assertEquals(e.message, '42 is not the answer'); + ran = true; +} + +assertEquals(ran, true); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..cbd357c86b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-1-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('1_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs new file mode 100644 index 0000000000..c6dff00d63 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-indirect-unreached-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-1-rqstd-order-unreached-top-level-await.mjs'; + +Function('return this;')().test262.push('1_uind'); + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..fcbe07a848 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-top-level-await.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (typeof Function('return this;')().test262 === 'undefined') { + Function('return this;')().test262 = ['1_dir_a']; +} else { + Function('return this;')().test262.push('1_dir_a'); +} +let m = import('modules-skip-1-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('1_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-unreached-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-unreached-top-level-await.mjs new file mode 100644 index 0000000000..f2b2104ad3 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order-unreached-top-level-await.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (typeof Function('return this;')().test262 === 'undefined') { + Function('return this;')().test262 = ['1_udir_a']; +} else { + Function('return this;')().test262.push('1_udir_a'); +} +if (false) { + assertUnreachable(); + await 42; +} +Function('return this;')().test262.push('1_udir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order.mjs new file mode 100644 index 0000000000..5ac1882935 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-rqstd-order.mjs @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (typeof Function('return this;')().test262 === 'undefined') { + Function('return this;')().test262 = ['1']; +} else { + Function('return this;')().test262.push('1'); +} diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await-cycle.mjs new file mode 100644 index 0000000000..601e80a1b1 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await-cycle.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-2-top-level-await-cycle.mjs'; +import * as m2 from 'modules-skip-3-top-level-await-cycle.mjs'; + +export { m1, m2 }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await.mjs new file mode 100644 index 0000000000..25973fe9ee --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-1-top-level-await.mjs @@ -0,0 +1,11 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let m = import('modules-skip-1.mjs'); +let m_namespace = await m; + +export function life() { + return m_namespace.life(); +} + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..2305422b81 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-2-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('2_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..c2b20a53f2 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('2_dir_a'); +let m = import('modules-skip-2-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('2_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order.mjs new file mode 100644 index 0000000000..7dbd64c4cf --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-rqstd-order.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('2'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await-cycle.mjs new file mode 100644 index 0000000000..3171bb88ea --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await-cycle.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m from 'modules-skip-4-top-level-await-cycle.mjs'; + +export { m }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await.mjs new file mode 100644 index 0000000000..4aa2f2cdcd --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-2-top-level-await.mjs @@ -0,0 +1,15 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-3.mjs' + +let m2 = import('modules-skip-1-top-level-await.mjs'); +let m2_namespace = await m2; + +export let stringlife = m1.stringlife; + +export function life() { + return m2_namespace.life(); +} + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..2b4dae0063 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-3-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('3_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..f3b8904731 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('3_dir_a'); +let m = import('modules-skip-3-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('3_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order.mjs new file mode 100644 index 0000000000..bd70e70aa5 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-rqstd-order.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('3'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await-cycle.mjs new file mode 100644 index 0000000000..3171bb88ea --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await-cycle.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m from 'modules-skip-4-top-level-await-cycle.mjs'; + +export { m }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await.mjs new file mode 100644 index 0000000000..eea2c7a29b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-3-top-level-await.mjs @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-1-top-level-await.mjs'; +import * as m2 from 'modules-skip-3.mjs'; + +export function life() { + return m1.life(); +} + +export let stringlife = m2.stringlife; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-indirect-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-indirect-top-level-await.mjs new file mode 100644 index 0000000000..7c75a9aadc --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-indirect-top-level-await.mjs @@ -0,0 +1,6 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-4-rqstd-order-top-level-await.mjs' +Function('return this;')().test262.push('4_ind'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-top-level-await.mjs new file mode 100644 index 0000000000..1659ba681e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order-top-level-await.mjs @@ -0,0 +1,8 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('4_dir_a'); +let m = import('modules-skip-4-rqstd-order.mjs'); +await m; +Function('return this;')().test262.push('4_dir_b'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order.mjs new file mode 100644 index 0000000000..7fdd12ca7a --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-rqstd-order.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Function('return this;')().test262.push('4'); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await-cycle.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await-cycle.mjs new file mode 100644 index 0000000000..2b58e2399f --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await-cycle.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let m = await import('modules-skip-1.mjs'); + +export { m }; diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await.mjs new file mode 100644 index 0000000000..00576a23c1 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-4-top-level-await.mjs @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'modules-skip-5-top-level-await.mjs'; + +assertUnreachable(); diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-5-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-5-top-level-await.mjs new file mode 100644 index 0000000000..28cf2a9c18 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-5-top-level-await.mjs @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +await import('modules-skip-2.mjs') diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-6-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-6-top-level-await.mjs new file mode 100644 index 0000000000..65849dba3e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-6-top-level-await.mjs @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import * as m1 from 'modules-skip-3-top-level-await.mjs'; + +let m2 = await import('modules-skip-1.mjs'); + +export { m1, m2 }; + diff --git a/deps/v8/test/mjsunit/harmony/modules-skip-7-top-level-await.mjs b/deps/v8/test/mjsunit/harmony/modules-skip-7-top-level-await.mjs new file mode 100644 index 0000000000..bc7f22b771 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/modules-skip-7-top-level-await.mjs @@ -0,0 +1,14 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function sleeping_promise() { + return new Promise((resolve) => setTimeout(resolve)); +} + +export let life; + +await sleeping_promise(); +life = -1; +await sleeping_promise(); +life = (await import('modules-skip-1.mjs')).life(); diff --git a/deps/v8/test/mjsunit/harmony/private-accessors.js b/deps/v8/test/mjsunit/harmony/private-accessors.js index 3a828116a1..44ec2a0790 100644 --- a/deps/v8/test/mjsunit/harmony/private-accessors.js +++ b/deps/v8/test/mjsunit/harmony/private-accessors.js @@ -83,6 +83,30 @@ assertEquals('d', new C().getA().getD()); } +{ + assertThrows(() => { + class A { + [this.#a] = 1; + get #a() {} + } + }, TypeError); + + assertThrows(() => { + class A { + [this.#a] = 1; + set #a(val) {} + } + }, TypeError); + + assertThrows(() => { + class A { + [this.#a] = 1; + set #a(val) {} + get #a() {} + } + }, TypeError); +} + // Duplicate private accessors. // https://tc39.es/proposal-private-methods/#sec-static-semantics-early-errors { diff --git a/deps/v8/test/mjsunit/harmony/private-fields.js b/deps/v8/test/mjsunit/harmony/private-fields.js index 0c1c04bc75..067b208620 100644 --- a/deps/v8/test/mjsunit/harmony/private-fields.js +++ b/deps/v8/test/mjsunit/harmony/private-fields.js @@ -476,3 +476,12 @@ let c = new C; assertThrows(() => c.getA(), SyntaxError); } + +{ + assertThrows(() => { + class A { + [this.#a] = 1; + #a = 2; + } + }, TypeError); +} diff --git a/deps/v8/test/mjsunit/harmony/private-methods.js b/deps/v8/test/mjsunit/harmony/private-methods.js index fcd80823c1..b42e4f658c 100644 --- a/deps/v8/test/mjsunit/harmony/private-methods.js +++ b/deps/v8/test/mjsunit/harmony/private-methods.js @@ -295,3 +295,12 @@ assertEquals(1, new C().fn()); } + +{ + assertThrows(() => { + class A { + [this.#a] = 1; + #a() { } + } + }, TypeError); +} diff --git a/deps/v8/test/mjsunit/harmony/private-name-scopes.js b/deps/v8/test/mjsunit/harmony/private-name-scopes.js new file mode 100644 index 0000000000..e6060cf81a --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/private-name-scopes.js @@ -0,0 +1,137 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +{ + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + return class D { + exfil(obj) { return obj.#f; } + exfilEval(obj) { return eval("obj.#f"); } + }; + }) { + #f = "C.#f"; + }; + } + + const o = new O; + const c = new O.C; + const D = heritageFn(); + const d = new D; + assertEquals(d.exfil(o), "O.#f"); + assertEquals(d.exfilEval(o), "O.#f"); + assertThrows(() => d.exfil(c), TypeError); + assertThrows(() => d.exfilEval(c), TypeError); +} + +// Early errors + +assertThrows(() => eval("new class extends " + + "(class { m() { let x = this.#f; } }) " + + "{ #f }"), SyntaxError); + +assertThrows(() => eval("new class extends this.#foo { #foo }"), SyntaxError); + +// Runtime errors + +{ + // Test private name context chain recalc. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + return class D { exfil(obj) { return obj.#f; } } + }) { + #f = "C.#f"; + }; + } + + const o = new O; + const c = new O.C; + const D = heritageFn(); + const d = new D; + assertEquals(d.exfil(o), "O.#f"); + assertThrows(() => d.exfil(c), TypeError); +} + +{ + // Test private name context chain recalc with nested closures with context. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + let forceContext = 1; + return () => { + assertEquals(forceContext, 1); + return class D { exfil(obj) { return obj.#f; } } + }; + }) { + #f = "C.#f"; + }; + } + + const o = new O; + const c = new O.C; + const D = heritageFn()(); + const d = new D; + assertEquals(d.exfil(o), "O.#f"); + assertThrows(() => d.exfil(c), TypeError); +} + +{ + // Test private name context chain recalc where skipped class has no context. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C0 extends (class C1 extends (heritageFn = function (obj) { + if (obj) { return obj.#f; } + }) {}) { + #f = "C0.#f" + } + } + + const o = new O; + const c = new O.C; + assertEquals(heritageFn(o), "O.#f"); + assertThrows(() => heritageFn(c), TypeError); +} + +{ + // Test private name context chain recalc where skipping function has no + // context. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C extends (heritageFn = function () { + return (obj) => { return obj.#f; } + }) { + #f = "C.#f"; + } + } + + const o = new O; + const c = new O.C; + assertEquals(heritageFn()(o), "O.#f"); + assertThrows(() => heritageFn()(c), TypeError); +} + +{ + // Test private name context chain recalc where neither skipped class nor + // skipping function has contexts. + let heritageFn; + class O { + #f = "O.#f"; + static C = class C0 extends (class C1 extends (heritageFn = function () { + return (obj) => { return obj.#f; } + }) {}) { + #f = "C0.#f"; + } + } + + const o = new O; + const c = new O.C; + assertEquals(heritageFn()(o), "O.#f"); + assertThrows(() => heritageFn()(c), TypeError); +} diff --git a/deps/v8/test/mjsunit/harmony/regexp-match-indices.js b/deps/v8/test/mjsunit/harmony/regexp-match-indices.js new file mode 100644 index 0000000000..cc3710ce7e --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regexp-match-indices.js @@ -0,0 +1,105 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --harmony-regexp-match-indices + +// Sanity test. +{ + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaaz"); + + assertEquals(m.indices, [[1, 5], [4, 5]]); + assertEquals(m.indices.groups, {'Z': [4, 5]}) +} + +// Capture groups that are not matched return `undefined`. +{ + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaay"); + + assertEquals(m.indices, [[1, 4], undefined]); + assertEquals(m.indices.groups, {'Z': undefined}); +} + +// Two capture groups. +{ + const re = /a+(?<A>zz)?(?<B>ii)?/; + const m = re.exec("xaaazzii"); + + assertEquals(m.indices, [[1, 8], [4, 6], [6, 8]]); + assertEquals(m.indices.groups, {'A': [4, 6], 'B': [6, 8]}); +} + +// No capture groups. +{ + const re = /a+/; + const m = re.exec("xaaazzii"); + + assertEquals(m.indices [[1, 4]]); + assertEquals(m.indices.groups, undefined); +} + +// No match. +{ + const re = /a+/; + const m = re.exec("xzzii"); + + assertEquals(null, m); +} + +// Unnamed capture groups. +{ + const re = /a+(z)?/; + const m = re.exec("xaaaz") + + assertEquals(m.indices, [[1, 5], [4, 5]]); + assertEquals(m.indices.groups, undefined) +} + +// Named and unnamed capture groups. +{ + const re = /a+(z)?(?<Y>y)?/; + const m = re.exec("xaaazyy") + + assertEquals(m.indices, [[1, 6], [4, 5], [5, 6]]); + assertEquals(m.indices.groups, {'Y': [5, 6]}) +} + + +// Verify property overwrite. +{ + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaaz"); + + m.indices = null; + assertEquals(null, m.indices); +} + +// Mess with array prototype, we should still do the right thing. +{ + Object.defineProperty(Array.prototype, "groups", { + get: () => { + assertUnreachable(); + return null; + }, + set: (x) => { + assertUnreachable(); + } + }); + + Object.defineProperty(Array.prototype, "0", { + get: () => { + assertUnreachable(); + return null; + }, + set: (x) => { + assertUnreachable(); + } + }); + + const re = /a+(?<Z>z)?/; + const m = re.exec("xaaaz"); + + assertEquals(m.indices.groups, {'Z': [4, 5]}) +} diff --git a/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js b/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js index 24724eea14..e4cdff5d36 100644 --- a/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js +++ b/deps/v8/test/mjsunit/harmony/sharedarraybuffer-stress.js @@ -9,11 +9,9 @@ function Alloc(size) { } function RunSomeAllocs(total, retained, size) { - print(`-------iterations = ${total}, retained = $ { retained } -------`); + print(`-------iterations = ${total}, retained = ${retained} -------`); var array = new Array(retained); for (var i = 0; i < total; i++) { - if ((i % 25) == 0) - print(`iteration $ { i }`); let pair = Alloc(size); // For some iterations, retain the memory, view, or both. switch (i % 3) { diff --git a/deps/v8/test/mjsunit/harmony/static-private-methods.js b/deps/v8/test/mjsunit/harmony/static-private-methods.js new file mode 100644 index 0000000000..ed81bb3038 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/static-private-methods.js @@ -0,0 +1,248 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-private-methods + +"use strict"; + +// Static private methods +{ + let store = 1; + class C { + static #a() { return store; } + static a() { return this.#a(); } + } + assertEquals(C.a(), store); + assertThrows(() => C.a.call(new C), TypeError); +} + +// Complementary static private accessors. +{ + let store = 1; + class C { + static get #a() { return store; } + static set #a(val) { store = val; } + static incA() { this.#a++; } + static getA() { return this.#a; } + static setA(val) { this.#a = val; } + } + assertEquals(C.getA(), 1); + C.incA(); + assertEquals(store, 2); + C.setA(3); + assertEquals(store, 3); + + assertThrows(() => C.incA.call(new C), TypeError); + assertThrows(() => C.getA.call(new C), TypeError); + assertThrows(() => C.setA.call(new C), TypeError); + + assertThrows(() => { const incA = C.incA; incA(); }, TypeError); + assertThrows(() => { const getA = C.getA; getA(); }, TypeError); + assertThrows(() => { const setA = C.setA; setA(); }, TypeError); +} + +// Static private methods accessed explicitly in an anonymous nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class { + static #a() { return 'Inner'; } + static a() { return this.#a(); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a(), 'Inner'); + assertThrows(() => obj.a.call(C), TypeError); + assertThrows(() => obj.a.call(new C), TypeError); +} + +// Static private methods accessed explicitly in a named nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class Inner { + static #a() { return 'Inner'; } + static a() { return this.#a(); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a(), 'Inner'); + assertThrows(() => obj.a.call(C), TypeError); + assertThrows(() => obj.a.call(new C), TypeError); +} + +// Static private methods accessed through eval in an anonymous nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class { + static #a() { return 'Inner'; } + static a(str) { return eval(str); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a('this.#a()'), 'Inner'); + assertThrows(() => C.a('Outer.#a()'), TypeError); +} + +// Static private methods accessed through eval in a named nested class. +{ + class Outer { + #a() { return 'Outer'; } + a() { return this.#a(); } + test() { + return class Inner { + static #a() { return 'Inner'; } + static a(str) { return eval(str); } + }; + } + } + + const obj = new Outer; + const C = obj.test(); + assertEquals(C.a('this.#a()'), 'Inner'); + assertEquals(C.a('Inner.#a()'), 'Inner'); + assertThrows(() => C.a('Outer.#a()'), TypeError); + assertThrows(() => C.run('(new Outer).#a()'), TypeError); +} + +// Static private methods in the outer class accessed through eval +// in a named nested class. +{ + class Outer { + static #a() { return 'Outer'; } + static test() { + return class Inner { + static run(str) { return eval(str); } + }; + } + } + + const C = Outer.test(); + assertEquals(C.run('Outer.#a()'), 'Outer'); + assertThrows(() => C.run('this.#a()'), TypeError); + assertThrows(() => C.run('Inner.#a()'), TypeError); + assertThrows(() => C.run('(new Outer).#a()'), TypeError); +} + +// Static private methods in the outer class accessed explicitly +// in a named nested class. +{ + class Outer { + static #a() { return 'Outer'; } + static test() { + return class Inner { + static getA(klass) { return klass.#a(); } + }; + } + } + + const C = Outer.test(); + assertEquals(C.getA(Outer), 'Outer'); + assertThrows(() => C.getA.call(C), TypeError); + assertThrows(() => C.getA.call(new Outer), TypeError); +} + +// Static private methods in the outer class accessed explicitly +// in an anonymous nested class. +{ + class Outer { + static #a() { return 'Outer'; } + static test() { + return class { + static getA(klass) { return klass.#a(); } + }; + } + } + + const C = Outer.test(); + assertEquals(C.getA(Outer), 'Outer'); + assertThrows(() => C.getA.call(C), TypeError); + assertThrows(() => C.getA.call(new Outer), TypeError); +} + +// Super property access in static private methods +{ + class A { + static a = 1; + } + + class B extends A { + static #a() { return super.a; } + static getA() { return this.#a(); } + } + + assertEquals(B.getA(), 1); +} + +// Invalid super property access in static private methods +{ + class A { + static #a() { return 1; } + static getA() { return this.#a(); } + } + + class B extends A { + static getA() { return super.getA(); } + } + + assertThrows(() => B.getA(), TypeError); +} + +// Static private methods accessed in eval. +{ + class C { + static #m(v) { return v; } + static test(str) { + return eval(str); + } + } + + assertEquals(C.test('this.#m(1)'), 1); +} + +// Test that the receiver is checked during run time. +{ + const C = class { + static #a() { } + static test(klass) { return klass.#a; } + }; + const test = C.test; + assertThrows(test, TypeError); +} + +// Duplicate static private accessors and methods. +{ + assertThrows('class C { static get #a() {} static get #a() {} }', SyntaxError); + assertThrows('class C { static get #a() {} static #a() {} }', SyntaxError); + assertThrows('class C { static get #a() {} get #a() {} }', SyntaxError); + assertThrows('class C { static get #a() {} set #a(val) {} }', SyntaxError); + assertThrows('class C { static get #a() {} #a() {} }', SyntaxError); + + assertThrows('class C { static set #a(val) {} static set #a(val) {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} static #a() {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} get #a() {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} set #a(val) {} }', SyntaxError); + assertThrows('class C { static set #a(val) {} #a() {} }', SyntaxError); + + assertThrows('class C { static #a() {} static #a() {} }', SyntaxError); + assertThrows('class C { static #a() {} #a(val) {} }', SyntaxError); + assertThrows('class C { static #a() {} set #a(val) {} }', SyntaxError); + assertThrows('class C { static #a() {} get #a() {} }', SyntaxError); +} diff --git a/deps/v8/test/mjsunit/md5.js b/deps/v8/test/mjsunit/md5.js index 38dc802312..b2dbc1e45a 100644 --- a/deps/v8/test/mjsunit/md5.js +++ b/deps/v8/test/mjsunit/md5.js @@ -201,11 +201,9 @@ To know our further pleasure in this case,\n\ To old Free-town, our common judgment-place.\n\ Once more, on pain of death, all men depart.\n" -for (var i = 0; i < 4; ++i) { +for (var i = 0; i < 2; ++i) { plainText += plainText; } -assertEquals(hex_md5("abc"), "900150983cd24fb0d6963f7d28e17f72"); -for (var i = 0; i < 11; ++i) { - assertEquals(hex_md5(plainText), "1b8719c72d5d8bfd06e096ef6c6288c5"); -} +assertEquals("900150983cd24fb0d6963f7d28e17f72", hex_md5("abc")); +assertEquals("6c843ffbdd773e88ae4ac4a5df79a784", hex_md5(plainText)); diff --git a/deps/v8/test/mjsunit/messages.js b/deps/v8/test/mjsunit/messages.js index 916a7d554f..7c3521b685 100644 --- a/deps/v8/test/mjsunit/messages.js +++ b/deps/v8/test/mjsunit/messages.js @@ -166,13 +166,13 @@ for (constructor of typedArrayConstructors) { const ta = new constructor([1]); %ArrayBufferDetach(ta.buffer); ta.find(() => {}); - }, "Cannot perform %TypedArray%.prototype.find on a neutered ArrayBuffer", TypeError); + }, "Cannot perform %TypedArray%.prototype.find on a detached ArrayBuffer", TypeError); test(() => { const ta = new constructor([1]); %ArrayBufferDetach(ta.buffer); ta.findIndex(() => {}); - }, "Cannot perform %TypedArray%.prototype.findIndex on a neutered ArrayBuffer", TypeError); + }, "Cannot perform %TypedArray%.prototype.findIndex on a detached ArrayBuffer", TypeError); } // kFirstArgumentNotRegExp diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index 134a49f748..f0d473f84a 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -81,6 +81,9 @@ 'wasm/shared-memory-worker-explicit-gc-stress': [PASS, ['mode == debug', SKIP], ['tsan', SKIP]], 'wasm/shared-memory-worker-gc-stress': [PASS, ['mode == debug', SKIP]], + # Slow in simulator runs. + 'random-bit-correlations': [PASS, ['simulator_run == True', SLOW]], + ############################################################################## # Only RegExp stuff tested, no need for extensive optimizing compiler tests. 'regexp-global': [PASS, NO_VARIANTS], @@ -292,7 +295,6 @@ 'compare-known-objects-slow': [SKIP], 'compiler/array-multiple-receiver-maps': [SKIP], # Tests taking too long - 'packed-elements': [SKIP], 'regress/regress-1122': [SKIP], 'regress/regress-331444': [SKIP], 'regress/regress-353551': [SKIP], @@ -377,6 +379,7 @@ 'regress/regress-6838-2': [SKIP], 'regress/regress-6838-3': [SKIP], 'regress/regress-9022': [SKIP], + 'regress/regress-9832': [SKIP], 'regress/regress-crbug-934138': [SKIP], 'regress/regress-crbug-976934': [SKIP], @@ -393,13 +396,14 @@ 'regress/regress-crbug-759327': [SKIP], 'regress/regress-crbug-898974': [SKIP], 'regexp-tier-up': [SKIP], + 'regexp-tier-up-multiple': [SKIP], + 'regress/regress-996234': [SKIP], # These tests check that we can trace the compiler. 'tools/compiler-trace-flags': [SKIP], 'tools/compiler-trace-flags-wasm': [SKIP], # Too slow on arm64 simulator and debug: https://crbug.com/v8/7783 - 'bit-not': [PASS, ['arch == arm64 and mode == debug and simulator_run', SKIP]], 'md5': [PASS, ['arch == arm64 and mode == debug and simulator_run', SKIP]], # Slow with pointer compression. @@ -470,15 +474,15 @@ 'array-reduce': [PASS, SLOW], 'array-sort': [PASS, SLOW], 'array-splice': [PASS, SLOW], - 'bit-not': [PASS, SLOW], + 'array-store-and-grow': [PASS, SLOW], 'compiler/alloc-number': [PASS, SLOW], 'compiler/osr-with-args': [PASS, SLOW], 'generated-transition-stub': [PASS, SLOW], 'json2': [PASS, SLOW], + 'large-object-literal-slow-elements': [PASS, SLOW], 'math-floor-of-div-nosudiv': [PASS, SLOW], 'math-floor-of-div': [PASS, SLOW], 'messages': [PASS, SLOW], - 'packed-elements': [PASS, SLOW], 'regress/regress-2790': [PASS, SLOW], 'regress/regress-331444': [PASS, SLOW], 'regress/regress-490': [PASS, SLOW], @@ -486,6 +490,7 @@ 'regress/regress-create-exception': [PASS, SLOW], 'regress/regress-json-stringify-gc': [PASS, SLOW], 'string-indexof-2': [PASS, SLOW], + 'unbox-double-arrays': [PASS, SLOW], 'unicodelctest-no-optimization': [PASS, SLOW], 'unicodelctest': [PASS, SLOW], 'unicode-test': [PASS, SLOW], @@ -494,19 +499,28 @@ # BUG(v8:7247). 'regress/regress-779407': [PASS, SLOW, NO_VARIANTS], - - # BUG(v8:9256). Slow with pointer compression. - 'regress/regress-708247': [PASS, ['pointer_compression', SLOW]], - 'es6/array-concat': [PASS, ['pointer_compression', SLOW]], - 'non-extensible-array-reduce': [PASS, ['pointer_compression', SLOW]], - 'regress/regress-454725': [PASS, ['pointer_compression', SLOW]], }], # 'arch == arm64' +############################################################################## +['arch == arm64 and simulator_run', { + # Slow in simulator builds + 'compiler/osr-follow': [PASS, SLOW], + 'es6/array-concat': [PASS, SLOW], + 'non-extensible-array-reduce': [PASS, SLOW], + 'regress/regress-454725': [PASS, SLOW], + 'regress/regress-708247': [PASS, SLOW], + 'compiler/osr-big': [PASS, SLOW], + 'frozen-array-reduce': [PASS, SLOW], + 'json': [PASS, SLOW], + 'sealed-array-reduce': [PASS, SLOW], + 'try': [PASS, SLOW], +}], # 'arch == arm64 and simulator_run' + +############################################################################## ['arch == arm64 and mode == debug and simulator_run', { # Pass but take too long with the simulator in debug mode. 'array-sort': [PASS, SLOW], - 'packed-elements': [SKIP], 'regexp-global': [SKIP], 'math-floor-of-div': [PASS, SLOW], 'math-floor-of-div-nosudiv': [PASS, SLOW], @@ -641,7 +655,6 @@ # Slow tests. 'array-sort': [PASS, SLOW], 'compiler/osr-with-args': [PASS, SLOW], - 'packed-elements': [PASS, SLOW], 'regress/regress-2790': [PASS, SLOW], 'regress/regress-91008': [PASS, SLOW], 'regress/regress-json-stringify-gc': [PASS, SLOW], @@ -913,6 +926,10 @@ 'wasm/atomics-stress': [SKIP], 'wasm/atomics64-stress': [SKIP], 'wasm/futex': [SKIP], + + # Deadlocks on predictable platform (https://crbug.com/v8/9760). + 'wasm/async-compile': [SKIP], + 'wasm/streaming-compile': [SKIP], }], # 'predictable == True' ############################################################################## @@ -925,7 +942,6 @@ 'regress/regress-crbug-482998': [PASS, SLOW], 'regress/regress-91008': [PASS, SLOW], 'regress/regress-779407': [PASS, SLOW], - 'packed-elements': [PASS, SLOW], 'harmony/regexp-property-lu-ui': [PASS, SLOW], 'whitespaces': [PASS, SLOW], 'generated-transition-stub': [PASS, SLOW], @@ -964,6 +980,7 @@ # The RegExp code cache means running this test multiple times is invalid. 'regexp-tier-up': [SKIP], + 'regexp-tier-up-multiple': [SKIP], # Flaky crash on Odroid devices: https://crbug.com/v8/7678 'regress/regress-336820': [PASS, ['arch == arm and not simulator_run', SKIP]], @@ -997,10 +1014,8 @@ }], # variant == stress and (arch == arm or arch == arm64) and simulator_run ############################################################################## -['variant == nooptimization and (arch == arm or arch == arm64) and simulator_run', { +['variant in (nooptimization, jitless) and arch in (arm, arm64) and simulator_run', { # Slow tests: https://crbug.com/v8/7783 - 'md5': [SKIP], - 'packed-elements': [SKIP], 'regress/regress-crbug-319860': [SKIP], 'wasm/asm-wasm-f32': [SKIP], 'wasm/asm-wasm-f64': [SKIP], @@ -1057,7 +1072,7 @@ ############################################################################## # Liftoff is currently only sufficiently implemented on x64, ia32, arm64 and # arm. -# TODO(clemensh): Implement on all other platforms (crbug.com/v8/6600). +# TODO(clemensb): Implement on all other platforms (crbug.com/v8/6600). ['arch != x64 and arch != ia32 and arch != arm64 and arch != arm', { 'wasm/liftoff': [SKIP], 'wasm/tier-up-testing-flag': [SKIP], @@ -1068,9 +1083,6 @@ # Slow tests. 'regress/regress-crbug-493779': [SKIP], 'string-replace-gc': [SKIP], - - # https://crbug.com/v8/9221 - 'wasm/grow-shared-memory': [SKIP], }], # variant == slow_path ############################################################################## @@ -1096,4 +1108,34 @@ 'regress/regress-992389': [SKIP], }], # not embedded_builtins +############################################################################## +['variant == turboprop', { + # Deopts differently than TurboFan. + 'parallel-optimize-disabled': [SKIP], + 'compiler/native-context-specialization-hole-check': [SKIP], + 'compiler/number-comparison-truncations': [SKIP], + 'compiler/redundancy-elimination': [SKIP], + + # Static asserts for optimizations don't hold due to removed optimization + # phases. + 'compiler/concurrent-inlining-1': [SKIP], + 'compiler/concurrent-inlining-2': [SKIP], + 'compiler/diamond-followedby-branch': [SKIP], + 'compiler/load-elimination-const-field': [SKIP], + 'compiler/constant-fold-add-static': [SKIP], +}], # variant == turboprop + +############################################################################## +['variant == top_level_await', { + # specifically expects to fail on top level await. + 'harmony/modules-import-15': [SKIP], +}], # variant == top_level_await + +############################################################################## +['variant == stress_js_bg_compile_wasm_code_gc', { + # Runs significantly slower with --stress-wasm-code-gc, problematic + # especially in combination with tsan or other slow configurations. + 'wasm/many-modules': [SKIP], +}], # variant == stress_js_bg_compile_wasm_code_gc + ] diff --git a/deps/v8/test/mjsunit/mod.js b/deps/v8/test/mjsunit/mod.js index 8ad98fa7ec..4374dcc11d 100644 --- a/deps/v8/test/mjsunit/mod.js +++ b/deps/v8/test/mjsunit/mod.js @@ -31,7 +31,6 @@ function foo() { for (var j = 1; j < 100; j++) { if (answer == i) answer = 0; // Positive case. - print(j + " % " + i + " = " + answer); m = j % i; assertEquals(answer, m, j + " % " + i); m = j % (-i); diff --git a/deps/v8/test/mjsunit/packed-elements.js b/deps/v8/test/mjsunit/packed-elements.js index d0df553451..85630e7954 100644 --- a/deps/v8/test/mjsunit/packed-elements.js +++ b/deps/v8/test/mjsunit/packed-elements.js @@ -92,12 +92,15 @@ function test6() { } function test_with_optimization(f) { - // Run tests in a loop to make sure that inlined Array() constructor runs out - // of new space memory and must fall back on runtime impl. %PrepareFunctionForOptimization(f); - for (i = 0; i < 25000; ++i) f(); + for (i = 0; i < 3; ++i) f(); + // Cause the inlined Array() constructor to fall back to the runtime impl. + %SimulateNewspaceFull(); + f(); %OptimizeFunctionOnNextCall(f); - for (i = 0; i < 25000; ++i) f(); // Make sure GC happens + f(); + %SimulateNewspaceFull(); // Make sure GC happens. + f(); } test_with_optimization(test1); diff --git a/deps/v8/test/mjsunit/readonly.js b/deps/v8/test/mjsunit/readonly.js index ec938d65c0..69a3e6a016 100644 --- a/deps/v8/test/mjsunit/readonly.js +++ b/deps/v8/test/mjsunit/readonly.js @@ -26,6 +26,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Flags: --allow-natives-syntax +// This test manually triggers optimization, no need for stress modes. +// Flags: --nostress-opt --noalways-opt // Different ways to create an object. diff --git a/deps/v8/test/mjsunit/regexp-tier-up-multiple.js b/deps/v8/test/mjsunit/regexp-tier-up-multiple.js new file mode 100644 index 0000000000..7325b341d0 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-tier-up-multiple.js @@ -0,0 +1,101 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Tier-up behavior differs between slow and fast paths in +// RegExp.prototype.replace with a function as an argument. +// Flags: --regexp-tier-up --regexp-tier-up-ticks=5 +// Flags: --allow-natives-syntax --no-force-slow-path --no-regexp-interpret-all + +const kLatin1 = true; +const kUnicode = false; + +function CheckRegexpNotYetCompiled(regexp) { + assertFalse(%RegexpHasBytecode(regexp, kLatin1) && + %RegexpHasNativeCode(regexp, kLatin1)); + assertFalse(%RegexpHasBytecode(regexp, kUnicode) && + %RegexpHasNativeCode(regexp, kUnicode)); +} + +// Testing RegExp.test method which calls into Runtime_RegExpExec. +let re = new RegExp('^.$'); +CheckRegexpNotYetCompiled(re); + +// Testing first five executions of regexp with one-byte string subject. +for (var i = 0; i < 5; i++) { + re.test("a"); + assertTrue(%RegexpHasBytecode(re, kLatin1)); + assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re, kUnicode)); +} +// Testing the tier-up to native code. +re.test("a"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re,kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re,kUnicode)); +re.test("a"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re,kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re,kUnicode)); +// Testing that the regexp will compile to native code for two-byte string +// subject as well, because we have a single tick counter for both string +// representations. +re.test("π"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re,kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + %RegexpHasNativeCode(re,kUnicode)); + +// Testing String.replace method for non-global regexps. +var subject = "a1111"; +re = /\w1/; +CheckRegexpNotYetCompiled(re); + +for (var i = 0; i < 5; i++) { + subject.replace(re, "x"); + assertTrue(%RegexpHasBytecode(re, kLatin1)); + assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re, kUnicode)); +} + +subject.replace(re, "x"); +assertTrue(!%RegexpHasBytecode(re, kLatin1) && + %RegexpHasNativeCode(re, kLatin1)); +assertTrue(!%RegexpHasBytecode(re, kUnicode) && + !%RegexpHasNativeCode(re, kUnicode)); + +// Testing String.replace method for global regexps. +let re_g = /\w11111/g; +CheckRegexpNotYetCompiled(re_g); +// This regexp will not match, so it will only execute the bytecode once, +// each time the replace method is invoked, without tiering-up and +// recompiling to native code. +for (var i = 0; i < 5; i++) { + subject.replace(re_g, "x"); + assertTrue(%RegexpHasBytecode(re_g, kLatin1)); + assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); +} + +// This regexp will match, so it will execute five times, and tier-up. +re_g = /\w/g; +CheckRegexpNotYetCompiled(re_g); +subject.replace(re_g, "x"); +assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && + %RegexpHasNativeCode(re_g, kLatin1)); +assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); + +// Testing String.replace method for global regexps with a function as a +// parameter. This will tier-up eagerly and compile to native code right +// away, even though the regexp is only executed once. +function f() { return "x"; } +re_g = /\w2/g; +CheckRegexpNotYetCompiled(re_g); +subject.replace(re_g, f); +assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && + %RegexpHasNativeCode(re_g, kLatin1)); +assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); diff --git a/deps/v8/test/mjsunit/regexp-tier-up.js b/deps/v8/test/mjsunit/regexp-tier-up.js index e55e87f593..6269128f53 100644 --- a/deps/v8/test/mjsunit/regexp-tier-up.js +++ b/deps/v8/test/mjsunit/regexp-tier-up.js @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Tier-up behavior differs between slow and fast paths in functional -// RegExp.prototype.replace. -// Flags: --regexp-tier-up --allow-natives-syntax --no-force-slow-path +// Tier-up behavior differs between slow and fast paths in +// RegExp.prototype.replace with a function as an argument. +// Flags: --regexp-tier-up --regexp-tier-up-ticks=1 +// Flags: --allow-natives-syntax --no-force-slow-path --no-regexp-interpret-all const kLatin1 = true; const kUnicode = false; @@ -90,3 +91,15 @@ assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && %RegexpHasNativeCode(re_g, kLatin1)); assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && !%RegexpHasNativeCode(re_g, kUnicode)); + +// Testing eager tier-up for very long strings. +let dna = "ATCG".repeat(251); + +re_g = />.*\n|\n/; +CheckRegexpNotYetCompiled(re_g); + +dna = dna.replace(re_g,""); +assertTrue(!%RegexpHasBytecode(re_g, kLatin1) && + %RegexpHasNativeCode(re_g, kLatin1)); +assertTrue(!%RegexpHasBytecode(re_g, kUnicode) && + !%RegexpHasNativeCode(re_g, kUnicode)); diff --git a/deps/v8/test/mjsunit/regress/regress-1002827.js b/deps/v8/test/mjsunit/regress/regress-1002827.js new file mode 100644 index 0000000000..2acaf73deb --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1002827.js @@ -0,0 +1,13 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-gc + +var PI = new Proxy(this, { + get() { + PI(); + } +}); + +assertThrows(() => new gc(PI, {}), TypeError); diff --git a/deps/v8/test/mjsunit/regress/regress-1003730.js b/deps/v8/test/mjsunit/regress/regress-1003730.js new file mode 100644 index 0000000000..e20a4e4a44 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1003730.js @@ -0,0 +1,25 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax --concurrent-inlining + +function bar(error) { + try { + throw "didn't throw TypeError"; + } catch (err) { + error instanceof error, "didn't throw " + error.prototype.name; + } +} +function foo(param) { + bar(TypeError); +} +try { + bar(); +} catch (e) {} +%PrepareFunctionForOptimization(foo); +try { + foo(); +} catch (e) {} +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/mjsunit/regress/regress-1003919.js b/deps/v8/test/mjsunit/regress/regress-1003919.js new file mode 100644 index 0000000000..def45eeca4 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1003919.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Define an object with a getter and a proxy as it's prototype. +var obj = {foo: 'bar'}; +Object.defineProperty(obj, 'foo', { + get: function () { + } +}); +obj.__proto__ = new Proxy([], {}); + +// Get key from a function to avoid the property access turning into a +// named property access. +function getKey() { + return 'values' +} + +// Keyed access to update obj's values property. +obj[getKey()] = 1; diff --git a/deps/v8/test/mjsunit/regress/regress-1004912.js b/deps/v8/test/mjsunit/regress/regress-1004912.js new file mode 100644 index 0000000000..baa31db138 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1004912.js @@ -0,0 +1,12 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var key = { + toString() { + return Symbol(); + } +}; + +var obj = {}; +obj[key]; diff --git a/deps/v8/test/mjsunit/regress/regress-1005400.js b/deps/v8/test/mjsunit/regress/regress-1005400.js new file mode 100644 index 0000000000..77234235fe --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1005400.js @@ -0,0 +1,23 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function foo(a, key) { + a[key]; +} + +let obj = {}; +let count = 0; + +var key_obj = { + toString: function() { + count++; + // Force string to be internalized during keyed lookup. + return 'foo' + count; + } +}; + +foo(obj, key_obj); + +// We should only call toString once. +assertEquals(count, 1); diff --git a/deps/v8/test/mjsunit/regress/regress-1006629.js b/deps/v8/test/mjsunit/regress/regress-1006629.js new file mode 100644 index 0000000000..bd307fa228 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1006629.js @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const workerScript = ` + onmessage = function() { + };`; +const worker = new Worker(workerScript, {type: 'string'}); +const i32a = new Int32Array( new SharedArrayBuffer() ); +worker.postMessage([i32a.buffer]); diff --git a/deps/v8/test/mjsunit/regress/regress-1006640.js b/deps/v8/test/mjsunit/regress/regress-1006640.js new file mode 100644 index 0000000000..597b42057d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1006640.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-gc + +function main() { + const v2 = [1337,1337,1337,1337,1337]; + function v9() { + const v15 = {get:RegExp}; + Object.defineProperty(v2,501,v15); + const v18 = RegExp(); + const v19 = 1337 instanceof v18; + } + const v30 = {defineProperty:Function,get:v9,getPrototypeOf:Object}; + const v32 = new Proxy(ArrayBuffer,v30); + const v34 = gc(v32); +} + +assertThrows(() => main(), TypeError); diff --git a/deps/v8/test/mjsunit/regress/regress-1006670.js b/deps/v8/test/mjsunit/regress/regress-1006670.js new file mode 100644 index 0000000000..4d1408b3d1 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1006670.js @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertThrows(() => /(a?;?){4000000}/.exec("a"), RangeError); diff --git a/deps/v8/test/mjsunit/regress/regress-1011980.js b/deps/v8/test/mjsunit/regress/regress-1011980.js new file mode 100644 index 0000000000..89e4fed159 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1011980.js @@ -0,0 +1,22 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +let hex_b = 0x0b; +let hex_d = 0x0d; +let hex_20 = 0x20; +let hex_52 = 0x52; +let hex_fe = 0xfe; + +function f(a) { + let unused = [ a / 8, ...[ ...[ ...[], a / 8, ...[ 7, hex_fe, a, 0, 0, hex_20, + 6, hex_52, hex_d, 0, hex_b], 0, hex_b], hex_b]]; +} + +%PrepareFunctionForOptimization(f) +f(64) +f(64); +%OptimizeFunctionOnNextCall(f); +f(64); diff --git a/deps/v8/test/mjsunit/regress/regress-752764.js b/deps/v8/test/mjsunit/regress/regress-752764.js index 30ab7b2a6d..106d9edd87 100644 --- a/deps/v8/test/mjsunit/regress/regress-752764.js +++ b/deps/v8/test/mjsunit/regress/regress-752764.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --nostress-incremental-marking +// Stress-testing this test is very slow and provides no useful coverage. +// Flags: --nostress-opt --noalways-opt // This test uses a lot of memory and fails with flaky OOM when run // with --stress-incremental-marking on TSAN. diff --git a/deps/v8/test/mjsunit/regress/regress-779407.js b/deps/v8/test/mjsunit/regress/regress-779407.js index 140f7bdd74..71e57df9a7 100644 --- a/deps/v8/test/mjsunit/regress/regress-779407.js +++ b/deps/v8/test/mjsunit/regress/regress-779407.js @@ -10,4 +10,4 @@ for (var i = 0; i < 17; i++) { } catch (e) { } } -s.replace(/[a]/g); +s.replace(/a/g); diff --git a/deps/v8/test/mjsunit/regress/regress-9165.js b/deps/v8/test/mjsunit/regress/regress-9165.js index 1de6e9db2a..1709b488fd 100644 --- a/deps/v8/test/mjsunit/regress/regress-9165.js +++ b/deps/v8/test/mjsunit/regress/regress-9165.js @@ -14,12 +14,12 @@ let kSig_r_i = makeSig([kWasmI32], [kWasmAnyRef]); builder.addFunction("merge", kSig_r_i) .addLocals({anyref_count: 1, anyfunc_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmAnyRef, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprEnd, ]).exportFunc(); let instance = builder.instantiate(); @@ -33,12 +33,12 @@ let kSig_r_i = makeSig([kWasmI32], [kWasmAnyRef]); builder.addFunction("merge", kSig_r_i) .addLocals({anyfunc_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmAnyRef, kExprRefNull, kExprElse, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprEnd, ]).exportFunc(); let instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/regress-9832.js b/deps/v8/test/mjsunit/regress/regress-9832.js new file mode 100644 index 0000000000..41a8c38f0d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-9832.js @@ -0,0 +1,35 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-eh + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function TestRegress9832() { + let builder = new WasmModuleBuilder(); + let f = builder.addFunction("f", kSig_i_i) + .addBody([ + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprI32Add, + ]).exportFunc(); + builder.addFunction("main", kSig_i_i) + .addLocals({except_count: 1}) + .addBody([ + kExprTry, kWasmStmt, + kExprLocalGet, 0, + kExprCallFunction, f.index, + kExprCallFunction, f.index, + kExprLocalSet, 0, + kExprCatch, + kExprDrop, + kExprLocalGet, 0, + kExprCallFunction, f.index, + kExprLocalSet, 0, + kExprEnd, + kExprLocalGet, 0, + ]).exportFunc(); + let instance = builder.instantiate(); + assertEquals(92, instance.exports.main(23)); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-9894.js b/deps/v8/test/mjsunit/regress/regress-9894.js new file mode 100644 index 0000000000..0a7bf5d456 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-9894.js @@ -0,0 +1,48 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +(function frozen() { + const ary = [1.1] + Object.defineProperty(ary, 0, {get:run_it} ); + + // v8::internal::Runtime_ArrayIncludes_Slow. + ary.includes(); + + function run_it(el) { + ary.length = 0; + ary[0] = 1.1; + Object.freeze(ary); + return 2.2; + } +})(); + +(function seal() { + const ary = [1.1] + Object.defineProperty(ary, 0, {get:run_it} ); + + // v8::internal::Runtime_ArrayIncludes_Slow. + ary.includes(); + + function run_it(el) { + ary.length = 0; + ary[0] = 1.1; + Object.seal(ary); + return 2.2; + } +})(); + +(function preventExtensions() { + const ary = [1.1] + Object.defineProperty(ary, 0, {get:run_it} ); + + // v8::internal::Runtime_ArrayIncludes_Slow. + ary.includes(); + + function run_it(el) { + ary.length = 0; + ary[0] = 1.1; + Object.preventExtensions(ary); + return 2.2; + } +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-996161.js b/deps/v8/test/mjsunit/regress/regress-996161.js new file mode 100644 index 0000000000..dada3f47bd --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-996161.js @@ -0,0 +1,43 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function checkOwnProperties(v, count) { + var properties = Object.getOwnPropertyNames(v); + assertEquals(properties.length, count); +} + + +function testStoreNoFeedback() { + arr = new Int32Array(10); + function f(a) { a["-1"] = 15; } + + for (var i = 0; i < 3; i++) { + arr.__defineGetter__("x", function() { }); + checkOwnProperties(arr, 11); + f(arr); + } +} +testStoreNoFeedback(); + +function testStoreGeneric() { + arr = new Int32Array(10); + var index = "-1"; + function f1(a) { a[index] = 15; } + %EnsureFeedbackVectorForFunction(f1); + + // Make a[index] in f1 megamorphic + f1({a: 1}); + f1({b: 1}); + f1({c: 1}); + f1({d: 1}); + + for (var i = 0; i < 3; i++) { + arr.__defineGetter__("x", function() { }); + checkOwnProperties(arr, 11); + f1(arr); + } +} +testStoreGeneric(); diff --git a/deps/v8/test/mjsunit/regress/regress-997485.js b/deps/v8/test/mjsunit/regress/regress-997485.js new file mode 100644 index 0000000000..bcc1664222 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-997485.js @@ -0,0 +1,127 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function doubleToTaggedWithTaggedValueStoresCorrectly() { + + function setX_Double(o) { o.x = 4.2; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Double, to make sure setX_Double has + // Double feedback. + setX_Double(o); + setX_Double(o); + + // Transition o.x to Tagged. + o.x = {}; + + // setX_Double will still have Double feedback, so make sure it works with + // the new Tagged representation o.x. + setX_Double(o); + + assertEquals(o.x, 4.2); + } + + %EnsureFeedbackVectorForFunction(setX_Double); + foo(); + +})(); + +(function doubleToTaggedWithDoubleValueDoesNotMutate() { + + function setX_Double(o) { o.x = 4.2; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Double, to make sure setX_Double has + // Double feedback. + setX_Double(o); + setX_Double(o); + + // Transition o.x to Tagged. + o.x = {}; + + // Write the HeapNumber val to o.x. + const val = 1.25; + o.x = val; + + // setX_Double will still have Double feedback, which expects to be able to + // mutate o.x's HeapNumber, so make sure it does not mutate val. + setX_Double(o); + + assertEquals(o.x, 4.2); + assertNotEquals(val, 4.2); + } + + %EnsureFeedbackVectorForFunction(setX_Double); + foo(); + +})(); + +(function doubleToTaggedWithTaggedValueStoresSmiCorrectly() { + + function setX_Smi(o) { o.x = 42; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Smi, to make sure setX_Smi has + // Double feedback. + setX_Smi(o); + setX_Smi(o); + + // Transition o.x to Tagged. + o.x = {}; + + // setX_Smi will still have Double feedback, so make sure it works with + // the new Tagged representation o.x. + setX_Smi(o); + + assertEquals(o.x, 42); + } + + %EnsureFeedbackVectorForFunction(setX_Smi); + foo(); + +})(); + +(function doubleToTaggedWithSmiValueDoesNotMutate() { + + function setX_Smi(o) { o.x = 42; } + + function foo() { + // o.x starts off as Double + const o = { x: 0.1 }; + + // Write to it a few times with setX_Smi, to make sure setX_Smi has + // Double feedback. + setX_Smi(o); + setX_Smi(o); + + // Transition o.x to Tagged. + o.x = {}; + + // Write the HeapNumber val to o.x. + const val = 1.25; + o.x = val; + + // setX_Smi will still have Double feedback, which expects to be able to + // mutate o.x's HeapNumber, so make sure it does not mutate val. + setX_Smi(o); + + assertEquals(o.x, 42); + assertNotEquals(val, 42); + } + + %EnsureFeedbackVectorForFunction(setX_Smi); + foo(); + +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-997989.js b/deps/v8/test/mjsunit/regress/regress-997989.js new file mode 100644 index 0000000000..f049a31724 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-997989.js @@ -0,0 +1,27 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +// A function with a for-in loop, that will be optimized. +function foo(o) { + for (var i in o) { + return o[i]; + } +} + +var o = { x: 0.5 }; + +// Warm up foo with Double values in the enum cache. +%PrepareFunctionForOptimization(foo); +assertEquals(foo(o), 0.5); +assertEquals(foo(o), 0.5); +%OptimizeFunctionOnNextCall(foo); +assertEquals(foo(o), 0.5); + +// Transition the double field to a tagged field +o.x = "abc"; + +// Make sure that the optimized code correctly loads the tagged field. +assertEquals(foo(o), "abc"); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1002628.js b/deps/v8/test/mjsunit/regress/regress-crbug-1002628.js new file mode 100644 index 0000000000..8be7e8687d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1002628.js @@ -0,0 +1,22 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --always-opt + +"use strict"; +var __v_0 = {}; +try { + __v_0 = this; + Object.freeze(__v_0); +} +catch (e) { +} + +function f() { + x = { [Symbol.toPrimitive]: () => FAIL }; +} +try { + f() +} catch (e) { } +assertThrows(() => f(), ReferenceError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1003403.js b/deps/v8/test/mjsunit/regress/regress-crbug-1003403.js new file mode 100644 index 0000000000..877b9c8c73 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1003403.js @@ -0,0 +1,10 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --enable-lazy-source-positions --stress-lazy-source-positions +// Flags: --no-lazy +({ x: b = 0 }) => { + try { b; } catch (e) {} + function a() { b } +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1003732.js b/deps/v8/test/mjsunit/regress/regress-crbug-1003732.js new file mode 100644 index 0000000000..5e2bbe7732 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1003732.js @@ -0,0 +1,25 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function f_1() { + var v = new Array(); + v[0] = 10; + return v; +} + +function test() { + var setter_called = false; + // Turn array to NumberDictionary + Array.prototype[123456789] = 42; + assertEquals(f_1().length, 1); + + // Reset to empty_slow_dictionary + Array.prototype.length = 0; + + // This should reset the prototype validity cell. + Array.prototype.__defineSetter__("0", function() {setter_called = true}); + f_1(); + assertEquals(setter_called, true); +} +test(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1004037.js b/deps/v8/test/mjsunit/regress/regress-crbug-1004037.js new file mode 100644 index 0000000000..cf7ba70458 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1004037.js @@ -0,0 +1,23 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --always-opt + +__v_1 = {}; +__v_1.__defineGetter__('x', function () { }); +__proto__ = __v_1; +function __f_4() { + __v_1 = {}; +} +function __f_3() { + 'use strict'; + x = 42; +} +__f_4() +try { + __f_3(); +} catch (e) { } + +__proto__ = __v_1; +assertThrows(() => __f_3(), ReferenceError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1004061.js b/deps/v8/test/mjsunit/regress/regress-crbug-1004061.js new file mode 100644 index 0000000000..8b36d4d609 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1004061.js @@ -0,0 +1,55 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function testPackedDoublesIncludes() { + arr = [1.5, 2.5]; + arr.length = 0; + function f() { + return arr.includes(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), false); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), false); +})(); + +(function testHoleyDoublesIncludes() { + arr = [1.1]; + arr[3]= 1.5; + arr.length = 0; + function f() { + return arr.includes(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), false); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), false); +})(); + +(function testPackedDoublesIndexOf() { + arr = [1.5, 2.5]; + arr.length = 0; + function f() { + return arr.indexOf(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), -1); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), -1); +})(); + +(function testHoleyDoublesIndexOf() { + arr = [1.1]; + arr[3]= 1.5; + arr.length = 0; + function f() { + return arr.indexOf(1); + }; + %PrepareFunctionForOptimization(f); + assertEquals(f(), -1); + %OptimizeFunctionOnNextCall(f); + assertEquals(f(), -1); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1006592.js b/deps/v8/test/mjsunit/regress/regress-crbug-1006592.js new file mode 100644 index 0000000000..c051d0861a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1006592.js @@ -0,0 +1,21 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function Module(stdlib) { + "use asm"; + var fround = stdlib.Math.fround; + function f(a, b) { + a = +a; + b = +b; + return fround(a, b); + } + return { f: f }; +} + +var m = Module(this); +assertEquals(23, m.f(23)); +assertEquals(42, m.f(42, 65)); +assertFalse(%IsAsmWasmCode(Module)); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1008632.js b/deps/v8/test/mjsunit/regress/regress-crbug-1008632.js new file mode 100644 index 0000000000..8b46baefa1 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1008632.js @@ -0,0 +1,24 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --no-lazy-feedback-allocation + +var __v_9690 = function () {}; +try { + (function () { + __f_1653(); + })() +} catch (__v_9763) { +} +function __f_1653(__v_9774, __v_9775) { + try { + } catch (e) {} + __v_9774[__v_9775 + 4] = 2; +} +(function () { + %PrepareFunctionForOptimization(__f_1653); + __f_1653(__v_9690, true); + %OptimizeFunctionOnNextCall(__f_1653); + assertThrows(() => __f_1653(), TypeError); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1012301-1.js b/deps/v8/test/mjsunit/regress/regress-crbug-1012301-1.js new file mode 100644 index 0000000000..9c2f87c4fe --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1012301-1.js @@ -0,0 +1,27 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function get() { + // Update the descriptor array now shared between the Foo map and the + // (Foo + c) map. + o1.c = 10; + // Change the type of the field on the new descriptor array in-place to + // Tagged. If Object.assign has a cached descriptor array, then it will point + // to the old Foo map's descriptors, which still have .b as Double. + o2.b = "string"; + return 1; +} + +function Foo() { + Object.defineProperty(this, "a", {get, enumerable: true}); + // Initialise Foo.b to have Double representation. + this.b = 1.5; +} + +var o1 = new Foo(); +var o2 = new Foo(); +var target = {}; +Object.assign(target, o2); +// Make sure that target has the right representation after assignment. +assertEquals(target.b, "string"); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1012301.js b/deps/v8/test/mjsunit/regress/regress-crbug-1012301.js new file mode 100644 index 0000000000..dc2ef92a6f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1012301.js @@ -0,0 +1,23 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --allow-natives-syntax + +function f(o) { + // The spread after the CloneObject IC shouldn't crash when trying to write a + // double value to a field created by CloneObject. + return {...o, ...{a:1.4}}; +} + +%EnsureFeedbackVectorForFunction(f); + +var o = {}; +// Train the CloneObject IC with a Double field. +o.a = 1.5; +f(o); +f(o); +f(o); +// Change the source map to have a Tagged field. +o.a = undefined; +f(o); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1015567.js b/deps/v8/test/mjsunit/regress/regress-crbug-1015567.js new file mode 100644 index 0000000000..520d6c539b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1015567.js @@ -0,0 +1,5 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertThrows('a ( { b() {} } [ [ 1 , c.d = 1 ] = 1.1 ] )', SyntaxError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1015945.js b/deps/v8/test/mjsunit/regress/regress-crbug-1015945.js new file mode 100644 index 0000000000..a43736e7b5 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1015945.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-async-hooks + +async function* foo() { + await 1; + throw new Error(); +} + +(async () => { + for await (const x of foo()) { } +})(); + +async_hooks.createHook({ + promiseResolve() { + throw new Error(); + } +}).enable() diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-729597.js b/deps/v8/test/mjsunit/regress/regress-crbug-729597.js index b4c54e8e88..7656bc048a 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-729597.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-729597.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --verify-heap +// Flags: --verify-heap --expose-gc function __f_3(f) { arguments.__defineGetter__('length', f); @@ -13,6 +13,7 @@ function __f_4() { return "boom"; } __v_4 = []; __v_13 = ""; -for (var i = 0; i < 12800; ++i) { +for (var i = 0; i < 128; ++i) { __v_13 += __v_4.__proto__ = __f_3(__f_4); } +gc(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-808192.js b/deps/v8/test/mjsunit/regress/regress-crbug-808192.js index f57d5fc3a6..af92ce7f35 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-808192.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-808192.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --expose-gc +// Stress-testing this test is very slow and doesn't provide useful coverage. +// Flags: --nostress-opt --noalways-opt const f = eval(`(function f(i) { if (i == 0) { diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-941743.js b/deps/v8/test/mjsunit/regress/regress-crbug-941743.js index eaac4c4c4d..81416b8725 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-941743.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-941743.js @@ -3,6 +3,8 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax --noenable-slow-asserts +// This test triggers optimization manually, no stress mode necessary. +// Flags: --nostress-opt --noalways-opt // This call ensures that TurboFan won't inline array constructors. Array(2 ** 30); diff --git a/deps/v8/test/mjsunit/regress/regress-v8-9758.js b/deps/v8/test/mjsunit/regress/regress-v8-9758.js new file mode 100644 index 0000000000..7f9eab3339 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-v8-9758.js @@ -0,0 +1,9 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --throws + +// Can't put this in a try-catch as that changes the parsing so the crash +// doesn't reproduce. +((a = ((b = a) => {})()) => 1)(); diff --git a/deps/v8/test/mjsunit/regress/regress-v8-9825.mjs b/deps/v8/test/mjsunit/regress/regress-v8-9825.mjs new file mode 100644 index 0000000000..f8d0708848 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-v8-9825.mjs @@ -0,0 +1,11 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +async function foo() { + for (;;await[]) { + break; + } +} + +foo(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-02256.js b/deps/v8/test/mjsunit/regress/wasm/regress-02256.js index 199626b3c3..63da0cc10b 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-02256.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-02256.js @@ -273,19 +273,19 @@ try { function __f_16() { var __v_1 = new WasmModuleBuilder(); __v_1.addFunction("grow_memory", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow]) .exportFunc(); __v_1.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); __v_1.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, kExprLocalGet, 1]) .exportFunc(); __v_1.addFunction("load16", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem16U, 0, 0]) .exportFunc(); __v_1.addFunction("store16", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem16, 0, 0, kExprLocalGet, 1]) .exportFunc(); __v_1.__p_1551105852 = __v_1[getRandomProperty(__v_1, 1551105852)]; __v_1.__defineGetter__(getRandomProperty(__v_1, 348910887), function() { @@ -294,10 +294,10 @@ function __f_16() { return __v_1.__p_1551105852; }); __v_1.addFunction("load8", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem8U, 0, 0]) .exportFunc(); __v_1.addFunction("store8", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem8, 0, 0, kExprLocalGet, 1]) .exportFunc(); return __v_1; } diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-1014798.js b/deps/v8/test/mjsunit/regress/wasm/regress-1014798.js new file mode 100644 index 0000000000..98f0314b99 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-1014798.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +const builder = new WasmModuleBuilder(); +builder.addFunction('main', kSig_i_iii) + .addLocals({f32_count: 4}) + .addLocals({i64_count: 1}) + .addLocals({f32_count: 2}) + .addBodyWithEnd([ + kExprI64Const, 0, + kExprLocalGet, 3, + kExprI64SConvertF32, + kExprI64Ne, + kExprEnd, // @17 + ]).exportFunc(); +const instance = builder.instantiate(); +assertEquals(0, instance.exports.main(1, 2, 3)); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-1016515.js b/deps/v8/test/mjsunit/regress/wasm/regress-1016515.js new file mode 100644 index 0000000000..f56579912d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-1016515.js @@ -0,0 +1,20 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --wasm-lazy-compilation + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +var builder = new WasmModuleBuilder(); +var func = builder.addFunction('func', kSig_i_v).addBody([kExprI32Const, 1]); +var body = []; +for (let i = 0; i < 200; ++i) { + body.push(kExprCallFunction, func.index); +} +for (let i = 1; i < 200; ++i) { + body.push(kExprI32Add); +} +builder.addFunction('test', kSig_i_v).addBody(body).exportFunc(); +var instance = builder.instantiate(); +instance.exports.test(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-648079.js b/deps/v8/test/mjsunit/regress/wasm/regress-648079.js index fbb5414480..cf4bf1c698 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-648079.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-648079.js @@ -8,7 +8,6 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // Non-standard opcodes. let kSig_s_v = makeSig([], [kWasmS128]); -let kExprS128LoadMem = 0xc0; (function() { "use asm"; @@ -109,7 +108,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF32Min, kExprI64GtU, kExprBlock, 01, // @107 i32 - kExprTeeLocal, + kExprLocalTee, kExprBlock, 01, // @111 i32 kExprBlock, 01, // @113 i32 kExprBlock, 01, // @115 i32 @@ -169,7 +168,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF64Sub, kExprI32Const, kExprUnreachable, - kExprGetLocal, + kExprLocalGet, kExprI64LoadMem32U, kExprUnreachable, kExprI64RemU, @@ -273,7 +272,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF64Sub, kExprI32Const, kExprUnreachable, - kExprGetLocal, + kExprLocalGet, kExprI64LoadMem32U, kExprUnreachable, kExprUnreachable, @@ -300,7 +299,7 @@ builder.addFunction("regression_648079", kSig_s_v) kExprF64Sub, kExprI32Const, kExprUnreachable, - kExprGetLocal, + kExprLocalGet, kExprI64LoadMem32U, kExprF64Min, kExprF64Min, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-689450.js b/deps/v8/test/mjsunit/regress/wasm/regress-689450.js index bcd25387b4..a629766bce 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-689450.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-689450.js @@ -9,7 +9,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.addMemory(16, 32, false); builder.addFunction('test', kSig_i_i) .addBodyWithEnd([ - kExprGetLocal, 0x00, + kExprLocalGet, 0x00, kExprI32Const, 0x29, kExprI32Shl, kExprI32Const, 0x18, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-702460.js b/deps/v8/test/mjsunit/regress/wasm/regress-702460.js index 21a84bcf28..3f1e11e393 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-702460.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-702460.js @@ -4,10 +4,6 @@ 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(); @@ -20,7 +16,7 @@ let kExprS128LoadMem = 0xc0; kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, - kExprSetLocal, 0x00, + kExprLocalSet, 0x00, kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, kExprMemoryGrow, 0x00, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7049.js b/deps/v8/test/mjsunit/regress/wasm/regress-7049.js index 6d2cd351fb..46dce4a871 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7049.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7049.js @@ -20,7 +20,7 @@ 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, // - + kExprLocalGet, 0, // - kExprCallFunction, imp ]) .exportFunc(); @@ -31,14 +31,14 @@ 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 + kExprLocalGet, 0, // 1 + kExprLocalGet, 0, // 2 + kExprLocalGet, 0, // 3 + kExprLocalGet, 0, // 4 + kExprLocalGet, 0, // 5 + kExprLocalGet, 0, // 6 + kExprLocalGet, 0, // 7 + kExprLocalGet, 0, // 8 kExprCallFunction, func1_imp ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7353.js b/deps/v8/test/mjsunit/regress/wasm/regress-7353.js index 81f45fe6a5..671da730fb 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7353.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7353.js @@ -9,17 +9,17 @@ 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, + kExprLocalGet, 0, kExprMemoryGrow, 0, ]).exportFunc(); builder.addFunction('main', kSig_i_i).addBody([ ...wasmI32Const(0x41), - kExprSetLocal, 0, + kExprLocalSet, 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, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0, ]).exportFunc(); const instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7366.js b/deps/v8/test/mjsunit/regress/wasm/regress-7366.js index b5cae8daa4..b5e4e2e2b6 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7366.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7366.js @@ -7,22 +7,22 @@ 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 + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 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 + kExprLocalSet, 0, // set_local 0 ...wasmI32Const(4), // i32.const 0x1 - kExprSetLocal, 1, // set_local 1 + kExprLocalSet, 1, // set_local 1 ...wasmI32Const(16), // i32.const 0x1 - kExprSetLocal, 2, // set_local 2 + kExprLocalSet, 2, // set_local 2 kExprLoop, kWasmStmt, // loop kExprEnd, // end - kExprGetLocal, 0, // get_local 0 - kExprGetLocal, 1, // get_local 1 - kExprGetLocal, 2, // get_local 2 + kExprLocalGet, 0, // get_local 0 + kExprLocalGet, 1, // get_local 1 + kExprLocalGet, 2, // get_local 2 kExprI32Const, 0, // i32.const 0 (func index) kExprCallIndirect, sig, 0, // call indirect ]) diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-739768.js b/deps/v8/test/mjsunit/regress/wasm/regress-739768.js index 5fca49bc0f..0bd73223c9 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-739768.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-739768.js @@ -11,7 +11,7 @@ builder0.setName('module_0'); let sig_index = builder0.addType(kSig_i_v); builder0.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index, kTableZero ]) // -- .exportAs('main'); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7422.js b/deps/v8/test/mjsunit/regress/wasm/regress-7422.js index 71e1eb89bd..6bf737857a 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7422.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7422.js @@ -6,18 +6,18 @@ 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.addFunction(undefined, sig).addBody([kExprLocalGet, 4]); builder.addMemory(16, 32); builder.addFunction('main', sig) .addBody([ - kExprI32Const, 0, kExprSetLocal, 0, + kExprI32Const, 0, kExprLocalSet, 0, // Compute five arguments to the function call. kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, - kExprGetLocal, 4, kExprI32Const, 1, kExprI32Add, + kExprLocalGet, 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, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add, kExprLocalGet, 1, + kExprLocalGet, 1, kExprI32Add, kExprI32Add, kExprDrop, // Now call the function. kExprCallFunction, 0 ]) diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7508.js b/deps/v8/test/mjsunit/regress/wasm/regress-7508.js index 10ce500a44..1c02060957 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7508.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7508.js @@ -15,6 +15,6 @@ builder.addFunction(undefined, kSig_v_v).addLocals({i64_count: 1}).addBody([ kExprI32Const, 0, // i32.const kExprEnd, // end kExprBrIf, 0, // br_if depth=0 - kExprSetLocal, 0, // set_local 0 + kExprLocalSet, 0, // set_local 0 ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-752423.js b/deps/v8/test/mjsunit/regress/wasm/regress-752423.js index 938ecbf252..304dbd955d 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-752423.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-752423.js @@ -13,7 +13,7 @@ builder.addImportedTable("x", "table", 1, 10000000); builder.addFunction("main", kSig_i_i) .addBody([ kExprI32Const, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero]) .exportAs("main"); let module = new WebAssembly.Module(builder.toBuffer()); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7565.js b/deps/v8/test/mjsunit/regress/wasm/regress-7565.js index c9d4e2ca88..3b97fe8615 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7565.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7565.js @@ -9,7 +9,7 @@ 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 + kExprLocalGet, 0x00, // get_local 0 --> i64:0 kExprF32SConvertI64, // f32.sconvert/i64 --> f32:0 kExprF32Ge, // f32.ge --> i32:1 kExprEnd, // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7579.js b/deps/v8/test/mjsunit/regress/wasm/regress-7579.js index 876a76cad9..da774b00f1 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7579.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7579.js @@ -51,7 +51,7 @@ 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 + kExprLocalGet, 0, // get_local 3 kExprF32SConvertI64, // f32.sconvert/i64 kExprI32ReinterpretF32, // i32.reinterpret/f32 kExprEnd // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-763697.js b/deps/v8/test/mjsunit/regress/wasm/regress-763697.js index c831a55fba..5f36d42c8d 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-763697.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-763697.js @@ -8,7 +8,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .addLocals({s128_count: 1}); assertFalse(WebAssembly.validate(builder.toBuffer())); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-771243.js b/deps/v8/test/mjsunit/regress/wasm/regress-771243.js index 81b9e8f2a9..c06adebd76 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-771243.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-771243.js @@ -25,7 +25,7 @@ function __f_1() { __v_21 = __f_1(__v_18 = false, __v_25 = kSig_i_i); __v_21.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, __v_29 ]) .exportFunc(); __v_32 = diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-772332.js b/deps/v8/test/mjsunit/regress/wasm/regress-772332.js index e8547c8175..54676b198e 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-772332.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-772332.js @@ -19,7 +19,7 @@ function __f_15356(__v_50316, __v_50317) { } (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(); + __v_50320.addFunction('plus_one', kSig_i_i).addBody([kExprLocalGet, 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({ diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7785.js b/deps/v8/test/mjsunit/regress/wasm/regress-7785.js index 72638b1685..9f06ae5f10 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-7785.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-7785.js @@ -24,7 +24,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); (function testAnyRefIsNull() { const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_i_r) - .addBody([kExprGetLocal, 0, kExprRefIsNull]) + .addBody([kExprLocalGet, 0, kExprRefIsNull]) .exportFunc(); var wire_bytes = builder.toBuffer(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-791810.js b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js index 73b47bdd78..3daeff9e15 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-791810.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js @@ -7,7 +7,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder = new WasmModuleBuilder(); builder.addFunction('test', kSig_i_i) .addBody([ - kExprGetLocal, 0x00, // get_local 0 + kExprLocalGet, 0x00, // get_local 0 kExprBlock, kWasmStmt, // block kExprBr, 0x00, // br depth=0 kExprEnd, // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-793551.js b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js index 657b2c0013..ac2b34019e 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-793551.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js @@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder(); builder.addFunction('test', kSig_i_i) .addBody([ // body: - kExprGetLocal, 0, // get_local 0 - kExprGetLocal, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 kExprLoop, kWasmStmt, // loop kExprBr, 0, // br depth=0 kExprEnd, // end diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-801785.js b/deps/v8/test/mjsunit/regress/wasm/regress-801785.js index 105fd4bc38..7c68a0d593 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-801785.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-801785.js @@ -10,11 +10,11 @@ const builder = new WasmModuleBuilder(); builder.addMemory(8, 16); builder.addFunction(undefined, kSig_i_i).addBody([ // wasm to wasm call. - kExprGetLocal, 0, kExprCallFunction, 0x1 + kExprLocalGet, 0, kExprCallFunction, 0x1 ]); builder.addFunction(undefined, kSig_i_i).addBody([ // load from <get_local 0> to create trap code. - kExprGetLocal, 0, kExprI32LoadMem, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, // unreachable to create a runtime call. kExprUnreachable ]); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-802244.js b/deps/v8/test/mjsunit/regress/wasm/regress-802244.js index aeaf850365..e212ec05d1 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-802244.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-802244.js @@ -8,10 +8,10 @@ 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 + kExprLocalGet, 0x00, // get_local 0 + kExprLocalGet, 0x01, // get_local 1 kExprBrIf, 0x01, // br_if depth=1 - kExprGetLocal, 0x00, // get_local 0 + kExprLocalGet, 0x00, // get_local 0 kExprI32Rol, // i32.rol kExprBrIf, 0x00, // br_if depth=0 kExprUnreachable, // unreachable diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js index 78ee6bd1d2..4ee9cd3c43 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js @@ -9,7 +9,7 @@ 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]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); let module = builder.toModule(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js index 57920de09d..269489059f 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js @@ -27,11 +27,11 @@ function varuint32(val) { let body = []; for (let i = 0; i < kNumLocals; ++i) { - body.push(kExprCallFunction, 0, kExprSetLocal, ...varuint32(i)); + body.push(kExprCallFunction, 0, kExprLocalSet, ...varuint32(i)); } for (let i = 0; i < kNumLocals; ++i) { - body.push(kExprGetLocal, ...varuint32(i), kExprCallFunction, 1); + body.push(kExprLocalGet, ...varuint32(i), kExprCallFunction, 1); } let builder = new WasmModuleBuilder(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808980.js b/deps/v8/test/mjsunit/regress/wasm/regress-808980.js index d78c07f36c..6487a35cd3 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-808980.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-808980.js @@ -10,7 +10,7 @@ let kTableSize = 3; var builder = new WasmModuleBuilder(); var sig_index1 = builder.addType(kSig_i_v); builder.addFunction('main', kSig_i_ii).addBody([ - kExprGetLocal, + kExprLocalGet, 0, kExprCallIndirect, sig_index1, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-817380.js b/deps/v8/test/mjsunit/regress/wasm/regress-817380.js index c7748d8904..23ab2a5c91 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-817380.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-817380.js @@ -8,7 +8,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder1 = new WasmModuleBuilder(); builder1.addFunction('mul', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Mul]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Mul]) .exportFunc(); const mul = builder1.instantiate().exports.mul; const table = new WebAssembly.Table({ diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-834619.js b/deps/v8/test/mjsunit/regress/wasm/regress-834619.js index 1062d5547a..af7043904e 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-834619.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-834619.js @@ -29,7 +29,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addTable(kWasmAnyFunc, 4); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-834624.js b/deps/v8/test/mjsunit/regress/wasm/regress-834624.js index 45af23cde2..3e3548ed32 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-834624.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-834624.js @@ -14,7 +14,7 @@ let instance; let module = new WasmModuleBuilder(); module.addImport('mod', 'func', kSig_v_i); module.addFunction('main', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); instance = module.instantiate({ mod: { diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8505.js b/deps/v8/test/mjsunit/regress/wasm/regress-8505.js index b1fdedfc93..c1becbe454 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-8505.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-8505.js @@ -171,8 +171,8 @@ function wasmBinop(name, sig) { builder.addImport('Math', name, sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 ]) // -- .exportAs('main'); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-854011.js b/deps/v8/test/mjsunit/regress/wasm/regress-854011.js index b0356a873f..00cfe655cb 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-854011.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-854011.js @@ -9,14 +9,14 @@ 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 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 0 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 1 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 2 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 3 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 4 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 5 + kExprLocalGet, 0, kExprI64SConvertF64, // arg 6 + kExprLocalGet, 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 @@ -36,7 +36,7 @@ builder.addFunction('main', kSig_d_d) .exportFunc(); builder.addFunction(undefined, makeSig(new Array(8).fill(kWasmI64), [kWasmF64])) .addBody([ - kExprGetLocal, 7, // get_local 7 (last parameter) + kExprLocalGet, 7, // get_local 7 (last parameter) kExprF64SConvertI64, // f64.convert_s/i64 ]); const instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-854050.js b/deps/v8/test/mjsunit/regress/wasm/regress-854050.js index d6c4829acd..7130595870 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-854050.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-854050.js @@ -8,18 +8,18 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], [])) .addLocals({i32_count: 7}) .addBody([ - kExprGetLocal, 0, // get_local + kExprLocalGet, 0, // get_local kExprI32Const, 0, // i32.const 0 kExprIf, kWasmStmt, // if kExprUnreachable, // unreachable kExprEnd, // end if - kExprGetLocal, 4, // get_local - kExprTeeLocal, 8, // tee_local + kExprLocalGet, 4, // get_local + kExprLocalTee, 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 + kExprLocalTee, 7, // tee_local + kExprLocalTee, 0, // tee_local + kExprLocalTee, 2, // tee_local + kExprLocalTee, 8, // tee_local kExprDrop, // drop kExprLoop, kWasmStmt, // loop kExprEnd, // end loop diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-864509.js b/deps/v8/test/mjsunit/regress/wasm/regress-864509.js index 19e3bfcfb8..45e9e0b898 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-864509.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-864509.js @@ -10,7 +10,7 @@ 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 + kExprLocalGet, 0, // get_local 0 kExprI32Const, 0, // i32.const 0 kExprI32StoreMem, 0, 0, // i32.store offset=0 ]); @@ -19,7 +19,7 @@ builder.addFunction(undefined, kSig_v_i).addBody([ // is loaded as 64-bit value on x64. builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), [])) .addBody([ - kExprGetLocal, 5, // get_local 5 + kExprLocalGet, 5, // get_local 5 kExprCallFunction, 0 // call 0 ]); // The third function is Liftoff again. A value is spilled on the stack as i32, @@ -27,8 +27,8 @@ builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), [])) // 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 + kExprLocalTee, 0, // tee_local 0 + kExprLocalGet, 0, // get_local 0 kExprI32Const, 1, // i32.const 1 kExprI32Add // i32.add --> 2nd param ]; diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-894307.js b/deps/v8/test/mjsunit/regress/wasm/regress-894307.js index f40388fcb4..a9a3595fbc 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-894307.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-894307.js @@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder(); const sig = makeSig([kWasmI32, kWasmI64, kWasmI64], [kWasmI64]); builder.addFunction(undefined, sig) .addBody([ - kExprGetLocal, 2, - kExprGetLocal, 1, + kExprLocalGet, 2, + kExprLocalGet, 1, kExprI64Shl, ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-910824.js b/deps/v8/test/mjsunit/regress/wasm/regress-910824.js index b795425b1f..6101f8ca81 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-910824.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-910824.js @@ -11,26 +11,26 @@ builder.addType(makeSig([kWasmI32, kWasmF32, kWasmF32, kWasmF64], [kWasmI32])); builder.addFunction(undefined, 0 /* sig */) .addLocals({i32_count: 504}) .addBody([ -kExprGetGlobal, 0x00, -kExprSetLocal, 0x04, -kExprGetLocal, 0x04, +kExprGlobalGet, 0x00, +kExprLocalSet, 0x04, +kExprLocalGet, 0x04, kExprI32Const, 0x01, kExprI32Sub, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x00, kExprI32Eqz, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x01, kExprI32Const, 0x01, kExprI32Sub, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x00, kExprI32Eqz, -kExprGetGlobal, 0x00, +kExprGlobalGet, 0x00, kExprI32Const, 0x00, kExprI32Const, 0x01, kExprI32Sub, -kExprGetGlobal, 0x01, +kExprGlobalGet, 0x01, kExprUnreachable, ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-917412.js b/deps/v8/test/mjsunit/regress/wasm/regress-917412.js index b74572ac8a..4b9528ccf6 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-917412.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-917412.js @@ -14,11 +14,11 @@ kExprIf, kWasmI32, kExprElse, kExprI32Const, 1, kExprEnd, -kExprTeeLocal, 0, -kExprGetLocal, 0, +kExprLocalTee, 0, +kExprLocalGet, 0, kExprLoop, kWasmStmt, kExprI64Const, 0x80, 0x80, 0x80, 0x70, - kExprSetLocal, 0x01, + kExprLocalSet, 0x01, kExprI32Const, 0x00, kExprIf, kWasmI32, kExprI32Const, 0x00, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-918284.js b/deps/v8/test/mjsunit/regress/wasm/regress-918284.js index dadbf3f7ea..16de9caabd 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-918284.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-918284.js @@ -14,7 +14,7 @@ builder.addFunction(undefined, kSig_i_i) kExprElse, // @15 kExprI32Const, 1, kExprEnd, // @18 - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprI32Popcnt ]); builder.instantiate(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-918917.js b/deps/v8/test/mjsunit/regress/wasm/regress-918917.js index f007957c6f..3660244cda 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-918917.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-918917.js @@ -8,9 +8,9 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_v_v) .addLocals({i32_count: 1}).addLocals({f32_count: 1}).addLocals({f64_count: 1}) .addBody([ -kExprGetLocal, 1, -kExprGetLocal, 2, -kExprGetLocal, 0, +kExprLocalGet, 1, +kExprLocalGet, 2, +kExprLocalGet, 0, kExprIf, kWasmI32, kExprI32Const, 1, kExprElse, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-919308.js b/deps/v8/test/mjsunit/regress/wasm/regress-919308.js index 8c454413e8..e2f0426702 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-919308.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-919308.js @@ -8,23 +8,23 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_i_i) .addLocals({i32_count: 5}) .addBody([ - kExprGetLocal, 0, // --> 1 + kExprLocalGet, 0, // --> 1 kExprIf, kWasmI32, - kExprGetLocal, 0, // --> 1 + kExprLocalGet, 0, // --> 1 kExprElse, kExprUnreachable, kExprEnd, kExprIf, kWasmI32, - kExprGetLocal, 0, // --> 1 + kExprLocalGet, 0, // --> 1 kExprElse, kExprUnreachable, kExprEnd, kExprIf, kWasmI32, kExprI32Const, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Sub, // --> -1 - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Sub, // --> 0 kExprI32Sub, // --> -1 kExprElse, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-919533.js b/deps/v8/test/mjsunit/regress/wasm/regress-919533.js index 706d3cc7f4..1cc4b675c2 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-919533.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-919533.js @@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_v_v).addBody([]); builder.addFunction(undefined, kSig_i_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, // Stack now contains two copies of the first param register. // Start a loop to create a merge point (values still in registers). kExprLoop, kWasmStmt, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922432.js b/deps/v8/test/mjsunit/regress/wasm/regress-922432.js index f6175b3a63..d5aee0d332 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-922432.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-922432.js @@ -12,7 +12,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addLocals({except_count: 1}) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprBrOnExn // Bytecode truncated here. ]).exportFunc(); fun.body.pop(); // Pop implicitly added kExprEnd from body. diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922670.js b/deps/v8/test/mjsunit/regress/wasm/regress-922670.js index 2988eddf30..96a17bebba 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-922670.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-922670.js @@ -10,10 +10,10 @@ builder.addFunction(undefined, sig) .addLocals({i64_count: 1}) .addBody([ kExprLoop, kWasmI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64Const, 1, kExprLoop, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Const, 1, kExprIf, kWasmI32, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922933.js b/deps/v8/test/mjsunit/regress/wasm/regress-922933.js index 4d44509598..6d0286d95a 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-922933.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-922933.js @@ -14,30 +14,30 @@ builder.addFunction(undefined, sig) kExprEnd, kExprBlock, kWasmStmt, kExprI32Const, 0x00, - kExprSetLocal, 0x09, + kExprLocalSet, 0x09, kExprI32Const, 0x00, kExprIf, kWasmStmt, kExprBlock, kWasmStmt, kExprI32Const, 0x00, - kExprSetLocal, 0x0a, + kExprLocalSet, 0x0a, kExprBr, 0x00, kExprEnd, kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, - kExprGetLocal, 0x00, - kExprSetLocal, 0x12, + kExprLocalGet, 0x00, + kExprLocalSet, 0x12, kExprBr, 0x00, kExprEnd, - kExprGetLocal, 0x16, - kExprSetLocal, 0x0f, - kExprGetLocal, 0x0f, - kExprSetLocal, 0x17, - kExprGetLocal, 0x0f, - kExprSetLocal, 0x18, - kExprGetLocal, 0x17, - kExprGetLocal, 0x18, + kExprLocalGet, 0x16, + kExprLocalSet, 0x0f, + kExprLocalGet, 0x0f, + kExprLocalSet, 0x17, + kExprLocalGet, 0x0f, + kExprLocalSet, 0x18, + kExprLocalGet, 0x17, + kExprLocalGet, 0x18, kExprI64ShrS, - kExprSetLocal, 0x19, + kExprLocalSet, 0x19, kExprUnreachable, kExprEnd, kExprUnreachable, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-924843.js b/deps/v8/test/mjsunit/regress/wasm/regress-924843.js index 0549a769fb..c77845af76 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-924843.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-924843.js @@ -8,7 +8,7 @@ const builder = new WasmModuleBuilder(); const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32])); builder.addFunction(undefined, sig) .addBody([ - kExprGetLocal, 2, + kExprLocalGet, 2, kExprIf, kWasmStmt, kExprBlock, kWasmStmt ]); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-935138.js b/deps/v8/test/mjsunit/regress/wasm/regress-935138.js index 20835428e3..dd585bb255 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-935138.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-935138.js @@ -11,8 +11,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); binary.emit_header(); binary.emit_bytes([kTypeSectionCode, 4, 1, kWasmFunctionTypeForm, 0, 0]); binary.emit_bytes([kFunctionSectionCode, 2, 1, 0]); - binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd]); - binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd]); + binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprLocalGet, 0, kExprEnd]); + binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprLocalGet, 0, kExprEnd]); let buffer = binary.trunc_buffer(); assertPromiseResult(WebAssembly.compile(buffer), assertUnreachable, e => assertInstanceof(e, WebAssembly.CompileError)); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-952342.js b/deps/v8/test/mjsunit/regress/wasm/regress-952342.js index eb81f5a9c6..5e20860d4d 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-952342.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-952342.js @@ -9,9 +9,9 @@ const memory = new WebAssembly.Memory({initial: 1}); let builder = new WasmModuleBuilder(); builder.addImportedMemory("imports", "mem", 1); builder.addFunction("copy", kSig_v_iii) - .addBody([kExprGetLocal, 0, // dst - kExprGetLocal, 1, // src - kExprGetLocal, 2, // size + .addBody([kExprLocalGet, 0, // dst + kExprLocalGet, 1, // src + kExprLocalGet, 2, // size kNumericPrefix, kExprMemoryCopy, 0, 0]).exportAs("copy"); let instance = builder.instantiate({imports: {mem: memory}}); memory.grow(1); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-957405.js b/deps/v8/test/mjsunit/regress/wasm/regress-957405.js index a83104297e..51adce7698 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-957405.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-957405.js @@ -9,9 +9,9 @@ const memory = new WebAssembly.Memory({initial: 1}); let builder = new WasmModuleBuilder(); builder.addImportedMemory("imports", "mem"); builder.addFunction("fill", kSig_v_iii) - .addBody([kExprGetLocal, 0, // dst - kExprGetLocal, 1, // value - kExprGetLocal, 2, // size + .addBody([kExprLocalGet, 0, // dst + kExprLocalGet, 1, // value + kExprLocalGet, 2, // size kNumericPrefix, kExprMemoryFill, 0]).exportAs("fill"); let instance = builder.instantiate({imports: {mem: memory}}); memory.grow(1); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-968078.js b/deps/v8/test/mjsunit/regress/wasm/regress-968078.js index 2935ea05e3..07081087fa 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-968078.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-968078.js @@ -28,16 +28,16 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("foo", kSig_v_iii) .addBody([].concat([ kExprBlock, kWasmStmt, - kExprGetLocal, 0x2, + kExprLocalGet, 0x2, kExprI32Const, 0x01, kExprI32And, // Generate a test branch (which has 32k limited reach). kExprIf, kWasmStmt, - kExprGetLocal, 0x0, + kExprLocalGet, 0x0, kExprI32Const, 0x01, kExprI32And, kExprBrIf, 0x1, - kExprGetLocal, 0x0, + kExprLocalGet, 0x0, // Emit a br_table that is long enough to make the test branch go out of range. ], br_table(0x1, 9000, 0x00), [ kExprEnd, diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-9759.js b/deps/v8/test/mjsunit/regress/wasm/regress-9759.js new file mode 100644 index 0000000000..9d1f86a48d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-9759.js @@ -0,0 +1,26 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-wasm-tier-up --no-liftoff + +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// This constant was chosen as it is the smallest number of cases that still +// triggers the input count overflow. The new limit put into place is smaller. +const NUM_CASES = 0xfffd; + +(function TestBrTableTooLarge() { + let builder = new WasmModuleBuilder(); + let cases = new Array(NUM_CASES).fill(0); + builder.addFunction('main', kSig_v_i) + .addBody([].concat([ + kExprBlock, kWasmStmt, + kExprLocalGet, 0, + kExprBrTable], wasmSignedLeb(NUM_CASES), + cases, [0, + kExprEnd + ])).exportFunc(); + assertThrows(() => new WebAssembly.Module(builder.toBuffer()), + WebAssembly.CompileError, /invalid table count/); +})(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1006631.js b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1006631.js new file mode 100644 index 0000000000..ab555e4551 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1006631.js @@ -0,0 +1,7 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-type-reflection --trace-turbo-graph + +new WebAssembly.Function({ parameters: [], results: [] }, x => x); diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js index 37d5b2e4a2..279d2dbd06 100644 --- a/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js +++ b/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js @@ -13,7 +13,7 @@ let types = new Array(argc).fill(kWasmI32); let sig = makeSig(types, []); let body = []; for (let i = 0; i < argc; ++i) { - body.push(kExprGetLocal, i); + body.push(kExprLocalGet, i); } body.push(kExprCallFunction, 0); builder.addImport('', 'f', sig); diff --git a/deps/v8/test/mjsunit/string-replace-gc.js b/deps/v8/test/mjsunit/string-replace-gc.js index 2f1efd8813..56b6a09da1 100644 --- a/deps/v8/test/mjsunit/string-replace-gc.js +++ b/deps/v8/test/mjsunit/string-replace-gc.js @@ -25,31 +25,22 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Regression test for the r1512 fix. +// Regression test for the r1513 fix. + +// Flags: --allow-natives-syntax var foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; +assertEquals(39, foo.length); + +for (var i = 0; i < 12; i++) { + foo = foo + foo; +} -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; -foo = foo + foo; - -foo.replace(/[b]/, "c"); // Flatten foo. +foo = %FlattenString(foo); var moving_string = "b" + "c"; -var bar = foo.replace(/[a]/g, moving_string); +var bar = foo.replace(/a/g, moving_string); -print(bar.length); +// 39 * 2^12 * 2 +assertEquals(319488, bar.length); diff --git a/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js b/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js index 2d7cd00ac3..7be5abb675 100644 --- a/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js +++ b/deps/v8/test/mjsunit/tools/compiler-trace-flags-wasm.js @@ -20,8 +20,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Add]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/unicodelctest-no-optimization.js b/deps/v8/test/mjsunit/unicodelctest-no-optimization.js index 0b31c560e0..e56d690ed2 100644 --- a/deps/v8/test/mjsunit/unicodelctest-no-optimization.js +++ b/deps/v8/test/mjsunit/unicodelctest-no-optimization.js @@ -93,7 +93,6 @@ function fuzz() { fuzz_index = 0; seed = 49734321; for (var i = 0; i < 1000; i++) { - print(i); var len = rand() & 0x1f; var ranges = new Array(len); var last = rand(); diff --git a/deps/v8/test/mjsunit/wasm/OWNERS b/deps/v8/test/mjsunit/wasm/OWNERS index b6d75023d7..c400f97de0 100644 --- a/deps/v8/test/mjsunit/wasm/OWNERS +++ b/deps/v8/test/mjsunit/wasm/OWNERS @@ -1,3 +1,3 @@ ahaas@chromium.org -clemensh@chromium.org +clemensb@chromium.org titzer@chromium.org diff --git a/deps/v8/test/mjsunit/wasm/adapter-frame.js b/deps/v8/test/mjsunit/wasm/adapter-frame.js index 55634163c6..a25e2aaf3b 100644 --- a/deps/v8/test/mjsunit/wasm/adapter-frame.js +++ b/deps/v8/test/mjsunit/wasm/adapter-frame.js @@ -28,7 +28,7 @@ function makeSelect(type, args, which) { var params = []; for (var i = 0; i < args; i++) params.push(type); builder.addFunction("select", makeSig(params, [type])) - .addBody([kExprGetLocal, which]) + .addBody([kExprLocalGet, which]) .exportFunc(); return builder.instantiate().exports.select; diff --git a/deps/v8/test/mjsunit/wasm/anyfunc.js b/deps/v8/test/mjsunit/wasm/anyfunc.js index f0d587b25a..4a53a04468 100644 --- a/deps/v8/test/mjsunit/wasm/anyfunc.js +++ b/deps/v8/test/mjsunit/wasm/anyfunc.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_a_a) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); const instance = builder.instantiate(); @@ -27,7 +27,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_v_a); const imp_index = builder.addImport('q', 'func', sig_index); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 0, kExprCallFunction, imp_index]) + .addBody([kExprLocalGet, 0, kExprCallFunction, imp_index]) .exportFunc(); const main = builder.instantiate({q: {func: checkFunction}}).exports.main; @@ -50,28 +50,28 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.addFunction('main', ref_sig) .addLocals({anyfunc_count: 10}) .addBody([ - kExprGetLocal, 0, - kExprSetLocal, 1, // Set local - kExprGetLocal, 0, - kExprSetLocal, 2, // Set local - kExprGetLocal, 0, - kExprSetLocal, 3, // Set local - kExprGetLocal, 0, - kExprSetLocal, 4, // Set local - kExprGetLocal, 0, - kExprSetLocal, 5, // Set local - kExprGetLocal, 0, - kExprSetLocal, 6, // Set local - kExprGetLocal, 0, - kExprSetLocal, 7, // Set local - kExprGetLocal, 0, - kExprSetLocal, 8, // Set local - kExprGetLocal, 0, - kExprSetLocal, 9, // Set local - kExprGetLocal, 0, - kExprSetLocal, 10, // Set local + kExprLocalGet, 0, + kExprLocalSet, 1, // Set local + kExprLocalGet, 0, + kExprLocalSet, 2, // Set local + kExprLocalGet, 0, + kExprLocalSet, 3, // Set local + kExprLocalGet, 0, + kExprLocalSet, 4, // Set local + kExprLocalGet, 0, + kExprLocalSet, 5, // Set local + kExprLocalGet, 0, + kExprLocalSet, 6, // Set local + kExprLocalGet, 0, + kExprLocalSet, 7, // Set local + kExprLocalGet, 0, + kExprLocalSet, 8, // Set local + kExprLocalGet, 0, + kExprLocalSet, 9, // Set local + kExprLocalGet, 0, + kExprLocalSet, 10, // Set local kExprCallFunction, gc_index, // call gc - kExprGetLocal, 9, + kExprLocalGet, 9, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -97,7 +97,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.addFunction('main', ref_sig) .addBody([ kExprCallFunction, gc_index, // call gc - kExprGetLocal, 0, kExprCallFunction, imp_index // call import + kExprLocalGet, 0, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -118,7 +118,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); makeSig([kWasmI32, kWasmAnyFunc, kWasmI32], [kWasmAnyFunc]); const sig_index = builder.addType(kSig_a_iai); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 1]) + .addBody([kExprLocalGet, 1]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -140,7 +140,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_a_v); builder.addFunction('main', sig_index) .addLocals({anyfunc_count: 1}) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -152,7 +152,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const builder = new WasmModuleBuilder(); const sig_index = builder.addType(kSig_a_a); builder.addFunction('main', sig_index) - .addBody([kExprRefNull, kExprSetLocal, 0, kExprGetLocal, 0]) + .addBody([kExprRefNull, kExprLocalSet, 0, kExprLocalGet, 0]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -187,7 +187,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_r_v); builder.addFunction('main', sig_index) .addLocals({anyfunc_count: 1}) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); const main = builder.instantiate().exports.main; @@ -200,7 +200,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); const sig_index = builder.addType(kSig_r_v); builder.addFunction('main', sig_index) .addLocals({anyfunc_count: 1}) - .addBody([kExprGetLocal, 0, kExprReturn]) + .addBody([kExprLocalGet, 0, kExprReturn]) .exportFunc(); const main = builder.instantiate().exports.main; diff --git a/deps/v8/test/mjsunit/wasm/anyref-globals.js b/deps/v8/test/mjsunit/wasm/anyref-globals.js index 39d3bcb147..d243e37486 100644 --- a/deps/v8/test/mjsunit/wasm/anyref-globals.js +++ b/deps/v8/test/mjsunit/wasm/anyref-globals.js @@ -12,10 +12,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g_nullref = builder.addGlobal(kWasmAnyRef, true).index; const g_nullfunc = builder.addGlobal(kWasmAnyFunc, true).index; builder.addFunction("get_anyref_global", kSig_r_v) - .addBody([kExprGetGlobal, g_nullref]) + .addBody([kExprGlobalGet, g_nullref]) .exportAs("get_anyref_global"); builder.addFunction("get_anyfunc_global", kSig_a_v) - .addBody([kExprGetGlobal, g_nullfunc]) + .addBody([kExprGlobalGet, g_nullfunc]) .exportAs("get_anyfunc_global"); const instance = builder.instantiate(); @@ -32,16 +32,16 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g_nullfunc = builder.addGlobal(kWasmAnyFunc, true); builder.addFunction("get_anyref_global", kSig_r_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g_setref.index, - kExprGetGlobal, g_nullref.index + kExprLocalGet, 0, + kExprGlobalSet, g_setref.index, + kExprGlobalGet, g_nullref.index ]) .exportAs("get_anyref_global"); builder.addFunction("get_anyfunc_global", kSig_a_a) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g_setfunc.index, - kExprGetGlobal, g_nullfunc.index + kExprLocalGet, 0, + kExprGlobalSet, g_setfunc.index, + kExprGlobalGet, g_nullfunc.index ]) .exportAs("get_anyfunc_global"); @@ -59,9 +59,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyRef, true); builder.addFunction("main", kSig_r_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index, - kExprGetGlobal, g.index + kExprLocalGet, 0, + kExprGlobalSet, g.index, + kExprGlobalGet, g.index ]) .exportAs("main"); @@ -79,9 +79,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyFunc, true); builder.addFunction("main", kSig_a_a) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index, - kExprGetGlobal, g.index + kExprLocalGet, 0, + kExprGlobalSet, g.index, + kExprGlobalGet, g.index ]) .exportAs("main"); @@ -100,10 +100,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyRef, true); builder.addFunction("main", kSig_r_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index, + kExprLocalGet, 0, + kExprGlobalSet, g.index, kExprCallFunction, gc_index, // call gc - kExprGetGlobal, g.index + kExprGlobalGet, g.index ]) .exportAs("main"); @@ -121,14 +121,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const g = builder.addGlobal(kWasmAnyRef, true); builder.addFunction("get_global", kSig_r_v) .addBody([ - kExprGetGlobal, g.index + kExprGlobalGet, g.index ]) .exportAs("get_global"); builder.addFunction("set_global", kSig_v_r) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index + kExprLocalGet, 0, + kExprGlobalSet, g.index ]) .exportAs("set_global"); @@ -150,7 +150,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyRef); builder.addFunction('main', kSig_r_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const instance = builder.instantiate({ m: { val: obj } }); @@ -178,7 +178,7 @@ function dummy_func() { let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyFunc); builder.addFunction('main', kSig_a_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const module = builder.toModule(); @@ -285,14 +285,14 @@ function dummy_func() { builder.addFunction("main", makeSig([kWasmAnyRef, kWasmAnyFunc, kWasmAnyRef, kWasmAnyFunc], [])) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g1.index, - kExprGetLocal, 1, - kExprSetGlobal, g2.index, - kExprGetLocal, 2, - kExprSetGlobal, g3.index, - kExprGetLocal, 3, - kExprSetGlobal, g4.index + kExprLocalGet, 0, + kExprGlobalSet, g1.index, + kExprLocalGet, 1, + kExprGlobalSet, g2.index, + kExprLocalGet, 2, + kExprGlobalSet, g3.index, + kExprLocalGet, 3, + kExprGlobalSet, g4.index ]) .exportAs("main"); @@ -314,7 +314,7 @@ function dummy_func() { let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyRef, true); builder.addFunction('main', kSig_r_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const global = new WebAssembly.Global({ value: 'anyref', mutable: 'true' }, obj); @@ -335,7 +335,7 @@ function dummy_func() { let builder = new WasmModuleBuilder(); const g = builder.addImportedGlobal('m', 'val', kWasmAnyFunc, true); builder.addFunction('main', kSig_a_v) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs('main'); const global = new WebAssembly.Global({ value: 'anyfunc', mutable: 'true' }, obj); @@ -358,19 +358,19 @@ function dummy_func() { builder1.addFunction("set_globals", kSig_v_rr) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g2.index, - kExprGetLocal, 1, - kExprSetGlobal, g3.index, + kExprLocalGet, 0, + kExprGlobalSet, g2.index, + kExprLocalGet, 1, + kExprGlobalSet, g3.index, ]) .exportAs("set_globals"); builder1.addFunction('get_global2', kSig_r_v) - .addBody([kExprGetGlobal, g2.index]) + .addBody([kExprGlobalGet, g2.index]) .exportAs('get_global2'); builder1.addFunction('get_global3', kSig_r_v) - .addBody([kExprGetGlobal, g3.index]) + .addBody([kExprGlobalGet, g3.index]) .exportAs('get_global3'); const instance1 = builder1.instantiate(); @@ -392,19 +392,19 @@ function dummy_func() { builder2.addFunction("set_globals", kSig_v_rr) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, i2, - kExprGetLocal, 1, - kExprSetGlobal, i3, + kExprLocalGet, 0, + kExprGlobalSet, i2, + kExprLocalGet, 1, + kExprGlobalSet, i3, ]) .exportAs("set_globals"); builder2.addFunction('get_global2', kSig_r_v) - .addBody([kExprGetGlobal, i2]) + .addBody([kExprGlobalGet, i2]) .exportAs('get_global2'); builder2.addFunction('get_global3', kSig_r_v) - .addBody([kExprGetGlobal, i3]) + .addBody([kExprGlobalGet, i3]) .exportAs('get_global3'); const instance2 = builder2.instantiate(instance1); @@ -454,19 +454,19 @@ function dummy_func() { builder1.addFunction("set_globals", kSig_v_aa) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g2.index, - kExprGetLocal, 1, - kExprSetGlobal, g3.index, + kExprLocalGet, 0, + kExprGlobalSet, g2.index, + kExprLocalGet, 1, + kExprGlobalSet, g3.index, ]) .exportAs("set_globals"); builder1.addFunction('get_global2', kSig_a_v) - .addBody([kExprGetGlobal, g2.index]) + .addBody([kExprGlobalGet, g2.index]) .exportAs('get_global2'); builder1.addFunction('get_global3', kSig_a_v) - .addBody([kExprGetGlobal, g3.index]) + .addBody([kExprGlobalGet, g3.index]) .exportAs('get_global3'); const instance1 = builder1.instantiate(); @@ -489,19 +489,19 @@ function dummy_func() { builder2.addFunction("set_globals", kSig_v_aa) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, i2, - kExprGetLocal, 1, - kExprSetGlobal, i3, + kExprLocalGet, 0, + kExprGlobalSet, i2, + kExprLocalGet, 1, + kExprGlobalSet, i3, ]) .exportAs("set_globals"); builder2.addFunction('get_global2', kSig_a_v) - .addBody([kExprGetGlobal, i2]) + .addBody([kExprGlobalGet, i2]) .exportAs('get_global2'); builder2.addFunction('get_global3', kSig_a_v) - .addBody([kExprGetGlobal, i3]) + .addBody([kExprGlobalGet, i3]) .exportAs('get_global3'); const instance2 = builder2.instantiate(instance1); @@ -563,10 +563,10 @@ function dummy_func() { const g_ref = builder.addGlobal(kWasmAnyRef, true); const g_func = builder.addGlobal(kWasmAnyFunc, true); const f_ref = builder.addFunction('get_anyref_global', kSig_r_v) - .addBody([kExprGetGlobal, g_ref.index]) + .addBody([kExprGlobalGet, g_ref.index]) .exportAs('get_anyref_global'); const f_func = builder.addFunction('get_anyfunc_global', kSig_a_v) - .addBody([kExprGetGlobal, g_func.index]) + .addBody([kExprGlobalGet, g_func.index]) .exportAs('get_anyfunc_global'); g_ref.function_index = f_ref.index; @@ -591,10 +591,10 @@ function dummy_func() { g_wasm.function_index = import_wasm; g_js.function_index = import_js; builder.addFunction('get_global_wasm', kSig_a_v) - .addBody([kExprGetGlobal, g_wasm.index]) + .addBody([kExprGlobalGet, g_wasm.index]) .exportFunc(); builder.addFunction('get_global_js', kSig_a_v) - .addBody([kExprGetGlobal, g_js.index]) + .addBody([kExprGlobalGet, g_js.index]) .exportFunc(); const expected_wasm = dummy_func(); diff --git a/deps/v8/test/mjsunit/wasm/anyref.js b/deps/v8/test/mjsunit/wasm/anyref.js index 141d25d1e3..cdb4742776 100644 --- a/deps/v8/test/mjsunit/wasm/anyref.js +++ b/deps/v8/test/mjsunit/wasm/anyref.js @@ -10,7 +10,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_r_r) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportFunc(); @@ -31,7 +31,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const sig_index = builder.addType(kSig_v_r); const imp_index = builder.addImport("q", "func", sig_index); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprCallFunction, imp_index]) .exportFunc(); @@ -55,18 +55,18 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('main', ref_sig) .addLocals({anyref_count: 10}) .addBody([ - kExprGetLocal, 0, kExprSetLocal, 1, // Set local - kExprGetLocal, 0, kExprSetLocal, 2, // Set local - kExprGetLocal, 0, kExprSetLocal, 3, // Set local - kExprGetLocal, 0, kExprSetLocal, 4, // Set local - kExprGetLocal, 0, kExprSetLocal, 5, // Set local - kExprGetLocal, 0, kExprSetLocal, 6, // Set local - kExprGetLocal, 0, kExprSetLocal, 7, // Set local - kExprGetLocal, 0, kExprSetLocal, 8, // Set local - kExprGetLocal, 0, kExprSetLocal, 9, // Set local - kExprGetLocal, 0, kExprSetLocal, 10, // Set local + kExprLocalGet, 0, kExprLocalSet, 1, // Set local + kExprLocalGet, 0, kExprLocalSet, 2, // Set local + kExprLocalGet, 0, kExprLocalSet, 3, // Set local + kExprLocalGet, 0, kExprLocalSet, 4, // Set local + kExprLocalGet, 0, kExprLocalSet, 5, // Set local + kExprLocalGet, 0, kExprLocalSet, 6, // Set local + kExprLocalGet, 0, kExprLocalSet, 7, // Set local + kExprLocalGet, 0, kExprLocalSet, 8, // Set local + kExprLocalGet, 0, kExprLocalSet, 9, // Set local + kExprLocalGet, 0, kExprLocalSet, 10, // Set local kExprCallFunction, gc_index, // call gc - kExprGetLocal, 9, kExprCallFunction, imp_index // call import + kExprLocalGet, 9, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -90,7 +90,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('main', ref_sig) .addBody([ kExprCallFunction, gc_index, // call gc - kExprGetLocal, 0, kExprCallFunction, imp_index // call import + kExprLocalGet, 0, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -119,7 +119,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('main', main_sig) .addBody([ kExprCallFunction, gc_index, // call gc - kExprGetLocal, index, kExprCallFunction, imp_index // call import + kExprLocalGet, index, kExprCallFunction, imp_index // call import ]) .exportFunc(); @@ -145,7 +145,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const kSig_r_iri = makeSig([kWasmI32, kWasmAnyRef, kWasmI32], [kWasmAnyRef]); const sig_index = builder.addType(kSig_r_iri); builder.addFunction('main', sig_index) - .addBody([kExprGetLocal, 1]) + .addBody([kExprLocalGet, 1]) .exportFunc(); const instance = builder.instantiate(); @@ -177,7 +177,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_i_r) - .addBody([kExprGetLocal, 0, kExprRefIsNull]) + .addBody([kExprLocalGet, 0, kExprRefIsNull]) .exportFunc(); const instance = builder.instantiate(); @@ -208,7 +208,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_r_v) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .addLocals({anyref_count: 1}) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js b/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js index 9d8b14afec..0f93e77f6c 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js @@ -192,28 +192,15 @@ function i32_invert(a) { var inputs = [ 0, 1, 2, 3, 4, - 10, 20, 30, 31, 32, 33, 100, 2000, - 30000, 400000, 5000000, - 100000000, 2000000000, 2147483646, - 2147483647, - 2147483648, - 2147483649, - 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, + 2147483647, // max positive int32 + 2147483648, // overflow max positive int32 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, - 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, - 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, - 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, - 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, + 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x0003ffff, 0x00001fff, -1, -2, -3, -4, - -10, -20, -30, -31, -32, -33, -100, -2000, - -30000, -400000, -5000000, - -100000000, -2000000000, - -2147483646, -2147483647, - -2147483648, - -2147483649, + -2147483648, // min negative int32 + -2147483649, // overflow min negative int32 ]; var funcs = [ diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js b/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js index 0809bca6ab..fda6091084 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js @@ -170,28 +170,15 @@ function u32_invert(a) { var inputs = [ 0, 1, 2, 3, 4, - 10, 20, 30, 31, 32, 33, 100, 2000, - 30000, 400000, 5000000, - 100000000, 2000000000, 2147483646, - 2147483647, - 2147483648, - 2147483649, - 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, + 2147483647, // max positive int32 + 2147483648, // overflow max positive int32 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, - 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, - 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, - 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, - 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, + 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x0003ffff, 0x00001fff, -1, -2, -3, -4, - -10, -20, -30, -31, -32, -33, -100, -2000, - -30000, -400000, -5000000, - -100000000, -2000000000, - -2147483646, -2147483647, - -2147483648, - -2147483649, + -2147483648, // min negative int32 + -2147483649, // overflow min negative int32 ]; var funcs = [ diff --git a/deps/v8/test/mjsunit/wasm/atomics-stress.js b/deps/v8/test/mjsunit/wasm/atomics-stress.js index 8622919043..9eb18050cb 100644 --- a/deps/v8/test/mjsunit/wasm/atomics-stress.js +++ b/deps/v8/test/mjsunit/wasm/atomics-stress.js @@ -165,15 +165,15 @@ class Operation { // Load address of low 32 bits. kExprI32Const, 0, // Load expected value. - kExprGetLocal, 0, kExprI32StoreMem, 2, 0, + kExprLocalGet, 0, kExprI32StoreMem, 2, 0, // Load address of high 32 bits. kExprI32Const, 4, // Load expected value. - kExprGetLocal, 1, kExprI32StoreMem, 2, 0, + kExprLocalGet, 1, kExprI32StoreMem, 2, 0, // Load address of where our window starts. kExprI32Const, 0, // Load input if there is one. - ...(this.hasInput ? [kExprGetLocal, 2] : []), + ...(this.hasInput ? [kExprLocalGet, 2] : []), // Perform operation. kAtomicPrefix, ...this.wasmOpcode, // Drop output if it had any. @@ -261,19 +261,19 @@ function generateFunctionBodyForSequence(sequence) { if (!kDebug) { body.push( // Decrement the wait count. - kExprGetLocal, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, + kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, 0, // Spin until zero. - kExprLoop, kWasmStmt, kExprGetLocal, 2, kAtomicPrefix, + kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix, kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0, kExprEnd); } for (let operation of sequence) { body.push( // Pre-load address of results sequence pointer for later. - kExprGetLocal, 1, + kExprLocalGet, 1, // Load address where atomic pointers are stored. - kExprGetLocal, 0, + kExprLocalGet, 0, // Load the second argument if it had any. ...(operation.hasInput ? [kExprI32Const, ...toSLeb128(operation.input)] : @@ -285,10 +285,10 @@ function generateFunctionBodyForSequence(sequence) { // Store read intermediate to sequence. kExprI32StoreMem, 2, 0, // Increment result sequence pointer. - kExprGetLocal, 1, kExprI32Const, 4, kExprI32Add, kExprSetLocal, 1); + kExprLocalGet, 1, kExprI32Const, 4, kExprI32Add, kExprLocalSet, 1); } // Return end of sequence index. - body.push(kExprGetLocal, 1, kExprReturn); + body.push(kExprLocalGet, 1, kExprReturn); return body; } diff --git a/deps/v8/test/mjsunit/wasm/atomics.js b/deps/v8/test/mjsunit/wasm/atomics.js index 08714bbc01..264662f2ac 100644 --- a/deps/v8/test/mjsunit/wasm/atomics.js +++ b/deps/v8/test/mjsunit/wasm/atomics.js @@ -25,8 +25,8 @@ function GetAtomicBinOpFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -43,9 +43,9 @@ function GetAtomicCmpExchangeFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -62,7 +62,7 @@ function GetAtomicLoadFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -79,8 +79,8 @@ function GetAtomicStoreFunction(wasmExpression, alignment, offset) { builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); builder.addFunction("main", kSig_v_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, wasmExpression, alignment, offset]) .exportAs("main"); @@ -440,11 +440,11 @@ function CmpExchgLoop(opcode, alignment) { .addLocals({i64_count: 2}) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kAtomicPrefix, opcode, alignment, 0, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64Ne, kExprBrIf, 0, kExprEnd diff --git a/deps/v8/test/mjsunit/wasm/atomics64-stress.js b/deps/v8/test/mjsunit/wasm/atomics64-stress.js index 386a3b5549..99e9016f1a 100644 --- a/deps/v8/test/mjsunit/wasm/atomics64-stress.js +++ b/deps/v8/test/mjsunit/wasm/atomics64-stress.js @@ -191,18 +191,18 @@ class Operation { // Load address of low 32 bits. kExprI32Const, 0, // Load expected value. - kExprGetLocal, 0, kExprI32StoreMem, 2, 0, + kExprLocalGet, 0, kExprI32StoreMem, 2, 0, // Load address of high 32 bits. kExprI32Const, 4, // Load expected value. - kExprGetLocal, 1, kExprI32StoreMem, 2, 0, + kExprLocalGet, 1, kExprI32StoreMem, 2, 0, // Load address of where our window starts. kExprI32Const, 0, // Load input if there is one. ...(this.hasInput ? [ - kExprGetLocal, 3, kExprI64UConvertI32, kExprI64Const, 32, - kExprI64Shl, kExprGetLocal, 2, kExprI64UConvertI32, + kExprLocalGet, 3, kExprI64UConvertI32, kExprI64Const, 32, + kExprI64Shl, kExprLocalGet, 2, kExprI64UConvertI32, kExprI64Ior ] : []), @@ -299,19 +299,19 @@ function generateFunctionBodyForSequence(sequence) { if (!kDebug) { body.push( // Decrement the wait count. - kExprGetLocal, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, + kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, 0, // Spin until zero. - kExprLoop, kWasmStmt, kExprGetLocal, 2, kAtomicPrefix, + kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix, kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0, kExprEnd); } for (let operation of sequence) { body.push( // Pre-load address of results sequence pointer for later. - kExprGetLocal, 1, + kExprLocalGet, 1, // Load address where atomic pointers are stored. - kExprGetLocal, 0, + kExprLocalGet, 0, // Load the second argument if it had any. ...(operation.hasInput ? [ @@ -326,10 +326,10 @@ function generateFunctionBodyForSequence(sequence) { // Store read intermediate to sequence. kExprI64StoreMem, 3, 0, // Increment result sequence pointer. - kExprGetLocal, 1, kExprI32Const, 8, kExprI32Add, kExprSetLocal, 1); + kExprLocalGet, 1, kExprI32Const, 8, kExprI32Add, kExprLocalSet, 1); } // Return end of sequence index. - body.push(kExprGetLocal, 1, kExprReturn); + body.push(kExprLocalGet, 1, kExprReturn); return body; } diff --git a/deps/v8/test/mjsunit/wasm/bigint.js b/deps/v8/test/mjsunit/wasm/bigint.js index ff9046e9dc..0c9ebb6559 100644 --- a/deps/v8/test/mjsunit/wasm/bigint.js +++ b/deps/v8/test/mjsunit/wasm/bigint.js @@ -26,30 +26,30 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); let a_global_index = builder - .addImportedGlobal("mod", "a", kWasmI64) + .addImportedGlobal("mod", "a", kWasmI64); let b_global_index = builder .addImportedGlobal("mod", "b", kWasmI64); - let c_global_index = builder - .addImportedGlobal("mod", "c", kWasmI64); - builder .addExportOfKind('a', kExternalGlobal, a_global_index) .addExportOfKind('b', kExternalGlobal, b_global_index) - .addExportOfKind('c', kExternalGlobal, c_global_index); let module = builder.instantiate({ mod: { a: 1n, b: 2n ** 63n, - c: "123", } }); assertEquals(module.exports.a.value, 1n); assertEquals(module.exports.b.value, - (2n ** 63n)); - assertEquals(module.exports.c.value, 123n); +})(); + +(function TestJSBigIntGlobalImportInvalidType() { + let builder = new WasmModuleBuilder(); + builder.addImportedGlobal("mod", "a", kWasmI64); + assertThrows(() => builder.instantiate({mod: { a: {} } }), WebAssembly.LinkError); })(); (function TestJSBigIntToWasmI64MutableGlobal() { @@ -86,7 +86,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder .addFunction("f", kSig_l_l) // i64 -> i64 .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, ]) .exportFunc(); @@ -108,7 +108,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder .addFunction("f", kSig_l_ll) // i64 -> i64 .addBody([ - kExprGetLocal, 1, + kExprLocalGet, 1, ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js index 43ff8570c6..90ede1ac92 100644 --- a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js +++ b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js @@ -8,9 +8,9 @@ const builder = new WasmModuleBuilder(); builder.addMemory(1, undefined, false); builder.addFunction('load', kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI64SConvertI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64SConvertI32, kExprI64Shl, kExprI32ConvertI64, diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js b/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js index d972e7830d..b740a20f1a 100644 --- a/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js +++ b/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js @@ -10,7 +10,7 @@ const builder = new WasmModuleBuilder(); builder.addMemory(1, undefined, false); builder.addFunction('load', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 100]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/bulk-memory.js b/deps/v8/test/mjsunit/wasm/bulk-memory.js index d783c6bf59..53ca1454b6 100644 --- a/deps/v8/test/mjsunit/wasm/bulk-memory.js +++ b/deps/v8/test/mjsunit/wasm/bulk-memory.js @@ -33,9 +33,9 @@ function getMemoryInit(mem, segment_data) { builder.addPassiveDataSegment(segment_data); builder.addFunction('init', kSig_v_iii) .addBody([ - kExprGetLocal, 0, // Dest. - kExprGetLocal, 1, // Source. - kExprGetLocal, 2, // Size in bytes. + kExprLocalGet, 0, // Dest. + kExprLocalGet, 1, // Source. + kExprLocalGet, 2, // Size in bytes. kNumericPrefix, kExprMemoryInit, 0, // Data segment index. 0, // Memory index. @@ -102,9 +102,9 @@ function getMemoryCopy(mem) { const builder = new WasmModuleBuilder(); builder.addImportedMemory("", "mem", 0); builder.addFunction("copy", kSig_v_iii).addBody([ - kExprGetLocal, 0, // Dest. - kExprGetLocal, 1, // Source. - kExprGetLocal, 2, // Size in bytes. + kExprLocalGet, 0, // Dest. + kExprLocalGet, 1, // Source. + kExprLocalGet, 2, // Size in bytes. kNumericPrefix, kExprMemoryCopy, 0, 0, ]).exportAs("copy"); return builder.instantiate({'': {mem}}).exports.copy; @@ -128,9 +128,9 @@ function getMemoryFill(mem) { const builder = new WasmModuleBuilder(); builder.addImportedMemory("", "mem", 0); builder.addFunction("fill", kSig_v_iii).addBody([ - kExprGetLocal, 0, // Dest. - kExprGetLocal, 1, // Byte value. - kExprGetLocal, 2, // Size. + kExprLocalGet, 0, // Dest. + kExprLocalGet, 1, // Byte value. + kExprLocalGet, 2, // Size. kNumericPrefix, kExprMemoryFill, 0, ]).exportAs("fill"); return builder.instantiate({'': {mem}}).exports.fill; diff --git a/deps/v8/test/mjsunit/wasm/calls.js b/deps/v8/test/mjsunit/wasm/calls.js index 97188964d1..f8a4616def 100644 --- a/deps/v8/test/mjsunit/wasm/calls.js +++ b/deps/v8/test/mjsunit/wasm/calls.js @@ -49,8 +49,8 @@ function assertFunction(module, func) { builder.addMemory(1, 1, true); builder.addFunction("sub", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub, // -- ]) .exportFunc() @@ -91,8 +91,8 @@ function assertFunction(module, func) { builder.addMemory(kPages, kPages, true); builder.addFunction("flt", kSig_i_dd) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprF64Lt // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js b/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js index 6f4698c0d0..45eaef92e8 100644 --- a/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js +++ b/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js @@ -9,7 +9,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); // We only have 1 MB code space. This is enough for the code below, but for all // 1000 modules, it requires several GCs to get rid of the old code. const builder = new WasmModuleBuilder(); -builder.addFunction('main', kSig_i_i).addBody([kExprGetLocal, 0]); +builder.addFunction('main', kSig_i_i).addBody([kExprLocalGet, 0]); const buffer = builder.toBuffer(); for (let i = 0; i < 1000; ++i) { diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js index 5102216933..050a15e380 100644 --- a/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js +++ b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js @@ -37,42 +37,42 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, const kLocalNextValue = 7; // the value to write in the update let body = [ // Turn sequence length to equivalent in bytes. - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kArgSeqenceLength, kExprI32Const, size / 8, kExprI32Mul, - kExprSetLocal, kArgSeqenceLength, + kExprLocalSet, kArgSeqenceLength, // Outer block so we have something to jump for return. ...[kExprBlock, kWasmStmt, // Set counter to 0. kExprI32Const, 0, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, // Outer loop until maxcount. ...[kExprLoop, kWasmStmt, // Find the next value to wait for. ...[kExprLoop, kWasmStmt, // Check end of sequence. - kExprGetLocal, kLocalCurrentOffset, - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kLocalCurrentOffset, + kExprLocalGet, kArgSeqenceLength, kExprI32Eq, kExprBrIf, 2, // return ...[kExprBlock, kWasmStmt, // Load next value. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, // Mask off bits. - kExprGetLocal, kArgBitMask, + kExprLocalGet, kArgBitMask, kExprI32And, // Compare with worker id. - kExprGetLocal, kArgWorkerId, + kExprLocalGet, kArgWorkerId, kExprI32Eq, kExprBrIf, 0, // Not found, increment position. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 1, kExprEnd ], @@ -80,41 +80,41 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, kExprEnd ], // Load expected value to local. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalExpectedValue, + kExprLocalSet, kLocalExpectedValue, // Load value after expected one. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, kExprI32Const, size / 8, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalNextValue, + kExprLocalSet, kLocalNextValue, // Hammer on memory until value found. ...[kExprLoop, kWasmStmt, // Load address. - kExprGetLocal, kArgMemoryCell, + kExprLocalGet, kArgMemoryCell, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Load updated value. - kExprGetLocal, kLocalNextValue, + kExprLocalGet, kLocalNextValue, // Try update. kAtomicPrefix, compareExchangeOpcode, 0, 0, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Spin if not what expected. kExprI32Ne, kExprBrIf, 0, kExprEnd ], // Next iteration of loop. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 0, kExprEnd ], // outer loop diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js index bd1c5c95a5..b2ffcf1475 100644 --- a/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js +++ b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js @@ -40,44 +40,44 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, const kLocalNextValue = 7; // the value to write in the update let body = [ // Turn sequence length to equivalent in bytes. - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kArgSeqenceLength, kExprI32Const, size / 8, kExprI32Mul, - kExprSetLocal, kArgSeqenceLength, + kExprLocalSet, kArgSeqenceLength, // Outer block so we have something to jump for return. ...[kExprBlock, kWasmStmt, // Set counter to 0. kExprI32Const, 0, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, // Outer loop until maxcount. ...[kExprLoop, kWasmStmt, // Find the next value to wait for. ...[kExprLoop, kWasmStmt, // Check end of sequence. - kExprGetLocal, kLocalCurrentOffset, - kExprGetLocal, kArgSeqenceLength, + kExprLocalGet, kLocalCurrentOffset, + kExprLocalGet, kArgSeqenceLength, kExprI32Eq, kExprBrIf, 2, // return ...[kExprBlock, kWasmStmt, // Load next value. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, // Mask off bits. - kExprGetLocal, kArgBitMask, + kExprLocalGet, kArgBitMask, kExprI64UConvertI32, kExprI64And, // Compare with worker id. - kExprGetLocal, kArgWorkerId, + kExprLocalGet, kArgWorkerId, kExprI64UConvertI32, kExprI64Eq, kExprBrIf, 0, // Not found, increment position. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 1, kExprEnd ], @@ -85,41 +85,41 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName, kExprEnd ], // Load expected value to local. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalExpectedValue, + kExprLocalSet, kLocalExpectedValue, // Load value after expected one. - kExprGetLocal, kArgSequencePtr, - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kArgSequencePtr, + kExprLocalGet, kLocalCurrentOffset, kExprI32Add, kExprI32Const, size / 8, kExprI32Add, loadMemOpcode, 0, 0, - kExprSetLocal, kLocalNextValue, + kExprLocalSet, kLocalNextValue, // Hammer on memory until value found. ...[kExprLoop, kWasmStmt, // Load address. - kExprGetLocal, kArgMemoryCell, + kExprLocalGet, kArgMemoryCell, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Load updated value. - kExprGetLocal, kLocalNextValue, + kExprLocalGet, kLocalNextValue, // Try update. kAtomicPrefix, compareExchangeOpcode, 0, 0, // Load expected value. - kExprGetLocal, kLocalExpectedValue, + kExprLocalGet, kLocalExpectedValue, // Spin if not what expected. kExprI64Ne, kExprBrIf, 0, kExprEnd ], // Next iteration of loop. - kExprGetLocal, kLocalCurrentOffset, + kExprLocalGet, kLocalCurrentOffset, kExprI32Const, size / 8, kExprI32Add, - kExprSetLocal, kLocalCurrentOffset, + kExprLocalSet, kLocalCurrentOffset, kExprBr, 0, kExprEnd ], // outer loop diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js index 5ca20cbb95..4723b92acf 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-async-compilation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, kCompilationHintTierBaseline) @@ -26,7 +26,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_l) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -49,7 +49,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -63,7 +63,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierDefault, kCompilationHintTierDefault) diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js b/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js index e39e15feeb..5bcac2af9e 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-decoder.js @@ -11,8 +11,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, @@ -29,20 +29,20 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyDefault, kCompilationHintTierInterpreter, kCompilationHintTierInterpreter) .exportFunc(); builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow3', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) let instance = builder.instantiate({mod: {pow: Math.pow}}); assertEquals(27, instance.exports.upow(3)) @@ -53,16 +53,16 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow3', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierBaseline, @@ -76,8 +76,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierDefault, @@ -91,8 +91,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierDefault, @@ -104,8 +104,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyEager, kCompilationHintTierOptimized, @@ -119,8 +119,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('sq', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierOptimized, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js b/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js index 553426db08..4bfc22fb89 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-ignored.js @@ -9,8 +9,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyDefault, kCompilationHintTierInterpreter, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js b/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js index f0a46b9ec7..f9f85a7d91 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-interpreter.js @@ -19,7 +19,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addImport("otherModule", "getX", kSig_i_v); builder1.addFunction("plusX", kSig_i_i) .addBody([kExprCallFunction, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -44,7 +44,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addImport("otherModule", "getX", kSig_i_v); builder1.addFunction("plusX", kSig_i_i) .addBody([kExprCallFunction, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -64,8 +64,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); let sig_i_ii = builder.addType(kSig_i_ii); let add = builder.addFunction('add', sig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -73,9 +73,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.appendToTable([add.index]); builder.addFunction('main', kSig_i_iii) .addBody([// Call indirect #0 with args <#1, #2>. - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -89,8 +89,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); let sig_i_ii = builder.addType(kSig_i_ii); let add = builder.addFunction('add', sig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI64Add]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, @@ -98,9 +98,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder.appendToTable([add.index]); builder.addFunction('main', kSig_i_iii) .addBody([// Call indirect #0 with args <#1, #2>. - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierInterpreter, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js index e6958cb554..de2bbd1c13 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-lazy-validation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprI64Const, 1, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyLazy, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js index f48169fa0a..2708da149b 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-compilation.js @@ -11,12 +11,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, @@ -33,12 +33,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, @@ -59,12 +59,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_f_ff); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) builder.addFunction('upow2', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, @@ -94,8 +94,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, @@ -112,8 +112,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); let builder = new WasmModuleBuilder(); builder.addImport('mod', 'pow', kSig_i_ii); builder.addFunction('upow', kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierDefault, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js index 6db4c0e328..f125aeaa7e 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-streaming-lazy-validation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprI64Const, 1, kExprI32Mul]) .setCompilationHint(kCompilationHintStrategyLazy, diff --git a/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js b/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js index 6c4364b6d3..35f77de157 100644 --- a/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js +++ b/deps/v8/test/mjsunit/wasm/compilation-hints-sync-compilation.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierOptimized, kCompilationHintTierBaseline) @@ -25,7 +25,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_l) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -46,7 +46,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazy, kCompilationHintTierDefault, kCompilationHintTierDefault) @@ -58,7 +58,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('id', kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier, kCompilationHintTierDefault, kCompilationHintTierDefault) diff --git a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js index c95e4d05b7..859a3095ae 100644 --- a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js +++ b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js @@ -17,11 +17,11 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprI32Const, 1, kExprCallIndirect, signature, kTableZero, - kExprGetLocal,0, + kExprLocalGet,0, kExprI32LoadMem,0, 0, kExprCallFunction, 0, kExprI32Add @@ -31,7 +31,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // return mem[i] + some_value(); builder.addFunction("_wrap_writer", signature) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 1]); builder.appendToTable([2, 3]); @@ -175,13 +175,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addGlobal(kWasmI32, true); builder.addFunction("read", kSig_i_v) .addBody([ - kExprGetGlobal, 0]) + kExprGlobalGet, 0]) .exportFunc(); builder.addFunction("write", kSig_v_i) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, 0]) + kExprLocalGet, 0, + kExprGlobalSet, 0]) .exportFunc(); var wire_bytes = builder.toBuffer(); @@ -213,7 +213,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index1, kTableZero]) // -- .exportAs("main"); @@ -234,7 +234,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index2, kTableZero]) // -- .exportAs("main"); @@ -293,7 +293,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const builder = new WasmModuleBuilder(); builder.addMemory(1, 1); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); const wire_bytes = builder.toBuffer(); const module = new WebAssembly.Module(wire_bytes); @@ -364,7 +364,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprBrTable, 6, 0, 1, 2, 3, 4, 5, 6, kExprEnd, kExprI32Const, 3, diff --git a/deps/v8/test/mjsunit/wasm/data-segments.js b/deps/v8/test/mjsunit/wasm/data-segments.js index 91b6525537..38fd5ee06b 100644 --- a/deps/v8/test/mjsunit/wasm/data-segments.js +++ b/deps/v8/test/mjsunit/wasm/data-segments.js @@ -13,7 +13,7 @@ function SimpleDataSegmentTest(offset) { var builder = new WasmModuleBuilder(); builder.addMemory(1, 1, false); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("load"); builder.addDataSegment(offset, [9, 9, 9, 9]); @@ -41,7 +41,7 @@ function GlobalImportedInitTest(pad) { while (pad-- > 0) builder.addGlobal(kWasmI32); // pad builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("load"); builder.addDataSegment(g.index, [5, 5, 5, 5], true); diff --git a/deps/v8/test/mjsunit/wasm/divrem-trap.js b/deps/v8/test/mjsunit/wasm/divrem-trap.js index d9a23693f0..5eadaa44e9 100644 --- a/deps/v8/test/mjsunit/wasm/divrem-trap.js +++ b/deps/v8/test/mjsunit/wasm/divrem-trap.js @@ -16,8 +16,8 @@ function makeBinop(opcode) { builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- opcode, // -- ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/empirical_max_memory.js b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js index e2ff7ca517..59e15f8464 100644 --- a/deps/v8/test/mjsunit/wasm/empirical_max_memory.js +++ b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js @@ -19,14 +19,14 @@ let kMaxMemory = 2 * k1GiB - kPageSize; // TODO(titzer): raise this to 4GiB builder.addImportedMemory("i", "mem"); builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, 0, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, 0, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js index 9f7a7f71d2..e9e380a4ca 100644 --- a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js +++ b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js @@ -14,7 +14,7 @@ var module = new WasmModuleBuilder(); module.addFunction(undefined, kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add]) .exportAs("increment"); var buffer = module.toBuffer(true); diff --git a/deps/v8/test/mjsunit/wasm/errors.js b/deps/v8/test/mjsunit/wasm/errors.js index d98452e0e8..4304e54588 100644 --- a/deps/v8/test/mjsunit/wasm/errors.js +++ b/deps/v8/test/mjsunit/wasm/errors.js @@ -64,7 +64,7 @@ function assertConversionError(bytes, imports, msg) { .end().toBuffer(), f_error('expected 1 elements on the stack for return, found 0 @+24')); assertCompileError(builder().addFunction('f', kSig_v_v).addBody([ - kExprGetLocal, 0 + kExprLocalGet, 0 ]).end().toBuffer(), f_error('invalid local index: 0 @+24')); assertCompileError( builder().addStart(0).toBuffer(), @@ -182,7 +182,7 @@ function import_error(index, module, func, msg) { var sig = builder.addType(kSig_i_dd); builder.addImport("mod", "func", sig); builder.addFunction("main", sig) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprCallFunction, 0]) .exportAs("main"); var main = builder.instantiate({ mod: { diff --git a/deps/v8/test/mjsunit/wasm/exceptions-anyref.js b/deps/v8/test/mjsunit/wasm/exceptions-anyref.js index a41d69c0af..ccda100f65 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-anyref.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-anyref.js @@ -30,7 +30,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_null", kSig_i_i) .addBody([ kExprTry, kWasmAnyRef, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmAnyRef, kExprRefNull, @@ -63,7 +63,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_r); builder.addFunction("throw_param", kSig_v_r) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]).exportFunc(); let instance = builder.instantiate(); @@ -83,7 +83,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_r_r) .addBody([ kExprTry, kWasmAnyRef, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, kExprBrOnExn, 0, except, @@ -108,7 +108,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); .addLocals({anyfunc_count: 1}) .addBody([ kExprTry, kWasmAnyFunc, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, kExprBrOnExn, 0, except, @@ -128,7 +128,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_e_e) .addBody([ kExprTry, kWasmExnRef, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, kExprBrOnExn, 0, except, diff --git a/deps/v8/test/mjsunit/wasm/exceptions-global.js b/deps/v8/test/mjsunit/wasm/exceptions-global.js index 4a74dfb010..80af193c3e 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-global.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-global.js @@ -16,7 +16,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g = builder.addGlobal(kWasmExnRef); builder.addFunction("push_and_drop_exnref", kSig_v_v) .addBody([ - kExprGetGlobal, g.index, + kExprGlobalGet, g.index, kExprDrop, ]).exportFunc(); let instance = builder.instantiate(); @@ -30,7 +30,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); let g = builder.addGlobal(kWasmExnRef); builder.addFunction('push_and_return_exnref', kSig_e_v) - .addBody([kExprGetGlobal, g.index]) + .addBody([kExprGlobalGet, g.index]) .exportFunc(); let instance = builder.instantiate(); @@ -46,10 +46,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('catch_and_set_exnref', kSig_v_i) .addBody([ kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprCatch, - kExprSetGlobal, g.index, + kExprGlobalSet, g.index, kExprEnd, ]).exportFunc(); let instance = builder.instantiate(); @@ -68,10 +68,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction('set_param_exnref', kSig_v_e) .addBody([ kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprRethrow, kExprCatch, - kExprSetGlobal, g.index, + kExprGlobalSet, g.index, kExprEnd, ]).exportFunc(); let exception = "my fancy exception"; @@ -88,7 +88,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g_index = builder.addImportedGlobal("m", "exn", kWasmExnRef); builder.addFunction('rethrow_exnref', kSig_v_v) .addBody([ - kExprGetGlobal, g_index, + kExprGlobalGet, g_index, kExprRethrow, ]).exportFunc(); let exception = "my fancy exception"; @@ -104,7 +104,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g = builder.addGlobal(kWasmExnRef, true).exportAs("exn"); builder.addFunction('rethrow_exnref', kSig_v_v) .addBody([ - kExprGetGlobal, g.index, + kExprGlobalGet, g.index, kExprRethrow, ]).exportFunc(); let instance = builder.instantiate(); @@ -122,7 +122,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g_index = builder.addImportedGlobal("m", "exn", kWasmExnRef, true); builder.addFunction('rethrow_exnref', kSig_v_v) .addBody([ - kExprGetGlobal, g_index, + kExprGlobalGet, g_index, kExprRethrow, ]).exportFunc(); let exception1 = "my fancy exception"; @@ -143,7 +143,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let g2 = builder.addGlobal(kWasmExnRef); g2.init_index = g1_index; // Initialize {g2} to equal {g1}. builder.addFunction('push_and_return_exnref', kSig_e_v) - .addBody([kExprGetGlobal, g2.index]) + .addBody([kExprGlobalGet, g2.index]) .exportFunc(); let exception = { x: "my fancy exception" }; let instance = builder.instantiate({ "m": { "exn": exception }}); diff --git a/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js b/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js index 3b3fa365d5..be609cbf2d 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js @@ -26,11 +26,11 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprThrow, except, kExprCatch, - kExprSetLocal, 1, - kExprGetLocal, 0, + kExprLocalSet, 1, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprRethrow, kExprEnd, kExprI32Const, 23, @@ -56,23 +56,23 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprThrow, except2, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprTry, kWasmI32, kExprThrow, except1, kExprCatch, - kExprSetLocal, 1, - kExprGetLocal, 0, + kExprLocalSet, 1, + kExprLocalGet, 0, kExprI32Const, 0, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprRethrow, kExprEnd, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprRethrow, kExprEnd, kExprI32Const, 23, @@ -98,12 +98,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprThrow, except, kExprCatch, - kExprSetLocal, 1, + kExprLocalSet, 1, kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprRethrow, kExprEnd, kExprI32Const, 42, diff --git a/deps/v8/test/mjsunit/wasm/exceptions-simd.js b/deps/v8/test/mjsunit/wasm/exceptions-simd.js index ed16a7f2cc..00fc725f5d 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions-simd.js +++ b/deps/v8/test/mjsunit/wasm/exceptions-simd.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_simd", kSig_v_v) .addLocals({s128_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, 0, ]) .exportFunc(); @@ -32,7 +32,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); .addLocals({s128_count: 1}) .addBody([ kExprTry, kWasmS128, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, 0, kExprCatch, kExprBrOnExn, 0, except, diff --git a/deps/v8/test/mjsunit/wasm/exceptions.js b/deps/v8/test/mjsunit/wasm/exceptions.js index 7d53037269..ecaf0d06c9 100644 --- a/deps/v8/test/mjsunit/wasm/exceptions.js +++ b/deps/v8/test/mjsunit/wasm/exceptions.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("push_and_drop_exnref", kSig_v_v) .addLocals({except_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprDrop, ]).exportFunc(); let instance = builder.instantiate(); @@ -29,7 +29,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_v); builder.addFunction("throw_if_param_not_zero", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 0, kExprI32Ne, kExprIf, kWasmStmt, @@ -68,7 +68,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("simple_throw_catch_to_0_1", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except, @@ -99,12 +99,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprBlock, kWasmStmt, kExprTry, kWasmStmt, kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, @@ -149,12 +149,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, @@ -194,15 +194,15 @@ load("test/mjsunit/wasm/exceptions-utils.js"); .addBody([ kExprBlock, kWasmI32, kExprTry, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, kExprThrow, except, kExprEnd, kExprCatch, - kExprSetLocal, 1, + kExprLocalSet, 1, kExprI32Const, 23, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprBrOnExn, 1, except, kExprRethrow, kExprEnd, @@ -239,7 +239,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprI32Const, 2, kExprCatch, @@ -261,7 +261,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_i); builder.addFunction("throw_param", kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]).exportFunc(); let instance = builder.instantiate(); @@ -278,7 +278,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_f_f) .addBody([ kExprTry, kWasmF32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprF32Const, 0, 0, 0, 0, kExprCatch, @@ -299,7 +299,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_f); builder.addFunction("throw_param", kSig_v_f) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]).exportFunc(); let instance = builder.instantiate(); @@ -316,18 +316,18 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_i_i) .addLocals({i64_count: 1}) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI64UConvertI32, - kExprSetLocal, 1, + kExprLocalSet, 1, kExprTry, kWasmI64, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprThrow, except, kExprI64Const, 23, kExprCatch, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64Eq, ]).exportFunc(); let instance = builder.instantiate(); @@ -344,11 +344,11 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_l); builder.addFunction("throw_param", kSig_v_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI64UConvertI32, kExprI64Const, 32, kExprI64Shl, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64UConvertI32, kExprI64Ior, kExprThrow, except, @@ -367,7 +367,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_catch_param", kSig_d_d) .addBody([ kExprTry, kWasmF64, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0, kExprCatch, @@ -388,7 +388,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let except = builder.addException(kSig_v_d); builder.addFunction("throw_param", kSig_v_f) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprF64ConvertF32, kExprThrow, except, ]).exportFunc(); @@ -406,10 +406,10 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("throw_expr_with_params", kSig_v_ddi) .addBody([ // p2 * (p0 + min(p0, p1))|0 - 20 - kExprGetLocal, 2, - kExprGetLocal, 0, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprF64Min, kExprF64Add, kExprI32SConvertF64, @@ -468,7 +468,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); let kWasmThrowFunction = builder.addFunction("throw", kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, ]) .index; @@ -478,11 +478,11 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("same_scope", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 0, kExprI32Ne, kExprIf, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprUnreachable, kExprEnd, @@ -497,7 +497,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("same_scope_ignore", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprThrow, except, kExprUnreachable, kExprCatch, @@ -545,7 +545,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprTry, kWasmI32, kExprTry, kWasmI32, kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Eq, kExprIf, kWasmStmt, @@ -555,9 +555,9 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprEnd, kExprI32Const, 2, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprBlock, kWasmI32, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, @@ -566,12 +566,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprThrow, except, kExprUnreachable, kExprEnd, - kExprTeeLocal, 1, - kExprGetLocal, 0, + kExprLocalTee, 1, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI32Const, 8, kExprI32Ior, kExprThrow, except, @@ -580,9 +580,9 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprI32Const, 16, kExprI32Ior, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprBlock, kWasmI32, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, @@ -591,12 +591,12 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprThrow, except, kExprUnreachable, kExprEnd, - kExprTeeLocal, 1, - kExprGetLocal, 0, + kExprLocalTee, 1, + kExprLocalGet, 0, kExprI32Const, 3, kExprI32Eq, kExprIf, kWasmStmt, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI32Const, /*64=*/ 192, 0, kExprI32Ior, kExprThrow, except, @@ -605,9 +605,9 @@ load("test/mjsunit/wasm/exceptions-utils.js"); kExprI32Const, /*128=*/ 128, 1, kExprI32Ior, kExprCatch, - kExprSetLocal, 2, + kExprLocalSet, 2, kExprBlock, kWasmI32, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprBrOnExn, 0, except, kExprRethrow, kExprEnd, @@ -621,7 +621,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("from_direct_callee", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, kWasmThrowFunction, kExprUnreachable, kExprCatch, @@ -637,8 +637,8 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("from_indirect_callee", kSig_i_ii) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprCallIndirect, sig_v_i, kTableZero, kExprUnreachable, kExprCatch, @@ -653,7 +653,7 @@ load("test/mjsunit/wasm/exceptions-utils.js"); builder.addFunction("i_from_js", kSig_i_i) .addBody([ kExprTry, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, kJSThrowI, kExprUnreachable, kExprCatch, diff --git a/deps/v8/test/mjsunit/wasm/export-mutable-global.js b/deps/v8/test/mjsunit/wasm/export-mutable-global.js index 1ce918c6cc..90238f3cf9 100644 --- a/deps/v8/test/mjsunit/wasm/export-mutable-global.js +++ b/deps/v8/test/mjsunit/wasm/export-mutable-global.js @@ -59,10 +59,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let global_builder = builder.addGlobal(type, true).exportAs(name); if (value) global_builder.init = value; builder.addFunction("get " + name, makeSig([], [type])) - .addBody([kExprGetGlobal, index]) + .addBody([kExprGlobalGet, index]) .exportFunc(); builder.addFunction("set " + name, makeSig([type], [])) - .addBody([kExprGetLocal, 0, kExprSetGlobal, index]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, index]) .exportFunc(); } var instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/ffi-error.js b/deps/v8/test/mjsunit/wasm/ffi-error.js index 5f777ef1cf..217d7f3fd2 100644 --- a/deps/v8/test/mjsunit/wasm/ffi-error.js +++ b/deps/v8/test/mjsunit/wasm/ffi-error.js @@ -13,8 +13,8 @@ function CreateDefaultBuilder() { builder.addImport('mod', 'fun', sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- ]) // -- .exportFunc(); @@ -76,7 +76,7 @@ function checkFailingInstantiation( let sig_index = kSig_i_dd; builder.addFunction('exp', kSig_i_i) .addBody([ - kExprGetLocal, + kExprLocalGet, 0, ]) // -- .exportFunc(); @@ -126,8 +126,8 @@ function checkFailingInstantiation( builder.addMemory(1, 1, true); builder.addFunction('function_with_invalid_signature', kSig_l_ll) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI64Sub]) // -- .exportFunc() @@ -144,7 +144,7 @@ function checkFailingInstantiation( builder.addMemory(1, 1, true); builder.addFunction('function_with_invalid_signature', kSig_i_l) - .addBody([kExprGetLocal, 0, kExprI32ConvertI64]) + .addBody([kExprLocalGet, 0, kExprI32ConvertI64]) .exportFunc(); checkSuccessfulInstantiation( @@ -163,7 +163,7 @@ function checkFailingInstantiation( let index = builder.addImport('', 'func', sig_i64_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, kExprI64SConvertI32, kExprCallFunction, index // -- + kExprLocalGet, 0, kExprI64SConvertI32, kExprCallFunction, index // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/ffi.js b/deps/v8/test/mjsunit/wasm/ffi.js index 72cc57f598..884bd29450 100644 --- a/deps/v8/test/mjsunit/wasm/ffi.js +++ b/deps/v8/test/mjsunit/wasm/ffi.js @@ -13,8 +13,8 @@ function testCallFFI(func, check) { builder.addImport("", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 // -- ]) // -- .exportFunc(); @@ -76,8 +76,8 @@ testCallFFI(bind_sub, check_FOREIGN_SUB); builder.addImport("", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 // -- ]) // -- .exportFunc(); @@ -259,8 +259,8 @@ function testCallBinopVoid(type, func, check) { builder.addImport("", "func", makeSig_v_xx(type)); builder.addFunction("main", makeSig_r_xx(kWasmI32, type)) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- kExprI32Const, 33 // -- ]) // -- @@ -316,7 +316,7 @@ testCallBinopVoid(kWasmF64); .addBody([ kExprI32Const, 37, // -- kExprCallFunction, 0, // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallFunction, 1 // -- ]) // -- .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/float-constant-folding.js b/deps/v8/test/mjsunit/wasm/float-constant-folding.js index 6205da7cfc..332042e7fe 100644 --- a/deps/v8/test/mjsunit/wasm/float-constant-folding.js +++ b/deps/v8/test/mjsunit/wasm/float-constant-folding.js @@ -10,7 +10,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print("F32: sNaN - 0 = qNaN"); var builder = new WasmModuleBuilder(); builder.addFunction("F32Sub0", kSig_i_i).addBody( - [ kExprGetLocal, 0, kExprF32ReinterpretI32, kExprF32Const, 0x00, 0x00, + [ kExprLocalGet, 0, kExprF32ReinterpretI32, kExprF32Const, 0x00, 0x00, 0x00, 0x00, // 0.0 kExprF32Sub, kExprI32ReinterpretF32, ]).exportFunc(); var module = builder.instantiate(); @@ -23,7 +23,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); var builder = new WasmModuleBuilder(); builder.addFunction("F32Sub0", kSig_i_i).addBody( [ kExprF32Const, 0x00, 0x00, 0x00, 0x80, // 0.0 - kExprGetLocal, 0, kExprF32ReinterpretI32, kExprF32Sub, + kExprLocalGet, 0, kExprF32ReinterpretI32, kExprF32Sub, kExprI32ReinterpretF32, ]).exportFunc(); var module = builder.instantiate(); // F32Sub0(signalling_NaN) diff --git a/deps/v8/test/mjsunit/wasm/futex.js b/deps/v8/test/mjsunit/wasm/futex.js index 00353d48b0..d5bbf9ff1a 100644 --- a/deps/v8/test/mjsunit/wasm/futex.js +++ b/deps/v8/test/mjsunit/wasm/futex.js @@ -14,8 +14,8 @@ function WasmAtomicNotify(memory, offset, index, num) { builder.addImportedMemory("m", "memory", 0, 20, "shared"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, kExprAtomicNotify, /* alignment */ 0, offset]) .exportAs("main"); @@ -32,9 +32,9 @@ function WasmI32AtomicWait(memory, offset, index, val, timeout) { builder.addFunction("main", makeSig([kWasmI32, kWasmI32, kWasmF64], [kWasmI32])) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kExprI64SConvertF64, kAtomicPrefix, kExprI32AtomicWait, /* alignment */ 0, offset]) @@ -56,17 +56,17 @@ function WasmI64AtomicWait(memory, offset, index, val_low, makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmF64], [kWasmI32])) .addLocals({i64_count: 1}) // local that is passed as value param to wait .addBody([ - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI64UConvertI32, kExprI64Const, 32, kExprI64Shl, - kExprGetLocal, 2, + kExprLocalGet, 2, kExprI64UConvertI32, kExprI64Ior, - kExprSetLocal, 4, // Store the created I64 value in local - kExprGetLocal, 0, - kExprGetLocal, 4, - kExprGetLocal, 3, + kExprLocalSet, 4, // Store the created I64 value in local + kExprLocalGet, 0, + kExprLocalGet, 4, + kExprLocalGet, 3, kExprI64SConvertF64, kAtomicPrefix, kExprI64AtomicWait, /* alignment */ 0, offset]) diff --git a/deps/v8/test/mjsunit/wasm/gc-buffer.js b/deps/v8/test/mjsunit/wasm/gc-buffer.js index d8aa9a86d8..c7fdbbc47c 100644 --- a/deps/v8/test/mjsunit/wasm/gc-buffer.js +++ b/deps/v8/test/mjsunit/wasm/gc-buffer.js @@ -14,7 +14,7 @@ function run(f) { builder.addImport("mod", "the_name_of_my_import", kSig_i_i); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("main"); print("module"); diff --git a/deps/v8/test/mjsunit/wasm/gc-frame.js b/deps/v8/test/mjsunit/wasm/gc-frame.js index de8bdab51e..7d3b19741a 100644 --- a/deps/v8/test/mjsunit/wasm/gc-frame.js +++ b/deps/v8/test/mjsunit/wasm/gc-frame.js @@ -16,28 +16,28 @@ function makeFFI(func, t) { // the different parts of the stack. builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- - kExprGetLocal, 2, // -- - kExprGetLocal, 3, // -- - kExprGetLocal, 4, // -- - kExprGetLocal, 5, // -- - kExprGetLocal, 6, // -- - kExprGetLocal, 7, // -- - kExprGetLocal, 8, // -- - kExprGetLocal, 9, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- + kExprLocalGet, 2, // -- + kExprLocalGet, 3, // -- + kExprLocalGet, 4, // -- + kExprLocalGet, 5, // -- + kExprLocalGet, 6, // -- + kExprLocalGet, 7, // -- + kExprLocalGet, 8, // -- + kExprLocalGet, 9, // -- kExprCallFunction, 0, // -- kExprDrop, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- - kExprGetLocal, 2, // -- - kExprGetLocal, 3, // -- - kExprGetLocal, 4, // -- - kExprGetLocal, 5, // -- - kExprGetLocal, 6, // -- - kExprGetLocal, 7, // -- - kExprGetLocal, 8, // -- - kExprGetLocal, 9, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- + kExprLocalGet, 2, // -- + kExprLocalGet, 3, // -- + kExprLocalGet, 4, // -- + kExprLocalGet, 5, // -- + kExprLocalGet, 6, // -- + kExprLocalGet, 7, // -- + kExprLocalGet, 8, // -- + kExprLocalGet, 9, // -- kExprCallFunction, 0, // -- ]) // -- .exportFunc(); @@ -79,7 +79,7 @@ function print10(a, b, c, d, e, f, g, h, i) { var sig_index = builder.addType(kSig_i_i); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/gc-memory.js b/deps/v8/test/mjsunit/wasm/gc-memory.js new file mode 100644 index 0000000000..31e96f8be3 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/gc-memory.js @@ -0,0 +1,41 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let kPageSize = 65536; + +function allocMems(count, initial, maximum) { + print(`alloc ${count}`); + let result = []; + for (let i = 0; i < count; i++) { + print(` memory #${i} (initial=${initial}, maximum=${maximum})...`); + result.push(new WebAssembly.Memory({initial: initial, maximum: maximum})); + } + return result; +} + +function check(mems, initial) { + for (m of mems) { + assertEquals(initial * kPageSize, m.buffer.byteLength); + } +} + +function test(count, initial, maximum) { + let mems = allocMems(count, initial, maximum); + check(mems, initial); +} + +test(1, 1, 1); +test(1, 1, 2); +test(1, 1, 3); +test(1, 1, 4); + +test(2, 1, 1); +test(2, 1, 2); +test(2, 1, 3); +test(2, 1, 4); + +test(1, 1, undefined); +test(2, 1, undefined); +test(3, 1, undefined); +test(4, 1, undefined); diff --git a/deps/v8/test/mjsunit/wasm/gc-stress.js b/deps/v8/test/mjsunit/wasm/gc-stress.js index 8daff420da..55a780d3ec 100644 --- a/deps/v8/test/mjsunit/wasm/gc-stress.js +++ b/deps/v8/test/mjsunit/wasm/gc-stress.js @@ -11,7 +11,7 @@ function run(f) { builder.addImport("m", "f", kSig_i_i); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/globals.js b/deps/v8/test/mjsunit/wasm/globals.js index b29993a8fc..a72bc118c7 100644 --- a/deps/v8/test/mjsunit/wasm/globals.js +++ b/deps/v8/test/mjsunit/wasm/globals.js @@ -15,12 +15,12 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let sig_index = builder.addType(kSig_i_v); builder.addFunction("get", sig_index) .addBody([ - kExprGetGlobal, g.index]) + kExprGlobalGet, g.index]) .exportAs("get"); builder.addFunction("set", kSig_v_i) .addBody([ - kExprGetLocal, 0, - kExprSetGlobal, g.index]) + kExprLocalGet, 0, + kExprGlobalSet, g.index]) .exportAs("set"); let module = new WebAssembly.Module(builder.toBuffer()); @@ -54,7 +54,7 @@ function TestImported(type, val, expected) { var sig = makeSig([], [type]); var g = builder.addImportedGlobal("uuu", "foo", type); builder.addFunction("main", sig) - .addBody([kExprGetGlobal, g]) + .addBody([kExprGlobalGet, g]) .exportAs("main"); builder.addGlobal(kWasmI32); // pad @@ -76,7 +76,7 @@ TestImported(kWasmF64, 77777.88888, 77777.88888); let sig_index = builder.addType(kSig_i_v); builder.addFunction("main", sig_index) .addBody([ - kExprGetGlobal, g]) + kExprGlobalGet, g]) .exportAs("main"); let module = new WebAssembly.Module(builder.toBuffer()); @@ -152,7 +152,7 @@ function TestGlobalIndexSpace(type, val) { var sig = makeSig([], [type]); builder.addFunction("main", sig) - .addBody([kExprGetGlobal, def.index]) + .addBody([kExprGlobalGet, def.index]) .exportAs("main"); var instance = builder.instantiate({nnn: {foo: val}}); @@ -173,22 +173,22 @@ TestGlobalIndexSpace(kWasmF64, 12345.678); let sig_index = builder.addType(kSig_i_i); builder.addFunction("get", sig_index) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, kWasmI32, - kExprGetGlobal, g.index, + kExprGlobalGet, g.index, kExprElse, - kExprGetGlobal, h.index, + kExprGlobalGet, h.index, kExprEnd]) .exportAs("get"); builder.addFunction("set", kSig_v_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, kWasmStmt, - kExprGetLocal, 1, - kExprSetGlobal, g.index, + kExprLocalGet, 1, + kExprGlobalSet, g.index, kExprElse, - kExprGetLocal, 1, - kExprSetGlobal, h.index, + kExprLocalGet, 1, + kExprGlobalSet, h.index, kExprEnd]) .exportAs("set"); diff --git a/deps/v8/test/mjsunit/wasm/graceful_shutdown.js b/deps/v8/test/mjsunit/wasm/graceful_shutdown.js index aa50e6cf77..0f55b795c1 100644 --- a/deps/v8/test/mjsunit/wasm/graceful_shutdown.js +++ b/deps/v8/test/mjsunit/wasm/graceful_shutdown.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); for (i = 0; i < 100; i++) { builder.addFunction("sub" + i, kSig_i_i) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Const, i % 61, // -- kExprI32Sub]) // -- .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js index 17c6803784..f615602a8e 100644 --- a/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js +++ b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); for (i = 0; i < 100; i++) { builder.addFunction("sub" + i, kSig_i_i) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Const, i % 61, // -- kExprI32Sub]) // -- .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js index 9ab2334a63..b228449703 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js @@ -10,7 +10,7 @@ let module = (() => { let builder = new WasmModuleBuilder(); builder.addMemory(1, undefined, false); builder.addFunction("grow_memory", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.exportMemoryAs("memory"); return builder.toModule(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js index 93bb56d83d..8babc66b75 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js @@ -13,12 +13,12 @@ function generateBuilder() { let builder = new WasmModuleBuilder(); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, - kExprI32StoreMem, 0, 0, kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, + kExprI32StoreMem, 0, 0, kExprLocalGet, 1 ]) .exportFunc(); return builder; @@ -32,7 +32,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory @@ -59,7 +59,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory @@ -94,7 +94,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, index, // put index on stack kExprI32Const, newValue, // put the value on stack @@ -127,7 +127,7 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack kExprMemoryGrow, kMemoryZero, // grow memory @@ -159,16 +159,16 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); @@ -191,20 +191,20 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprElse, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); @@ -226,20 +226,20 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprElse, kExprI32Const, deltaPages, // put deltaPages on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, value, // put the value on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); @@ -263,23 +263,23 @@ function generateBuilder() { let builder = generateBuilder(); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, // get condition parameter + kExprLocalGet, 0, // get condition parameter kExprIf, kWasmStmt, // if it's 1 then enter if kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, valueIf, // put valueIf on stack kExprI32StoreMem, 0, 0, // store kExprElse, kExprI32Const, deltaPagesElse, // put deltaPagesElse on stack kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32Const, valueElse, // put valueElse on stack kExprI32StoreMem, 0, 0, // store kExprEnd, - kExprGetLocal, 1, // get index parameter + kExprLocalGet, 1, // get index parameter kExprI32LoadMem, 0, 0 // load from grown memory ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js index 1790f9760f..7940ab5f19 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js @@ -20,12 +20,12 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // get number of new pages + kExprLocalGet, 0, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow kExprMemorySize, kMemoryZero // get the memory size @@ -47,19 +47,19 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction('main', kSig_v_iii) .addBody([ - kExprGetLocal, 0, // get number of new pages + kExprLocalGet, 0, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow - kExprGetLocal, 1, // get index - kExprGetLocal, 2, // get value + kExprLocalGet, 1, // get index + kExprLocalGet, 2, // get value kExprI32StoreMem, 0, 0 // store ]) .exportFunc(); @@ -118,24 +118,24 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_ii) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. - kExprGetLocal, 1, // get number of new pages + kExprLocalGet, 1, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -161,13 +161,13 @@ print('=== grow_memory in direct calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; // parameters: iterations, deltaPages, index @@ -175,29 +175,29 @@ print('=== grow_memory in direct calls ==='); .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. - kExprGetLocal, 1, // get number of new pages + kExprLocalGet, 1, // get number of new pages kExprCallFunction, kGrowFunction, // call the grow function kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 2, // put index (for store) - kExprGetLocal, 2, // put index (for load) + kExprLocalGet, 2, // put index (for store) + kExprLocalGet, 2, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase counter kExprI32StoreMem, 0, 0, // store counter in memory // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Return the value - kExprGetLocal, 2, // - + kExprLocalGet, 2, // - kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) @@ -225,13 +225,13 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 1, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 1, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow kExprMemorySize, kMemoryZero // get the memory size @@ -255,21 +255,21 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); let sig = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], []); builder.addFunction('main', sig) .addBody([ - kExprGetLocal, 1, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 1, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow - kExprGetLocal, 2, // get index - kExprGetLocal, 3, // get value + kExprLocalGet, 2, // get index + kExprLocalGet, 3, // get value kExprI32StoreMem, 0, 0 // store ]) .exportFunc(); @@ -311,7 +311,7 @@ print('\n=== grow_memory in indirect calls ==='); kExprI32Const, index, // put index on stack kExprI32Const, oldValue, // put old value on stack kExprI32StoreMem, 0, 0, // store - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprI32Const, index, // put index on stack kExprI32LoadMem, 0, 0 // load from grown memory @@ -332,25 +332,25 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('main', kSig_i_iii) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprIf, kWasmStmt, // if <param1> != 0 // Grow memory. - kExprGetLocal, 2, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 2, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 1, // decrease <param1> + kExprLocalSet, 1, // decrease <param1> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -378,13 +378,13 @@ print('\n=== grow_memory in indirect calls ==='); builder.addMemory(initialMemoryPages, maximumMemoryPages, true); let kGrowFunction = builder.addFunction('grow', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc() .index; builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); builder @@ -394,30 +394,30 @@ print('\n=== grow_memory in indirect calls ==='); .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprIf, kWasmStmt, // if <param1> != 0 // Grow memory. - kExprGetLocal, 2, // get number of new pages - kExprGetLocal, 0, // get index of the function + kExprLocalGet, 2, // get number of new pages + kExprLocalGet, 0, // get index of the function kExprCallIndirect, 0, kTableZero, // call the function kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 3, // put index (for store) - kExprGetLocal, 3, // put index (for load) + kExprLocalGet, 3, // put index (for store) + kExprLocalGet, 3, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase counter kExprI32StoreMem, 0, 0, // store counter in memory // Decrease loop variable. - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 1, // decrease <param1> + kExprLocalSet, 1, // decrease <param1> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Return the value - kExprGetLocal, 3, // - + kExprLocalGet, 3, // - kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js index ed04e23c63..143b555b17 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js @@ -14,8 +14,8 @@ function generateBuilder() { builder.addMemory(initialPages, maximumPages, true); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); return builder; @@ -31,17 +31,17 @@ function generateBuilder() { .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPages, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -83,17 +83,17 @@ function generateBuilder() { kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPagesIn, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop @@ -132,29 +132,29 @@ function generateBuilder() { .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPages, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 1, // put index (for store) - kExprGetLocal, 1, // put index (for load) + kExprLocalGet, 1, // put index (for store) + kExprLocalGet, 1, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase counter kExprI32StoreMem, 0, 0, // store counter in memory // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Increase counter in memory. - kExprGetLocal, 1, // - + kExprLocalGet, 1, // - kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) @@ -195,37 +195,37 @@ function generateBuilder() { kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 1, // put index (for store) - kExprGetLocal, 1, // put index (for load) + kExprLocalGet, 1, // put index (for store) + kExprLocalGet, 1, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase value on stack kExprI32StoreMem, 0, 0, // store new value // Start loop. kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 // Grow memory. kExprI32Const, deltaPagesIn, // - kExprMemoryGrow, kMemoryZero, // grow memory kExprDrop, // drop the result of grow // Increase counter in memory. - kExprGetLocal, 1, // put index (for store) - kExprGetLocal, 1, // put index (for load) + kExprLocalGet, 1, // put index (for store) + kExprLocalGet, 1, // put index (for load) kExprI32LoadMem, 0, 0, // load from grown memory kExprI32Const, 1, // - kExprI32Add, // increase value on stack kExprI32StoreMem, 0, 0, // store new value // Decrease loop variable. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprBr, 1, // continue kExprEnd, // end if kExprEnd, // end loop // Return counter from memory. - kExprGetLocal, 1, // put index on stack + kExprLocalGet, 1, // put index on stack kExprI32LoadMem, 0, 0 // load from grown memory // clang-format on ]) diff --git a/deps/v8/test/mjsunit/wasm/grow-memory.js b/deps/v8/test/mjsunit/wasm/grow-memory.js index 0e5618a2b1..6d0e7e5c5f 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory.js @@ -10,28 +10,28 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); function genMemoryGrowBuilder() { var builder = new WasmModuleBuilder(); builder.addFunction("grow_memory", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); builder.addFunction("load16", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem16U, 0, 0]) .exportFunc(); builder.addFunction("store16", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem16, 0, 0, + kExprLocalGet, 1]) .exportFunc(); builder.addFunction("load8", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem8U, 0, 0]) .exportFunc(); builder.addFunction("store8", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem8, 0, 0, + kExprLocalGet, 1]) .exportFunc(); return builder; } diff --git a/deps/v8/test/mjsunit/wasm/grow-shared-memory.js b/deps/v8/test/mjsunit/wasm/grow-shared-memory.js index bbd180b39c..3c9d72b499 100644 --- a/deps/v8/test/mjsunit/wasm/grow-shared-memory.js +++ b/deps/v8/test/mjsunit/wasm/grow-shared-memory.js @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(v8:8832): Enable --stress-opt on these tests -// Flags: --wasm-grow-shared-memory -// Flags: --experimental-wasm-threads --no-stress-opt +// Flags: --wasm-grow-shared-memory --experimental-wasm-threads load("test/mjsunit/wasm/wasm-module-builder.js"); @@ -137,7 +135,7 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); let obj = {memory: memory, module: module}; @@ -169,7 +167,7 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); let obj = {memory: memory, module: module}; @@ -200,10 +198,10 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow_twice", kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero, kExprDrop, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); @@ -239,10 +237,10 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow_and_size", kSig_i_i) - .addBody([kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero, kExprDrop, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero, kExprDrop, kExprMemorySize, kMemoryZero]) @@ -298,13 +296,13 @@ let workerHelpers = assertTrue.toString() + assertIsWasmSharedMemory.toString(); var builder = new WasmModuleBuilder(); builder.addImportedMemory("m", "memory", 5, 100, "shared"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.addFunction("atomic_load", kSig_i_i) - .addBody([kExprGetLocal, 0, kAtomicPrefix, kExprI32AtomicLoad, 2, 0]) + .addBody([kExprLocalGet, 0, kAtomicPrefix, kExprI32AtomicLoad, 2, 0]) .exportFunc(); builder.addFunction("atomic_store", kSig_v_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicStore, 2, 0]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); diff --git a/deps/v8/test/mjsunit/wasm/huge-memory.js b/deps/v8/test/mjsunit/wasm/huge-memory.js index bf037b0c92..6c145d70cb 100644 --- a/deps/v8/test/mjsunit/wasm/huge-memory.js +++ b/deps/v8/test/mjsunit/wasm/huge-memory.js @@ -16,8 +16,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addMemory(num_pages, num_pages, true); builder.addFunction("geti", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul, kExprI32LoadMem, 0, 0, ]) diff --git a/deps/v8/test/mjsunit/wasm/import-function.js b/deps/v8/test/mjsunit/wasm/import-function.js index ec187aff4a..6bbad8a222 100644 --- a/deps/v8/test/mjsunit/wasm/import-function.js +++ b/deps/v8/test/mjsunit/wasm/import-function.js @@ -13,8 +13,8 @@ function testCallImport(func, check) { builder.addImport("q", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0]) // -- .exportAs("main"); @@ -186,8 +186,8 @@ function testCallBinopVoid(type, func, check) { builder.addImport("q", "func", makeSig_v_xx(type)); builder.addFunction("main", makeSig_r_xx(kWasmI32, type)) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- kExprI32Const, 39, // -- ]) @@ -244,7 +244,7 @@ function testCallPrint() { .addBody([ kExprI32Const, 27, // -- kExprCallFunction, 0, // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallFunction, 1 // -- ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/import-memory.js b/deps/v8/test/mjsunit/wasm/import-memory.js index fc688dc7ce..08100efabd 100644 --- a/deps/v8/test/mjsunit/wasm/import-memory.js +++ b/deps/v8/test/mjsunit/wasm/import-memory.js @@ -51,7 +51,7 @@ var kV8MaxPages = 32767; builder.exportMemoryAs("exported_mem"); builder.addFunction("foo", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("foo"); i1 = builder.instantiate(); @@ -63,7 +63,7 @@ var kV8MaxPages = 32767; builder.addImportedMemory("fil", "imported_mem"); builder.addFunction("bar", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs("bar"); i2 = builder.instantiate({fil: {imported_mem: i1.exports.exported_mem}}); @@ -89,11 +89,11 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("gaz", "mine"); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); var offset; let instance = builder.instantiate({gaz: {mine: memory}}); @@ -119,11 +119,11 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("mine", "dog", 0, 20); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); var offset; let instance = builder.instantiate({mine: {dog: memory}}); @@ -157,11 +157,11 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("mine", "fro"); builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1]) .exportFunc(); var offset; let instance = builder.instantiate({mine: {fro: memory}}); @@ -187,7 +187,7 @@ var kV8MaxPages = 32767; assertEquals(2*kPageSize, memory.buffer.byteLength); let builder = new WasmModuleBuilder(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); builder.addImportedMemory("cat", "mine"); let instance = builder.instantiate({cat: {mine: memory}}); @@ -217,7 +217,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance = builder.instantiate({fur: { imported_mem: exp_instance.exports.exported_mem}}); @@ -238,7 +238,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportAs("mem_size"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); var instances = []; @@ -279,7 +279,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 5; i++) { @@ -344,7 +344,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 10; i++) { @@ -379,7 +379,7 @@ var kV8MaxPages = 32767; builder.addMemory(1, kSpecMaxPages, true); builder.exportMemoryAs("exported_mem"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance_1 = builder.instantiate(); } @@ -387,7 +387,7 @@ var kV8MaxPages = 32767; let builder = new WasmModuleBuilder(); builder.addImportedMemory("doo", "imported_mem"); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance_2 = builder.instantiate({ doo: {imported_mem: instance_1.exports.exported_mem}}); @@ -407,7 +407,7 @@ var kV8MaxPages = 32767; .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); instance = builder.instantiate(); assertEquals(kPageSize, instance.exports.exported_mem.buffer.byteLength); diff --git a/deps/v8/test/mjsunit/wasm/import-mutable-global.js b/deps/v8/test/mjsunit/wasm/import-mutable-global.js index 715549a41f..70ce50be00 100644 --- a/deps/v8/test/mjsunit/wasm/import-mutable-global.js +++ b/deps/v8/test/mjsunit/wasm/import-mutable-global.js @@ -11,7 +11,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let builder = new WasmModuleBuilder(); builder.addImportedGlobal("mod", "g", kWasmI32); builder.addFunction("main", kSig_i_v) - .addBody([kExprGetGlobal, 0]) + .addBody([kExprGlobalGet, 0]) .exportAs("main"); let main = builder.instantiate({mod: {g: global}}).exports.main; @@ -54,10 +54,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); function addGlobalGetterAndSetter(builder, index, name, type) { builder.addFunction('get' + name, makeSig([], [type])) - .addBody([kExprGetGlobal, index]) + .addBody([kExprGlobalGet, index]) .exportFunc(); builder.addFunction('set' + name, makeSig([type], [])) - .addBody([kExprGetLocal, 0, kExprSetGlobal, index]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, index]) .exportFunc(); } @@ -137,20 +137,20 @@ function addGlobalGetterAndSetter(builder, index, name, type) { const index = 0; builder.addFunction('geti64_hi', makeSig([], [kWasmI32])) .addBody([ - kExprGetGlobal, index, + kExprGlobalGet, index, kExprI64Const, 32, kExprI64ShrU, kExprI32ConvertI64]) .exportFunc(); builder.addFunction('geti64_lo', makeSig([], [kWasmI32])) - .addBody([kExprGetGlobal, index, kExprI32ConvertI64]) + .addBody([kExprGlobalGet, index, kExprI32ConvertI64]) .exportFunc(); builder.addFunction("seti64", makeSig([kWasmI32, kWasmI32], [])) .addBody([ - kExprGetLocal, 1, kExprI64UConvertI32, - kExprGetLocal, 0, kExprI64UConvertI32, + kExprLocalGet, 1, kExprI64UConvertI32, + kExprLocalGet, 0, kExprI64UConvertI32, kExprI64Const, 32, kExprI64Shl, kExprI64Ior, - kExprSetGlobal, index]) + kExprGlobalSet, index]) .exportFunc(); }; diff --git a/deps/v8/test/mjsunit/wasm/import-table.js b/deps/v8/test/mjsunit/wasm/import-table.js index 098d03d4d6..6693559c8f 100644 --- a/deps/v8/test/mjsunit/wasm/import-table.js +++ b/deps/v8/test/mjsunit/wasm/import-table.js @@ -34,7 +34,7 @@ let kTableSize = 50; let f15 = addConstFunc(builder, 15); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -57,7 +57,7 @@ let kTableSize = 50; let f21 = addConstFunc(builder, 21); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -92,7 +92,7 @@ function addConstFuncUsingGlobal(builder, val) { let g = builder.addGlobal(kWasmI32, false); g.init = val; return builder.addFunction("global" + val, kSig_i_v) - .addBody([kExprGetGlobal, g.index]).index; + .addBody([kExprGlobalGet, g.index]).index; } (function TestAliasedImportedTableInstanceGlobals() { @@ -106,7 +106,7 @@ function addConstFuncUsingGlobal(builder, val) { let f14 = addConstFuncUsingGlobal(builder, 14); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -129,7 +129,7 @@ function addConstFuncUsingGlobal(builder, val) { let f22 = addConstFuncUsingGlobal(builder, 22); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -186,7 +186,7 @@ function addConstFuncUsingMemory(builder, val) { let f13 = addConstFuncUsingMemory(builder, 13); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); @@ -211,7 +211,7 @@ function addConstFuncUsingMemory(builder, val) { let f23 = addConstFuncUsingMemory(builder, 23); let call = builder.addFunction("call", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, signums.i_v, kTableZero ]) .exportAs("call"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js b/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js index 414ca19c99..69fb4dcf43 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js +++ b/deps/v8/test/mjsunit/wasm/indirect-call-non-zero-table.js @@ -41,28 +41,28 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .index; builder.addFunction('call1', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprCallIndirect, sig_index, table1]) .exportAs('call1'); builder.addFunction('return_call1', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprReturnCallIndirect, sig_index, table1]) .exportAs('return_call1'); builder.addFunction('call2', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprCallIndirect, sig_index, table2]) .exportAs('call2'); builder.addFunction('return_call2', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprReturnCallIndirect, sig_index, table2]) .exportAs('return_call2'); builder.addFunction('call_invalid_sig', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprGetLocal, 0, // function index + param + .addBody([kExprLocalGet, 0, kExprLocalGet, 0, // function index + param kExprCallIndirect, other_sig, table2]) .exportAs('call_invalid_sig'); builder.addFunction('return_call_invalid_sig', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprGetLocal, 0, // function index + param + .addBody([kExprLocalGet, 0, kExprLocalGet, 0, // function index + param kExprReturnCallIndirect, other_sig, table2]) .exportAs('return_call_invalid_sig'); @@ -119,10 +119,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); const sig_index = builder.addType(kSig_i_v); const f1 = builder.addFunction("foo", sig_index) - .addBody([kExprGetGlobal, g, kExprI32Const, 12, kExprI32Add]); + .addBody([kExprGlobalGet, g, kExprI32Const, 12, kExprI32Add]); builder.addFunction('call', kSig_i_i) - .addBody([kExprGetLocal, 0, // function index + .addBody([kExprLocalGet, 0, // function index kExprCallIndirect, sig_index, t1]) .exportAs('call'); @@ -167,14 +167,14 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder.addType(kSig_i_ii); builder.addFunction("placeholder", sig_index) - .addBody([kExprGetLocal, 0]); + .addBody([kExprLocalGet, 0]); builder.addElementSegment(table_index, g, true, [div]); builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 55, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, table_index]) // -- .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-calls.js b/deps/v8/test/mjsunit/wasm/indirect-calls.js index e9f560a019..603d7561ec 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-calls.js +++ b/deps/v8/test/mjsunit/wasm/indirect-calls.js @@ -15,20 +15,20 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addImport("q", "add", sig_index); var f = builder.addFunction("add", sig_index) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0 + kExprLocalGet, 0, kExprLocalGet, 1, kExprCallFunction, 0 ]); print("internal add index = " + f.index); builder.addFunction("sub", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub, // -- ]); builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero ]) .exportFunc() @@ -68,20 +68,20 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); var mul = builder.addImport("q", "mul", sig_i_ii); var add = builder.addFunction("add", sig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); var popcnt = builder.addFunction("popcnt", sig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Popcnt // -- ]); var main = builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero ]) .exportFunc(); @@ -106,20 +106,20 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); function AddFunctions(builder) { var mul = builder.addFunction("mul", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Mul // -- ]); var add = builder.addFunction("add", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); var sub = builder.addFunction("sub", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub // -- ]); return {mul: mul, add: add, sub: sub}; @@ -135,8 +135,8 @@ function AddFunctions(builder) { builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -163,8 +163,8 @@ function AddFunctions(builder) { builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -200,8 +200,8 @@ function AddFunctions(builder) { builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js b/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js index 9e8ddac1c5..ea148c5087 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js +++ b/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js @@ -65,14 +65,14 @@ function caller_module() { builder.addFunction("call1", sig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_i_v, kTableZero]) // -- .exportAs("call1"); builder.addFunction("call2", sig_i_i) .addBody([ kExprI32Const, 11, // -- - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_i_i, kTableZero]) // -- .exportAs("call2"); @@ -80,7 +80,7 @@ function caller_module() { .addBody([ kExprI32Const, 21, kExprI32Const, 22, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero]) // -- .exportAs("call3"); diff --git a/deps/v8/test/mjsunit/wasm/indirect-tables.js b/deps/v8/test/mjsunit/wasm/indirect-tables.js index 58df978859..e48157001b 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-tables.js +++ b/deps/v8/test/mjsunit/wasm/indirect-tables.js @@ -10,20 +10,20 @@ function AddFunctions(builder) { let sig_index = builder.addType(kSig_i_ii); let mul = builder.addFunction("mul", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Mul // -- ]); let add = builder.addFunction("add", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); let sub = builder.addFunction("sub", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub // -- ]); return {mul: mul, add: add, sub: sub}; @@ -41,8 +41,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -121,8 +121,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -184,8 +184,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 55, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -249,11 +249,11 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder.addType(kSig_i_v); let f = builder.addFunction("f", sig_index) .addBody([ - kExprGetGlobal, g + kExprGlobalGet, g ]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero]) // -- .exportAs("main"); builder.addElementSegment(0, g, true, [f.index]); @@ -292,7 +292,7 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index1, kTableZero]) // -- .exportAs("main"); @@ -311,7 +311,7 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index2, kTableZero]) // -- .exportAs("main"); @@ -404,11 +404,11 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder.addType(kSig_i_v); builder.addFunction("g", sig_index) .addBody([ - kExprGetGlobal, g + kExprGlobalGet, g ]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero]) // -- .exportAs("main"); builder.addElementSegment(0, g, true, [g]); @@ -572,7 +572,7 @@ function js_div(a, b) { return (a / b) | 0; } let sig_index = builder0.addType(kSig_i_v); builder0.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallIndirect, sig_index, kTableZero ]) .exportAs('main'); @@ -584,7 +584,7 @@ function js_div(a, b) { return (a / b) | 0; } // instance1 imports the table and adds a function to it. let builder1 = new WasmModuleBuilder(); builder1.setName('module_1'); - builder1.addFunction('f', kSig_i_i).addBody([kExprGetLocal, 0]); + builder1.addFunction('f', kSig_i_i).addBody([kExprLocalGet, 0]); builder1.addImportedTable('z', 'table'); builder1.addElementSegment(0, 0, false, [0]); let module1 = new WebAssembly.Module(builder1.toBuffer()); @@ -611,7 +611,7 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); let sig = builder.addType(kSig_i_v); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig, kTableZero]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig, kTableZero]) .exportAs('main'); builder.addImportedMemory('', 'memory', 1); @@ -653,7 +653,7 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); let sig = builder.addType(kSig_i_v); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig, kTableZero]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig, kTableZero]) .exportAs('main'); builder.addImportedTable('', 'table'); @@ -711,8 +711,8 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); builder.addFunction("mul", kSig_i_ii) .addBody( - [kExprGetLocal, 0, - kExprGetLocal, 1, + [kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul]) .exportFunc(); return builder.instantiate().exports.mul; @@ -725,8 +725,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 33, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -756,8 +756,8 @@ function js_div(a, b) { return (a / b) | 0; } let builder = new WasmModuleBuilder(); builder.addFunction("mul", kSig_i_ii) .addBody( - [kExprGetLocal, 0, - kExprGetLocal, 1, + [kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul]) .exportFunc(); return builder.instantiate().exports.mul; @@ -775,8 +775,8 @@ function js_div(a, b) { return (a / b) | 0; } builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 44, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -817,7 +817,7 @@ function js_div(a, b) { return (a / b) | 0; } builder.addImport("q", "f1", kSig_i_v); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportFunc(); @@ -879,7 +879,7 @@ function js_div(a, b) { return (a / b) | 0; } ]); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js b/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js index 29b65bc9b8..401be71504 100644 --- a/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js +++ b/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js @@ -17,7 +17,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 5; i++) { diff --git a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js index 1c5f10a832..7d4b848465 100644 --- a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js +++ b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js @@ -130,8 +130,8 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88))); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, kExprI32LoadMem, 0, 0, kExprI32Const, 1, - kExprCallIndirect, signature, kTableZero, kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprI32Const, 1, + kExprCallIndirect, signature, kTableZero, kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprCallFunction, 0, kExprI32Add ]) .exportFunc(); @@ -139,7 +139,7 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88))); // writer(mem[i]); // return mem[i] + some_value(); builder.addFunction('_wrap_writer', signature).addBody([ - kExprGetLocal, 0, kExprCallFunction, 1 + kExprLocalGet, 0, kExprCallFunction, 1 ]); builder.appendToTable([2, 3]); @@ -176,11 +176,11 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88))); var builder = new WasmModuleBuilder(); builder.addGlobal(kWasmI32, true); builder.addFunction('read', kSig_i_v) - .addBody([kExprGetGlobal, 0]) + .addBody([kExprGlobalGet, 0]) .exportFunc(); builder.addFunction('write', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprSetGlobal, 0]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, 0]) .exportFunc(); var module = new WebAssembly.Module(builder.toBuffer()); diff --git a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js index 573e1e1d9e..27df605d46 100644 --- a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js +++ b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js @@ -29,9 +29,9 @@ function checkStack(stack, expected_lines) { // grow_memory can be called from interpreted or compiled code, and changes // should be reflected in either execution. var builder = new WasmModuleBuilder(); - var grow_body = [kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]; - var load_body = [kExprGetLocal, 0, kExprI32LoadMem, 0, 0]; - var store_body = [kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0]; + var grow_body = [kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]; + var load_body = [kExprLocalGet, 0, kExprI32LoadMem, 0, 0]; + var store_body = [kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0]; builder.addFunction('grow_memory', kSig_i_i).addBody(grow_body).exportFunc(); builder.addFunction('load', kSig_i_i).addBody(load_body).exportFunc(); builder.addFunction('store', kSig_v_ii).addBody(store_body).exportFunc(); @@ -96,7 +96,7 @@ function createTwoInstancesCallingEachOther(inner_throws = false) { let id_imp = builder1.addImport('q', 'id', kSig_i_i); let plus_one = builder1.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Add, // - kExprCallFunction, id_imp @@ -114,7 +114,7 @@ function createTwoInstancesCallingEachOther(inner_throws = false) { let plus_two = builder2.addFunction('plus_two', kSig_i_i) .addBody([ // Call import, add one more. - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, plus_one_imp, // - kExprI32Const, 1, // - kExprI32Add diff --git a/deps/v8/test/mjsunit/wasm/interpreter.js b/deps/v8/test/mjsunit/wasm/interpreter.js index c1c03a4dd0..43ecc4a33a 100644 --- a/deps/v8/test/mjsunit/wasm/interpreter.js +++ b/deps/v8/test/mjsunit/wasm/interpreter.js @@ -59,10 +59,10 @@ function checkStack(stack, expected_lines) { builder.addFunction('main', makeSig([kWasmI32, kWasmF64], [kWasmF32])) .addBody([ // call #0 with arg 0 and arg 0 + 1 - kExprGetLocal, 0, kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add, + kExprLocalGet, 0, kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add, kExprCallFunction, 0, // call #1 with arg 1 - kExprGetLocal, 1, kExprCallFunction, 1, + kExprLocalGet, 1, kExprCallFunction, 1, // convert returned value to f32 kExprF32UConvertI32, // add the two values @@ -151,28 +151,28 @@ function checkStack(stack, expected_lines) { builder.addGlobal(kWasmF32, true); // 2 builder.addGlobal(kWasmF64, true); // 3 builder.addFunction('get_i32', kSig_i_v) - .addBody([kExprGetGlobal, 0]) + .addBody([kExprGlobalGet, 0]) .exportFunc(); builder.addFunction('get_i64', kSig_d_v) - .addBody([kExprGetGlobal, 1, kExprF64SConvertI64]) + .addBody([kExprGlobalGet, 1, kExprF64SConvertI64]) .exportFunc(); builder.addFunction('get_f32', kSig_d_v) - .addBody([kExprGetGlobal, 2, kExprF64ConvertF32]) + .addBody([kExprGlobalGet, 2, kExprF64ConvertF32]) .exportFunc(); builder.addFunction('get_f64', kSig_d_v) - .addBody([kExprGetGlobal, 3]) + .addBody([kExprGlobalGet, 3]) .exportFunc(); builder.addFunction('set_i32', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprSetGlobal, 0]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, 0]) .exportFunc(); builder.addFunction('set_i64', kSig_v_d) - .addBody([kExprGetLocal, 0, kExprI64SConvertF64, kExprSetGlobal, 1]) + .addBody([kExprLocalGet, 0, kExprI64SConvertF64, kExprGlobalSet, 1]) .exportFunc(); builder.addFunction('set_f32', kSig_v_d) - .addBody([kExprGetLocal, 0, kExprF32ConvertF64, kExprSetGlobal, 2]) + .addBody([kExprLocalGet, 0, kExprF32ConvertF64, kExprGlobalSet, 2]) .exportFunc(); builder.addFunction('set_f64', kSig_v_d) - .addBody([kExprGetLocal, 0, kExprSetGlobal, 3]) + .addBody([kExprLocalGet, 0, kExprGlobalSet, 3]) .exportFunc(); var instance = builder.instantiate(); // Initially, all should be zero. @@ -205,7 +205,7 @@ function checkStack(stack, expected_lines) { var builder = new WasmModuleBuilder(); builder.addImport('mod', 'func', kSig_v_i); builder.addFunction('main', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); instance = builder.instantiate({mod: {func: func}}); // Test that this does not mess up internal state by executing it three times. @@ -239,14 +239,14 @@ function checkStack(stack, expected_lines) { var sig_i_i = builder.addType(kSig_i_i); var mul = builder.addImport('q', 'mul', sig_i_ii); var add = builder.addFunction('add', sig_i_ii).addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add ]); var mismatch = - builder.addFunction('sig_mismatch', sig_i_i).addBody([kExprGetLocal, 0]); + builder.addFunction('sig_mismatch', sig_i_i).addBody([kExprLocalGet, 0]); var main = builder.addFunction('main', kSig_i_iii) .addBody([ // Call indirect #0 with args <#1, #2>. - kExprGetLocal, 1, kExprGetLocal, 2, kExprGetLocal, 0, + kExprLocalGet, 1, kExprLocalGet, 2, kExprLocalGet, 0, kExprCallIndirect, sig_i_ii, kTableZero ]) .exportFunc(); @@ -281,7 +281,7 @@ function checkStack(stack, expected_lines) { builder.addFunction('main', kSig_v_i) .addBody([ // Call indirect #0 with arg #0, drop result. - kExprGetLocal, 0, kExprCallIndirect, sig_l_v, kTableZero, kExprDrop + kExprLocalGet, 0, kExprCallIndirect, sig_l_v, kTableZero, kExprDrop ]) .exportFunc(); builder.appendToTable([imp, direct.index, indirect.index]); @@ -409,7 +409,7 @@ function checkStack(stack, expected_lines) { var builder = new WasmModuleBuilder(); var imp = builder.addImport('mod', 'the_name_of_my_import', kSig_i_i); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, imp]) + .addBody([kExprLocalGet, 0, kExprCallFunction, imp]) .exportAs('main'); print('module'); return new WebAssembly.Module(builder.toBuffer()); @@ -525,7 +525,7 @@ function checkStack(stack, expected_lines) { const sig_index = builder0.addType(kSig_i_v); builder0.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallIndirect, sig_index, kTableZero ]) // -- .exportAs('main'); @@ -549,7 +549,7 @@ function checkStack(stack, expected_lines) { print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('main', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32Const, 7, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprI32Const, 7, kExprI32Add]) .exportFunc(); const wire_bytes = builder.toBuffer(); diff --git a/deps/v8/test/mjsunit/wasm/lazy-compilation.js b/deps/v8/test/mjsunit/wasm/lazy-compilation.js index c7cd40d05d..c45fb6deb0 100644 --- a/deps/v8/test/mjsunit/wasm/lazy-compilation.js +++ b/deps/v8/test/mjsunit/wasm/lazy-compilation.js @@ -24,7 +24,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addFunction('store', kSig_v_i) .addBody([ kExprI32Const, 0, // i32.const 1 - kExprGetLocal, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 kExprI32StoreMem, 0, 0, // i32.store offset=0 align=0 ]) .exportFunc(); @@ -35,7 +35,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder2.addMemory(1, 1, true); builder2.addImport('mod', 'store', kSig_v_i); builder2.addFunction('call_store', kSig_v_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); const instance2 = builder2.instantiate({mod: {store: instance1.exports.store}}); const mem2 = new Int32Array(instance2.exports.memory.buffer); @@ -75,7 +75,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); builder1.addFunction('store', kSig_v_i) .addBody([ kExprI32Const, 0, // i32.const 1 - kExprGetLocal, 0, // get_local 0 + kExprLocalGet, 0, // get_local 0 kExprI32StoreMem, 0, 0, // i32.store offset=0 align=0 ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js b/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js index 3ce74816ea..eadfaacca4 100644 --- a/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js +++ b/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js @@ -13,13 +13,13 @@ function testCompileLoadStore() { const builder = new WasmModuleBuilder(); // These functions generate statically out of bounds accesses. builder.addFunction("load", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0x80, 0x80, 0x80, 1]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0x80, 0x80, 0x80, 1]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32StoreMem, 0, 0x80, 0x80, 0x80, 1, - kExprGetLocal, 1]) + kExprLocalGet, 1]) .exportFunc(); builder.addMemory(1, 1, false); const instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/liftoff.js b/deps/v8/test/mjsunit/wasm/liftoff.js index 51b30878d3..04eeffbea2 100644 --- a/deps/v8/test/mjsunit/wasm/liftoff.js +++ b/deps/v8/test/mjsunit/wasm/liftoff.js @@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('i32_add', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); const module = new WebAssembly.Module(builder.toBuffer()); @@ -26,7 +26,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('i32_add', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); const instance = builder.instantiate(); @@ -38,7 +38,7 @@ async function testLiftoffAsync() { print(arguments.callee.name); const builder = new WasmModuleBuilder(); builder.addFunction('i32_add', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); print('Compiling...'); diff --git a/deps/v8/test/mjsunit/wasm/loop-rotation.js b/deps/v8/test/mjsunit/wasm/loop-rotation.js index 92ad1f31c7..7805f5ccf5 100644 --- a/deps/v8/test/mjsunit/wasm/loop-rotation.js +++ b/deps/v8/test/mjsunit/wasm/loop-rotation.js @@ -12,10 +12,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_v_i) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprBrIf, 0, kExprEnd, ]) @@ -33,10 +33,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_v_i) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprBrIf, 1, kExprBr, 0, kExprEnd, @@ -56,10 +56,10 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_v_i) .addBody([ kExprLoop, kWasmStmt, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprTeeLocal, 0, + kExprLocalTee, 0, kExprBrIf, 1, kExprI32Const, 0, kExprI32Const, 0, diff --git a/deps/v8/test/mjsunit/wasm/many-modules.js b/deps/v8/test/mjsunit/wasm/many-modules.js new file mode 100644 index 0000000000..66db04237a --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/many-modules.js @@ -0,0 +1,45 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// No reason to stress-opt this; save some time. +// Flags: --wasm-far-jump-table --no-stress-opt + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// We generate the module bytes once to make this test more efficient, +// especially on simulator builds. The bytes contain a sentinel which is later +// patched to different constants. This makes the modules distinct and forces +// the engine to create different code for them. + +// This is the sentinel placed in the bytes. It's a 5 byte LEB-encoded integer. +const sentinel = wasmSignedLeb(0x12345678); +assertEquals(5, sentinel.length); + +const builder = new WasmModuleBuilder(); +builder.addFunction('f', kSig_i_i).addBody([kExprI32Const, ...sentinel]); +const module_bytes = builder.toBuffer(); + +// Checks whether {module_bytes[i .. i+sentinel.length]} matches {sentinel}. +const has_sentinel = (i, k = 0) => module_bytes[i + k] == sentinel[k] && + (k == sentinel.length - 1 || has_sentinel(i, k + 1)); +// Now find the sentinel. +const find_sentinel = i => + module_bytes.slice(i).findIndex((e, i) => has_sentinel(i)); +const sentinel_position = find_sentinel(0); +assertTrue(has_sentinel(sentinel_position), 'found sentinel'); +assertEquals(-1, find_sentinel(sentinel_position + 1), 'exactly one sentinel'); + +// Generating {num_modules} modules should not run out of memory, since the code +// space needed per module is quite low. +const num_modules = 10000; +// Keep all generated modules alive. +const modules = []; +// Reset sentinel section to nops so that shorter LEBs will just be followed by +// nops. This resion will be patched in the loop with values of increasing size. +module_bytes.set(Array(sentinel.length).fill(_ => kExprNop), sentinel_position); +for (let i = 0; i < num_modules; ++i) { + if (i % 50 == 0) print(i); + module_bytes.set(wasmSignedLeb(i), sentinel_position); + modules.push(new WebAssembly.Module(module_bytes)); +} diff --git a/deps/v8/test/mjsunit/wasm/many-parameters.js b/deps/v8/test/mjsunit/wasm/many-parameters.js index 46b231943d..7813ad453c 100644 --- a/deps/v8/test/mjsunit/wasm/many-parameters.js +++ b/deps/v8/test/mjsunit/wasm/many-parameters.js @@ -37,7 +37,7 @@ types.forEach((type, type_idx) => { let body = []; for (let i = 0; i < num_params; ++i) - body.push(kExprGetLocal, (i + shift) % num_params); + body.push(kExprLocalGet, (i + shift) % num_params); for (let i = 0; i < num_const_params; ++i) body.push(...type_const[type_idx](num_params + i)); body.push(kExprCallFunction, 0); diff --git a/deps/v8/test/mjsunit/wasm/memory-external-call.js b/deps/v8/test/mjsunit/wasm/memory-external-call.js index 853cdf616a..1bb4bb1ecc 100644 --- a/deps/v8/test/mjsunit/wasm/memory-external-call.js +++ b/deps/v8/test/mjsunit/wasm/memory-external-call.js @@ -25,12 +25,12 @@ function generateBuilder(add_memory, import_sig) { // Add the memory if we expect a module builder with memory and load/store. builder.addMemory(initialMemoryPages, maximumMemoryPages, true); builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction('store', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1 + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, + kExprLocalGet, 1 ]) .exportFunc(); } @@ -83,14 +83,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { builder.addMemory(kPages, kPages, true); builder.addFunction("store", kSig_v_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32StoreMem, 0, 0, // -- ]) // -- .exportFunc(); builder.addFunction("load", kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32LoadMem, 0, 0, // -- ]) // -- .exportFunc(); @@ -103,14 +103,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { builder.addMemory(kPages, kPages, true); builder.addFunction("store", kSig_v_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- ]) // -- .exportFunc(); builder.addFunction("load", kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32LoadMem, 0, 0, // -- ]) // -- .exportFunc(); @@ -152,7 +152,7 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { // Function to invoke the imported function and add 1 to the result. first_module.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, other_fn_idx, // call the imported function kExprI32Const, 1, // - kExprI32Add, // add 1 to the result @@ -185,7 +185,7 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { // Function to invoke the imported function and add 1 to the result. first_module.addFunction('plus_one', kSig_i_i) .addBody([ - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprCallFunction, other_fn_idx, // call the imported function kExprI32Const, 1, // - kExprI32Add, // add 1 to the result @@ -221,14 +221,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { // Function to invoke the imported function and add 1 to the result. first_module.addFunction('sandwich', kSig_i_iii) .addBody([ - kExprGetLocal, 0, // param0 (index) - kExprGetLocal, 1, // param1 (first_value) + kExprLocalGet, 0, // param0 (index) + kExprLocalGet, 1, // param1 (first_value) kExprI32StoreMem, 0, 0, // store value in first_instance - kExprGetLocal, 0, // param0 (index) - kExprGetLocal, 2, // param2 (second_value) + kExprLocalGet, 0, // param0 (index) + kExprLocalGet, 2, // param2 (second_value) kExprCallFunction, other_fn_idx, // call the imported function kExprDrop, // drop the return value - kExprGetLocal, 0, // param0 (index) + kExprLocalGet, 0, // param0 (index) kExprI32LoadMem, 0, 0, // load from first_instance kExprReturn // - ]) @@ -263,14 +263,14 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { builder.addMemory(kPages, kPages, true); builder.addFunction("store", kSig_v_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32StoreMem, 0, 0, // -- ]) // -- .exportFunc(); builder.addFunction("load", kSig_i_i) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32LoadMem, 0, 0, // -- ]) // -- .exportFunc(); @@ -308,9 +308,9 @@ function assertMemoryIndependence(load_a, store_a, load_b, store_b) { var sig_index = builder.addType(kSig_v_ii); builder.addFunction("store", kSig_v_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero, ]).exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/memory-instance-validation.js b/deps/v8/test/mjsunit/wasm/memory-instance-validation.js index ef65840532..a19b94b132 100644 --- a/deps/v8/test/mjsunit/wasm/memory-instance-validation.js +++ b/deps/v8/test/mjsunit/wasm/memory-instance-validation.js @@ -17,7 +17,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([kExprMemorySize, kMemoryZero]) .exportFunc(); builder.addFunction("grow", kSig_i_i) - .addBody([kExprGetLocal, 0, kExprMemoryGrow, kMemoryZero]) + .addBody([kExprLocalGet, 0, kExprMemoryGrow, kMemoryZero]) .exportFunc(); var instances = []; for (var i = 0; i < 5; i++) { diff --git a/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js index f2b22d97ab..a365b419f9 100644 --- a/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js +++ b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js @@ -40,14 +40,14 @@ const indexes = (() => { 0|((offset >>> 28) & m)]; builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js index 6baf0f3c7e..d5be98aa18 100644 --- a/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js +++ b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js @@ -40,14 +40,14 @@ const indexes = (() => { 0|((offset >>> 28) & m)]; builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js index 39b9f95d9c..e9533b8d6c 100644 --- a/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js +++ b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js @@ -38,14 +38,14 @@ const indexes = (() => { 0|((offset >>> 28) & m)]; builder.addFunction("load", makeSig([kWasmI32], [type])) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- load_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); builder.addFunction("store", makeSig([kWasmI32, type], [])) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- store_opcode, 0, ...offset_bytes, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/module-memory.js b/deps/v8/test/mjsunit/wasm/module-memory.js index 3dd580d269..0f870e7815 100644 --- a/deps/v8/test/mjsunit/wasm/module-memory.js +++ b/deps/v8/test/mjsunit/wasm/module-memory.js @@ -18,18 +18,18 @@ function genModule(memory) { // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; // TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc /**/ kExprLoop, kWasmStmt, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprIf, kWasmStmt, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprI32LoadMem, 0, 0, // -- /* */ kExprIf, kWasmStmt, // -- /* */ kExprI32Const, 127, // -- /* */ kExprReturn, // -- /* */ kExprEnd, // -- - /* */ kExprGetLocal, 0, // -- + /* */ kExprLocalGet, 0, // -- /* */ kExprI32Const, 4, // -- /* */ kExprI32Sub, // -- - /* */ kExprSetLocal, 0, // -- + /* */ kExprLocalSet, 0, // -- /* */ kExprBr, 1, // -- /* */ kExprEnd, // -- /* */ kExprEnd, // -- @@ -52,9 +52,7 @@ function testPokeMemory() { var array = new Int8Array(buffer); assertEquals(kMemSize, array.length); - for (var i = 0; i < kMemSize; i++) { - assertEquals(0, array[i]); - } + assertTrue(array.every((e => e === 0))); for (var i = 0; i < 10; i++) { assertEquals(0, main(kMemSize - 4)); @@ -99,9 +97,7 @@ function testPokeOuterMemory() { var array = new Int8Array(buffer.buffer); assertEquals(kMemSize, array.length); - for (var i = 0; i < kMemSize; i++) { - assertEquals(0, array[i]); - } + assertTrue(array.every((e => e === 0))); for (var i = 0; i < 10; i++) { assertEquals(0, main(kMemSize - 4)); @@ -139,33 +135,30 @@ function testOOBThrows() { builder.addMemory(1, 1, true); builder.addFunction("geti", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32LoadMem, 0, 0, kExprI32StoreMem, 0, 0, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprI32LoadMem, 0, 0, ]) .exportFunc(); var module = builder.instantiate(); - var offset; - function read() { return module.exports.geti(0, offset); } - function write() { return module.exports.geti(offset, 0); } + let read = offset => module.exports.geti(0, offset); + let write = offset => module.exports.geti(offset, 0); - for (offset = 0; offset < 65533; offset++) { - assertEquals(0, read()); - assertEquals(0, write()); - } + assertEquals(0, read(65532)); + assertEquals(0, write(65532)); // Note that this test might be run concurrently in multiple Isolates, which // makes an exact comparison of the expected trap count unreliable. But is is // still possible to check the lower bound for the expected trap count. - for (offset = 65534; offset < 66536; offset++) { + for (let offset = 65534; offset < 66536; offset++) { const trap_count = %GetWasmRecoveredTrapCount(); - assertTraps(kTrapMemOutOfBounds, read); - assertTraps(kTrapMemOutOfBounds, write); + assertTraps(kTrapMemOutOfBounds, () => read(offset)); + assertTraps(kTrapMemOutOfBounds, () => write(offset)); if (%IsWasmTrapHandlerEnabled()) { assertTrue(trap_count + 2 <= %GetWasmRecoveredTrapCount()); } diff --git a/deps/v8/test/mjsunit/wasm/multi-value.js b/deps/v8/test/mjsunit/wasm/multi-value.js index 31f9e8149b..e6a7ae99a5 100644 --- a/deps/v8/test/mjsunit/wasm/multi-value.js +++ b/deps/v8/test/mjsunit/wasm/multi-value.js @@ -15,8 +15,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ kExprBlock, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprEnd, kExprI32Add]) .exportAs("main"); @@ -33,8 +33,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprBlock, sig_i_ii, kExprI32Add, kExprEnd]) @@ -54,8 +54,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ kExprBlock, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprBr, 0, kExprEnd, kExprI32Add]) @@ -76,8 +76,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ kExprLoop, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprEnd, kExprI32Add]) .exportAs("main"); @@ -94,8 +94,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprLoop, sig_i_ii, kExprI32Add, kExprEnd]) @@ -114,13 +114,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let sig_ii_ii = builder.addType(kSig_ii_ii); builder.addFunction("dup", kSig_ii_i) - .addBody([kExprGetLocal, 0, kExprGetLocal, 0]); + .addBody([kExprLocalGet, 0, kExprLocalGet, 0]); builder.addFunction("swap", kSig_ii_ii) - .addBody([kExprGetLocal, 1, kExprGetLocal, 0]); + .addBody([kExprLocalGet, 1, kExprLocalGet, 0]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprLoop, sig_ii_ii, kExprCallFunction, 1, // swap kExprCallFunction, 0, // dup @@ -164,13 +164,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 1, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, kExprEnd, kExprI32Sub]) .exportAs("main"); @@ -188,9 +188,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, kExprIf, sig_i_ii, kExprI32Add, kExprElse, @@ -212,14 +212,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, sig_ii_v, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprBr, 0, kExprElse, - kExprGetLocal, 1, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, kExprBr, 0, kExprEnd, kExprI32Sub]) @@ -231,6 +231,27 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertEquals(instance.exports.main(0, 3), 3); })(); +(function MultiIfParamOneArmedTest() { + print("MultiIfParamOneArmedTest"); + let builder = new WasmModuleBuilder(); + let sig_i_i = builder.addType(kSig_i_i); + + builder.addFunction("main", kSig_i_i) + .addBody([ + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprIf, sig_i_i, + kExprI32Const, 5, + kExprI32Add, + kExprEnd]) + .exportAs("main"); + + let module = new WebAssembly.Module(builder.toBuffer()); + let instance = new WebAssembly.Instance(module); + assertEquals(instance.exports.main(0), 0); + assertEquals(instance.exports.main(1), 6); +})(); + (function MultiResultTest() { print("MultiResultTest"); let builder = new WasmModuleBuilder(); @@ -239,15 +260,15 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("callee", kSig_iii_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Sub]); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprCallFunction, 0, kExprI32Mul, kExprI32Add]) @@ -272,14 +293,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("callee", kSig_ii_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Add, kExprReturn]); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0, kExprI32Mul]) .exportAs("main"); @@ -300,14 +321,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("callee", kSig_ii_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Add, kExprBr, 0]); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0, kExprI32Mul]) .exportAs("main"); @@ -320,26 +341,26 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertEquals(instance.exports.main(10), 200); })(); -(function MultiJSReturnTest() { +(function MultiWasmToJSReturnTest() { print(arguments.callee.name); let builder = new WasmModuleBuilder(); let sig_fi_if = makeSig([kWasmI32, kWasmF32], [kWasmF32, kWasmI32]); builder.addFunction("swap", sig_fi_if) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 0]) + kExprLocalGet, 1, + kExprLocalGet, 0]) .exportAs("swap"); builder.addFunction("addsubmul", kSig_iii_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Add, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Sub, - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Mul]) .exportAs("addsubmul"); @@ -350,3 +371,75 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertEquals(instance.exports.addsubmul(4), [8, 0, 16]); assertEquals(instance.exports.addsubmul(5), [10, 0, 25]); })(); + +(function MultiJSToWasmReturnTest() { + print(arguments.callee.name); + let builder = new WasmModuleBuilder(); + function swap(x, y) { return [y, x]; } + function swap_proxy(x, y) { + return new Proxy([y, x], { + get: function(obj, prop) { return Reflect.get(obj, prop); }, + }); + } + function proxy_throw(x, y) { + return new Proxy([y, x], { + get: function(obj, prop) { + if (prop == 1) { + throw new Error("abc"); + } + return Reflect.get(obj, prop); }, + }); + } + function drop_first(x, y) { + return [y]; + } + function repeat(x, y) { + return [x, y, x, y]; + } + function not_receiver(x, y) { + return 0; + } + function not_iterable(x, y) { + a = [x, y]; + a[Symbol.iterator] = undefined; + return a; + } + function* generator(x, y) { + yield x; + yield y; + } + function* generator_throw(x, y) { + yield x; + throw new Error("def"); + } + + builder.addImport('imports', 'f', kSig_ii_ii); + builder.addFunction("main", kSig_ii_ii) + .addBody([ + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprCallFunction, 0]) + .exportAs("main") + + let module = new WebAssembly.Module(builder.toBuffer()); + + var instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : swap } }); + assertEquals(instance.exports.main(1, 2), [2, 1]); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : swap_proxy } }); + assertEquals(instance.exports.main(1, 2), [2, 1]); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : generator } }); + assertEquals(instance.exports.main(1, 2), [1, 2]); + + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : drop_first } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, "multi-return length mismatch"); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : repeat } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, "multi-return length mismatch"); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : proxy_throw } }); + assertThrows(() => instance.exports.main(1, 2), Error, "abc"); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : not_receiver } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, /not iterable/); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : not_iterable } }); + assertThrows(() => instance.exports.main(1, 2), TypeError, /not iterable/); + instance = new WebAssembly.Instance(module, { 'imports' : { 'f' : generator_throw } }); + assertThrows(() => instance.exports.main(1, 2), Error, "def"); +})(); diff --git a/deps/v8/test/mjsunit/wasm/multiple-code-spaces.js b/deps/v8/test/mjsunit/wasm/multiple-code-spaces.js new file mode 100644 index 0000000000..f180cf6234 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/multiple-code-spaces.js @@ -0,0 +1,54 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --randomize-all-allocations +// Flags: --wasm-far-jump-table --wasm-max-initial-code-space-reservation=1 + +load('test/mjsunit/wasm/wasm-module-builder.js'); + +// Instantiate bigger modules, until at least four separate code spaces have +// been allocated. +// Each function calls through many of the previous functions to execute the +// jump table(s) sufficiently. + +let num_functions = 50; +while (true) { + print(`Trying ${num_functions} functions...`); + if (num_functions > 1e6) { + throw new Error('We should have hit four code spaces by now'); + } + const builder = new WasmModuleBuilder(); + builder.addMemory(1, 1, false); + builder.addFunction('f0', kSig_i_i).addBody([kExprLocalGet, 0]); + // Generate some code per function to fill the code space. + // Each function contains a number of loads that will not be executed + // (inside an "if (i == 0)" block). They increase the code size a bit so we + // do not need too many functions. + // Each function f<n> with argument {i} then calls f<n/10> with argument + // {i + 1} and returns whatever that function returns. + const body_template = [ + kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, // if (i == 0) + kExprLocalGet, 0 // get i + ]; + for (let i = 0; i < 1000; ++i) body_template.push(kExprI32LoadMem, 0, 0); + body_template.push( + kExprDrop, kExprEnd, // end if + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add, // i + 1 + kExprCallFunction // call f<?> + ); + for (let i = 1; i < num_functions; ++i) { + const body = body_template.slice(); + body.push(...wasmSignedLeb(Math.floor(i / 10))); + builder.addFunction('f' + i, kSig_i_i).addBody(body); + } + builder.addExport('f', num_functions - 1); + const instance = builder.instantiate(); + let expected = 17; + for (let i = num_functions - 1; i > 0; i = Math.floor(i / 10)) ++expected; + assertEquals(expected, instance.exports.f(17)); + const num_code_spaces = %WasmNumCodeSpaces(instance); + print(`--> ${num_code_spaces} code spaces.`); + if (num_code_spaces >= 4) break; + num_functions *= 2; +} diff --git a/deps/v8/test/mjsunit/wasm/origin-trial-flags.js b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js index b9ce6f7f94..eae8ceb58c 100644 --- a/deps/v8/test/mjsunit/wasm/origin-trial-flags.js +++ b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js @@ -13,7 +13,7 @@ function instantiateModuleWithThreads() { builder.addMemory(2, 10, false, shared); builder.addFunction('main', kSig_i_ii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kAtomicPrefix, kExprI32AtomicAdd, 2, + kExprLocalGet, 0, kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicAdd, 2, 0 ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/parallel_compilation.js b/deps/v8/test/mjsunit/wasm/parallel_compilation.js index 6eca124bc4..7a1da58e8f 100644 --- a/deps/v8/test/mjsunit/wasm/parallel_compilation.js +++ b/deps/v8/test/mjsunit/wasm/parallel_compilation.js @@ -50,7 +50,7 @@ function assertFunction(module, func) { for (i = 0; i < 1000; i++) { builder.addFunction("sub" + i, kSig_i_i) .addBody([ // -- - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprI32Const, i % 61, // -- kExprI32Sub]) // -- .exportFunc() @@ -74,8 +74,8 @@ function assertFunction(module, func) { f[0] = builder.addFunction("add0", kSig_i_ii) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add, // -- ]) .exportFunc() @@ -84,8 +84,8 @@ function assertFunction(module, func) { for (i = 1; i < 256; i++) { f[i] = builder.addFunction("add" + i, kSig_i_ii) .addBody([ // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, f[i >>> 1].index]) // -- .exportFunc() } diff --git a/deps/v8/test/mjsunit/wasm/params.js b/deps/v8/test/mjsunit/wasm/params.js index 33858429c4..eed893fd57 100644 --- a/deps/v8/test/mjsunit/wasm/params.js +++ b/deps/v8/test/mjsunit/wasm/params.js @@ -17,7 +17,7 @@ function testSelect2(type) { var builder = new WasmModuleBuilder(); builder.addFunction("select", makeSig_r_xx(type, type)) - .addBody([kExprGetLocal, which]) + .addBody([kExprLocalGet, which]) .exportFunc() var select = builder.instantiate().exports.select; @@ -79,7 +79,7 @@ function testSelect10(t) { var builder = new WasmModuleBuilder(); builder.addFunction("select", makeSig([t,t,t,t,t,t,t,t,t,t], [t])) - .addBody([kExprGetLocal, which]) + .addBody([kExprLocalGet, which]) .exportFunc(); var select = builder.instantiate().exports.select; diff --git a/deps/v8/test/mjsunit/wasm/receiver.js b/deps/v8/test/mjsunit/wasm/receiver.js index 10e8855927..de8954ff98 100644 --- a/deps/v8/test/mjsunit/wasm/receiver.js +++ b/deps/v8/test/mjsunit/wasm/receiver.js @@ -13,8 +13,8 @@ function testCallImport(func, expected, a, b) { builder.addImport("mod", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0]) // -- .exportAs("main"); diff --git a/deps/v8/test/mjsunit/wasm/return-calls.js b/deps/v8/test/mjsunit/wasm/return-calls.js index 22d2860df1..7dd56ef02f 100644 --- a/deps/v8/test/mjsunit/wasm/return-calls.js +++ b/deps/v8/test/mjsunit/wasm/return-calls.js @@ -18,15 +18,15 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); // f_aux(N,X) => f_aux(N-1,X*N) let fact_aux = builder.addFunction("fact_aux",kSig_i_ii); fact_aux.addBody([ - kExprGetLocal, 0, kExprI32Const, 1, kExprI32LeS, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32LeS, kExprIf, kWasmI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul, kExprReturnCall, fact_aux.index, kExprEnd @@ -35,7 +35,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); //main(N)=>fact_aux(N,1) let main = builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprReturnCall,0 ]).exportFunc(); @@ -63,18 +63,18 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let f_ind = builder.addFunction("f_ind",kSig_i_iii). addBody([ - kExprGetLocal, 0, kExprI32Const, 1, kExprI32LeS, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32LeS, kExprIf, kWasmI32, - kExprGetLocal, 1, + kExprLocalGet, 1, kExprElse, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Mul, - kExprGetLocal, 2, - kExprGetLocal, 2, + kExprLocalGet, 2, + kExprLocalGet, 2, kExprReturnCallIndirect, sig_i_iii, kTableZero, kExprEnd ]); @@ -82,7 +82,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); //main(N)=>fact_aux(N,1) let main = builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Const, f_ind.index, kExprReturnCall, f_ind.index @@ -109,9 +109,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let main = builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprReturnCall, pick ]) .exportFunc(); @@ -141,9 +141,9 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); let main = builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 1, - kExprGetLocal, 2, - kExprGetLocal, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, + kExprLocalGet, 0, kExprI32Const, tableIndex, kExprReturnCallIndirect, sig_i_iii, kTableZero ]) diff --git a/deps/v8/test/mjsunit/wasm/shared-arraybuffer-worker-simple-gc.js b/deps/v8/test/mjsunit/wasm/shared-arraybuffer-worker-simple-gc.js new file mode 100644 index 0000000000..a32e6f4d15 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/shared-arraybuffer-worker-simple-gc.js @@ -0,0 +1,84 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-gc + +const kNumIterations = 10; + +function NewWorker() { + let script = +`onmessage = (msg) => { + if (msg.memory) postMessage("ack"); + if (msg.quit) postMessage("bye"); + gc(); +}`; + return new Worker(script, {type: 'string'}); +} + +function PingWorker(worker, memory) { + worker.postMessage({memory: memory}); + assertEquals("ack", worker.getMessage()); + worker.postMessage({quit: true}); + assertEquals("bye", worker.getMessage()); +} + +function AllocMemory() { + return new SharedArrayBuffer(1024); +} + +function RunSingleWorkerSingleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerTwoMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(), second = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, second); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + gc(); + } + worker.terminate(); +} + +function RunMultipleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + let worker = NewWorker(); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + worker.terminate(); + gc(); + } +} + +RunSingleWorkerSingleMemoryTest(); +RunSingleWorkerTwoMemoryTest(); +RunSingleWorkerMultipleMemoryTest(); +RunMultipleWorkerMultipleMemoryTest(); diff --git a/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js b/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js index 8721d8d066..1dbbcb9ff6 100644 --- a/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js +++ b/deps/v8/test/mjsunit/wasm/shared-memory-gc-stress.js @@ -10,11 +10,11 @@ function AllocMemory(pages, max = pages) { } function RunSomeAllocs(total, retained, pages, max = pages) { - print(`-------iterations = ${total}, retained = $ { retained } -------`); + print(`-------iterations = ${total}, retained = ${retained} -------`); var array = new Array(retained); for (var i = 0; i < total; i++) { if ((i % 25) == 0) - print(`iteration $ { i }`); + print(`iteration ${i}`); let pair = AllocMemory(pages, max); // For some iterations, retain the memory, view, or both. switch (i % 3) { diff --git a/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js b/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js index 376917b6ee..6afc6115f8 100644 --- a/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js +++ b/deps/v8/test/mjsunit/wasm/shared-memory-worker-gc.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --experimental-wasm-threads +// Flags: --experimental-wasm-threads --expose-gc -const kNumMessages = 5000; +const kNumMessages = 1000; function AllocMemory(pages = 1, max = pages) { return new WebAssembly.Memory({initial : pages, maximum : max, shared : true}); @@ -15,6 +15,7 @@ function AllocMemory(pages = 1, max = pages) { `onmessage = function(msg) { if (msg.memory) postMessage({memory : msg.memory}); + gc(); }`, {type : 'string'}); let time = performance.now(); @@ -30,5 +31,6 @@ function AllocMemory(pages = 1, max = pages) { if (msg.memory) { assertInstanceof(msg.memory, WebAssembly.Memory); } + gc(); } })(); diff --git a/deps/v8/test/mjsunit/wasm/shared-memory-worker-simple-gc.js b/deps/v8/test/mjsunit/wasm/shared-memory-worker-simple-gc.js new file mode 100644 index 0000000000..53229861cc --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/shared-memory-worker-simple-gc.js @@ -0,0 +1,85 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-threads --expose-gc + +const kNumIterations = 10; + +function NewWorker() { + let script = +`onmessage = (msg) => { + if (msg.memory) postMessage("ack"); + if (msg.quit) postMessage("bye"); + gc(); +}`; + return new Worker(script, {type: 'string'}); +} + +function PingWorker(worker, memory) { + worker.postMessage({memory: memory}); + assertEquals("ack", worker.getMessage()); + worker.postMessage({quit: true}); + assertEquals("bye", worker.getMessage()); +} + +function AllocMemory() { + let pages = 1, max = 1; + return new WebAssembly.Memory({initial : pages, maximum : max, shared : true}); +} + +function RunSingleWorkerSingleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerTwoMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(), second = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, second); + gc(); + } + worker.terminate(); +} + +function RunSingleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let worker = NewWorker(); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + gc(); + } + worker.terminate(); +} + +function RunMultipleWorkerMultipleMemoryTest() { + print(arguments.callee.name); + let first = AllocMemory(); + for (let i = 0; i < kNumIterations; i++) { + print(`iteration ${i}`); + let worker = NewWorker(); + PingWorker(worker, first); + PingWorker(worker, AllocMemory()); + worker.terminate(); + gc(); + } +} + +RunSingleWorkerSingleMemoryTest(); +RunSingleWorkerTwoMemoryTest(); +RunSingleWorkerMultipleMemoryTest(); +RunMultipleWorkerMultipleMemoryTest(); diff --git a/deps/v8/test/mjsunit/wasm/shared-memory.js b/deps/v8/test/mjsunit/wasm/shared-memory.js index 80e894b28f..696b0412ae 100644 --- a/deps/v8/test/mjsunit/wasm/shared-memory.js +++ b/deps/v8/test/mjsunit/wasm/shared-memory.js @@ -73,8 +73,8 @@ function assertMemoryIsValid(memory, shared) { let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicAdd]); builder.addImportedMemory("m", "imported_mem"); @@ -119,8 +119,8 @@ function assertMemoryIsValid(memory, shared) { builder.addMemory(2, 10, false, "shared"); builder.addFunction("main", kSig_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kAtomicPrefix, kExprI32AtomicAdd, 2, 0]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/stackwalk.js b/deps/v8/test/mjsunit/wasm/stackwalk.js index 91951ff4c3..e1cd6522ec 100644 --- a/deps/v8/test/mjsunit/wasm/stackwalk.js +++ b/deps/v8/test/mjsunit/wasm/stackwalk.js @@ -13,8 +13,8 @@ function makeFFI(func) { builder.addImport("mom", "func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0, // -- ]) .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/start-function.js b/deps/v8/test/mjsunit/wasm/start-function.js index e17c8f1785..bda9d085c5 100644 --- a/deps/v8/test/mjsunit/wasm/start-function.js +++ b/deps/v8/test/mjsunit/wasm/start-function.js @@ -29,9 +29,9 @@ function assertVerifies(sig, body) { assertVerifies(kSig_v_v, [kExprNop]); // Arguments aren't allowed to start functions. -assertThrows(() => {instantiate(kSig_i_i, [kExprGetLocal, 0]);}); -assertThrows(() => {instantiate(kSig_i_ii, [kExprGetLocal, 0]);}); -assertThrows(() => {instantiate(kSig_i_dd, [kExprGetLocal, 0]);}); +assertThrows(() => {instantiate(kSig_i_i, [kExprLocalGet, 0]);}); +assertThrows(() => {instantiate(kSig_i_ii, [kExprLocalGet, 0]);}); +assertThrows(() => {instantiate(kSig_i_dd, [kExprLocalGet, 0]);}); assertThrows(() => {instantiate(kSig_i_v, [kExprI32Const, 0]);}); (function testInvalidIndex() { diff --git a/deps/v8/test/mjsunit/wasm/streaming-api.js b/deps/v8/test/mjsunit/wasm/streaming-api.js index 3decc1a70c..01e6637b4d 100644 --- a/deps/v8/test/mjsunit/wasm/streaming-api.js +++ b/deps/v8/test/mjsunit/wasm/streaming-api.js @@ -10,7 +10,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportAs("main"); let bytes = builder.toBuffer(); assertPromiseResult(WebAssembly.compileStreaming(Promise.resolve(bytes)).then( @@ -22,7 +22,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportAs("main"); let bytes = builder.toBuffer(); assertPromiseResult(WebAssembly.instantiateStreaming(Promise.resolve(bytes)).then( @@ -47,8 +47,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction("main", kSig_i_i) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 0, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 0, kExprF32Mul]) .exportAs("main"); let bytes = builder.toBuffer(); diff --git a/deps/v8/test/mjsunit/wasm/streaming-error-position.js b/deps/v8/test/mjsunit/wasm/streaming-error-position.js index b6d008cd13..77c1b46e85 100644 --- a/deps/v8/test/mjsunit/wasm/streaming-error-position.js +++ b/deps/v8/test/mjsunit/wasm/streaming-error-position.js @@ -303,11 +303,11 @@ function testErrorPosition(bytes, pos, test_name) { 1, // functions count 4, // body size 0, // locals count - kExprGetLocal, 0, // Access a non-existing local + kExprLocalGet, 0, // Access a non-existing local kExprEnd // -- ]); - // Find error at the index of kExprGetLocal. + // Find error at the index of kExprLocalGet. let pos = bytes.length - 1 - 1; testErrorPosition(bytes, pos, 'testInvalidCode'); })(); @@ -334,7 +334,7 @@ function testErrorPosition(bytes, pos, test_name) { 0, // section length (too big) ]); - // Find error at the index of kExprGetLocal. + // Find error at the index of kExprLocalGet. let pos = bytes.length - 1; testErrorPosition(bytes, pos, 'testCodeSectionSizeZero'); })(); diff --git a/deps/v8/test/mjsunit/wasm/table-access.js b/deps/v8/test/mjsunit/wasm/table-access.js index b91934d949..3e718cf06c 100644 --- a/deps/v8/test/mjsunit/wasm/table-access.js +++ b/deps/v8/test/mjsunit/wasm/table-access.js @@ -11,14 +11,14 @@ function addTableWithAccessors(builder, type, size, name) { const table = builder.addTable(type, size); const set_sig = makeSig([kWasmI32, type], []); builder.addFunction('set_' + name, set_sig) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kExprTableSet, table.index]) .exportFunc(); const get_sig = makeSig([kWasmI32], [type]); builder.addFunction('get_' + name, get_sig) - .addBody([kExprGetLocal, 0, kExprTableGet, table.index]) + .addBody([kExprLocalGet, 0, kExprTableGet, table.index]) .exportFunc(); } @@ -109,10 +109,10 @@ const dummy_func = exports.set_table_func1; const f2 = builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, value2]); const f3 = builder.addFunction('f', kSig_i_v).addBody([kExprI32Const, value3]); builder.addFunction('get_t1', kSig_a_i) - .addBody([kExprGetLocal, 0, kExprTableGet, t1]) + .addBody([kExprLocalGet, 0, kExprTableGet, t1]) .exportFunc(); builder.addFunction('get_t2', kSig_a_i) - .addBody([kExprGetLocal, 0, kExprTableGet, t2]) + .addBody([kExprLocalGet, 0, kExprTableGet, t2]) .exportFunc(); const offset1 = 3; diff --git a/deps/v8/test/mjsunit/wasm/table-copy-anyref.js b/deps/v8/test/mjsunit/wasm/table-copy-anyref.js index d5cddb3ed6..8b2546a594 100644 --- a/deps/v8/test/mjsunit/wasm/table-copy-anyref.js +++ b/deps/v8/test/mjsunit/wasm/table-copy-anyref.js @@ -17,7 +17,7 @@ builder.addTable(kWasmAnyFunc, 1000); builder.addFunction('copy', kSig_v_iii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kNumericPrefix, + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kNumericPrefix, kExprTableCopy, kTableZero, kTableZero ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/table-copy.js b/deps/v8/test/mjsunit/wasm/table-copy.js index db0dc83191..ead06f4f23 100644 --- a/deps/v8/test/mjsunit/wasm/table-copy.js +++ b/deps/v8/test/mjsunit/wasm/table-copy.js @@ -38,7 +38,7 @@ function assertCall(call, ...elems) { for (let i = 0; i < kTableSize; i++) { let f = builder.addFunction("", kSig_i_v) .addBody([ - kExprGetGlobal, g, + kExprGlobalGet, g, ...wasmI32Const(i), kExprI32Add ]); @@ -47,15 +47,15 @@ function assertCall(call, ...elems) { builder.addFunction("copy", sig_v_iii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, - kExprGetLocal, 2, + kExprLocalGet, 0, + kExprLocalGet, 1, + kExprLocalGet, 2, kNumericPrefix, kExprTableCopy, kTableZero, kTableZero]) .exportAs("copy"); builder.addFunction("call", sig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_i_v, kTableZero]) .exportAs("call"); diff --git a/deps/v8/test/mjsunit/wasm/table-fill.js b/deps/v8/test/mjsunit/wasm/table-fill.js index ed5938f908..64c4d7732d 100644 --- a/deps/v8/test/mjsunit/wasm/table-fill.js +++ b/deps/v8/test/mjsunit/wasm/table-fill.js @@ -32,13 +32,13 @@ const internal_func = builder.addTable(kWasmAnyFunc, size, maximum).index; for (index of [import_ref, internal_ref]) { builder.addFunction(`fill${index}`, kSig_v_iri) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kNumericPrefix, + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kNumericPrefix, kExprTableFill, index ]) .exportFunc(); builder.addFunction(`get${index}`, kSig_r_i) - .addBody([kExprGetLocal, 0, kExprTableGet, index]) + .addBody([kExprLocalGet, 0, kExprTableGet, index]) .exportFunc(); } @@ -47,13 +47,13 @@ const sig_index = builder.addType(kSig_i_v); for (index of [import_func, internal_func]) { builder.addFunction(`fill${index}`, kSig_v_iai) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kNumericPrefix, + kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kNumericPrefix, kExprTableFill, index ]) .exportFunc(); builder.addFunction(`call${index}`, kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig_index, index]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig_index, index]) .exportFunc(); } diff --git a/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js b/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js index 5b37af32c2..8018407348 100644 --- a/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js +++ b/deps/v8/test/mjsunit/wasm/table-grow-from-wasm.js @@ -28,8 +28,8 @@ function testGrowInternalAnyRefTable(table_index) { builder.addTable(kWasmAnyRef, initial_size).index; } builder.addFunction('grow', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, table_index]) .exportFunc(); @@ -38,7 +38,7 @@ function testGrowInternalAnyRefTable(table_index) { .exportFunc(); builder.addFunction('get', kSig_r_i) - .addBody([kExprGetLocal, 0, kExprTableGet, table_index]) + .addBody([kExprLocalGet, 0, kExprTableGet, table_index]) .exportFunc(); const instance = builder.instantiate(); @@ -75,8 +75,8 @@ function testGrowInternalAnyFuncTable(table_index) { builder.addTable(kWasmAnyFunc, size).index; } builder.addFunction('grow', kSig_i_ai) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, table_index]) .exportFunc(); @@ -86,7 +86,7 @@ function testGrowInternalAnyFuncTable(table_index) { const sig_index = builder.addType(kSig_i_v); builder.addFunction('call', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallIndirect, sig_index, table_index]) + .addBody([kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index]) .exportFunc(); const instance = builder.instantiate(); @@ -118,8 +118,8 @@ testGrowInternalAnyFuncTable(9); const builder = new WasmModuleBuilder(); const table_index = builder.addImportedTable("imp", "table", size, undefined, kWasmAnyRef); builder.addFunction('grow', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, table_index]) .exportFunc(); @@ -164,26 +164,26 @@ testGrowInternalAnyFuncTable(9); const internal_func = builder.addTable(kWasmAnyFunc, initial, maximum).index; builder.addFunction('grow_imported_ref', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, import_ref]) .exportFunc(); builder.addFunction('grow_imported_func', kSig_i_ai) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, import_func]) .exportFunc(); builder.addFunction('grow_internal_ref', kSig_i_ri) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, internal_ref]) .exportFunc(); builder.addFunction('grow_internal_func', kSig_i_ai) - .addBody([kExprGetLocal, 0, - kExprGetLocal, 1, + .addBody([kExprLocalGet, 0, + kExprLocalGet, 1, kNumericPrefix, kExprTableGrow, internal_func]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/table-grow.js b/deps/v8/test/mjsunit/wasm/table-grow.js index a8508b4bdd..d2b7970bfa 100644 --- a/deps/v8/test/mjsunit/wasm/table-grow.js +++ b/deps/v8/test/mjsunit/wasm/table-grow.js @@ -10,20 +10,20 @@ function addFunctions(builder) { let sig_index = builder.addType(kSig_i_ii); let mul = builder.addFunction("mul", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Mul // -- ]); let add = builder.addFunction("add", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Add // -- ]); let sub = builder.addFunction("sub", sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprI32Sub // -- ]); return {mul: mul, add: add, sub: sub}; @@ -45,7 +45,7 @@ function addMain(builder) { builder.addFunction("main", kSig_i_i) .addBody([ kExprI32Const, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero]) .exportAs("main"); } @@ -53,7 +53,7 @@ function addMain(builder) { let id = (() => { // identity exported function let builder = new WasmModuleBuilder(); builder.addFunction("id", kSig_i_i) - .addBody([kExprGetLocal, 0]) + .addBody([kExprLocalGet, 0]) .exportAs("id"); let module = new WebAssembly.Module(builder.toBuffer()); return (new WebAssembly.Instance(builder.toModule())).exports.id; @@ -125,8 +125,8 @@ let id = (() => { // identity exported function builder.addFunction("main", kSig_i_ii) .addBody([ kExprI32Const, 15, // -- - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallIndirect, 0, kTableZero]) // -- .exportAs("main"); @@ -254,14 +254,14 @@ let id = (() => { // identity exported function builder.addImportedTable("x", "table", 1, kMaxTableSize); builder.addFunction("add", index_i_ii) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 1, + kExprLocalGet, 0, + kExprLocalGet, 1, kExprI32Add]); builder.addFunction("main", index_i_i) .addBody([ kExprI32Const, 5, kExprI32Const, 5, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, index_i_ii, kTableZero]) .exportAs("main"); builder.addElementSegment(0, 0, false, [0]); diff --git a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js index 96d3a0bac5..e43eaf7258 100644 --- a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js @@ -44,7 +44,7 @@ function instantiate(buffer, ffi) { let builder = new WasmModuleBuilder(); builder.addFunction(undefined, kSig_i_i) .addLocals({i32_count: 1}) - .addBody([kExprGetLocal, 0, kExprSetLocal, 1, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalSet, 1, kExprLocalGet, 1]) .exportAs('main'); var buffer = builder.toBuffer(debug); @@ -67,7 +67,7 @@ function instantiate(buffer, ffi) { let builder = new WasmModuleBuilder(); builder.addFunction(undefined, makeSig_r_x(p.type, p.type)) .addLocals(p.locals) - .addBody([kExprGetLocal, 0, kExprSetLocal, 1, kExprGetLocal, 1]) + .addBody([kExprLocalGet, 0, kExprLocalSet, 1, kExprLocalGet, 1]) .exportAs('main'); var buffer = builder.toBuffer(debug); @@ -81,10 +81,10 @@ function instantiate(buffer, ffi) { print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('add', kSig_i_ii).addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add ]); builder.addFunction('main', kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprCallFunction, 0]) .exportAs('main'); var instance = builder.instantiate(); @@ -96,11 +96,11 @@ function instantiate(buffer, ffi) { print(arguments.callee.name); let builder = new WasmModuleBuilder(); builder.addFunction('add', kSig_i_ii).addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add + kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add ]); builder.addFunction('main', kSig_i_iii) .addBody([ - kExprGetLocal, 1, kExprGetLocal, 2, kExprGetLocal, 0, kExprCallIndirect, + kExprLocalGet, 1, kExprLocalGet, 2, kExprLocalGet, 0, kExprCallIndirect, 0, kTableZero ]) .exportAs('main'); @@ -117,7 +117,7 @@ function instantiate(buffer, ffi) { let builder = new WasmModuleBuilder(); builder.addMemory(1, 1, false); builder.addFunction('load', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0]) .exportAs('load'); builder.addDataSegment(0, [9, 9, 9, 9]); diff --git a/deps/v8/test/mjsunit/wasm/trap-location.js b/deps/v8/test/mjsunit/wasm/trap-location.js index d893f97d62..91cb0d0721 100644 --- a/deps/v8/test/mjsunit/wasm/trap-location.js +++ b/deps/v8/test/mjsunit/wasm/trap-location.js @@ -54,27 +54,27 @@ builder.addFunction("main", kSig_i_i) .addBody([ // offset 1 kExprBlock, kWasmI32, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32LtU, kExprIf, kWasmStmt, // offset 9 kExprI32Const, 0x7e /* -2 */, - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32DivU, // offset 15 kExprI32LoadMem, 0, 0, kExprBr, 1, kExprEnd, // offset 21 - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32Eq, kExprIf, kWasmStmt, kExprUnreachable, kExprEnd, // offset 30 - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, kTableZero, kExprEnd, ]) diff --git a/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js b/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js index b7a7ee7969..863a59aaa4 100644 --- a/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js +++ b/deps/v8/test/mjsunit/wasm/type-reflection-with-anyref.js @@ -57,13 +57,13 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); table.set(0, f1); builder.addFunction('call0', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index0 ]) .exportFunc(); builder.addFunction('call1', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index1 ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/type-reflection-with-mv.js b/deps/v8/test/mjsunit/wasm/type-reflection-with-mv.js new file mode 100644 index 0000000000..0a7e98492f --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/type-reflection-with-mv.js @@ -0,0 +1,80 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --experimental-wasm-type-reflection --expose-gc --experimental-wasm-mv + +(function TestFunctionConstructedCoercions() { + let obj1 = { valueOf: _ => 123.45 }; + let obj2 = { toString: _ => "456" }; + let gcer = { valueOf: _ => gc() }; + let testcases = [ + { params: { sig: [], + val: [], + exp: [], }, + result: { sig: ["i32", "f32"], + val: [42.7, "xyz"], + exp: [42, NaN] }, + }, + { params: { sig: [], + val: [], + exp: [], }, + result: { sig: ["i32", "f32", "f64"], + val: (function* () { yield obj1; yield obj2; yield "789" })(), + exp: [123, 456, 789], }, + }, + { params: { sig: [], + val: [], + exp: [], }, + result: { sig: ["i32", "f32", "f64"], + val: new Proxy([gcer, {}, "xyz"], { + get: function(obj, prop) { return Reflect.get(obj, prop); } + }), + exp: [0, NaN, NaN], }, + }, + ]; + testcases.forEach(function({params, result}) { + let p = params.sig; let r = result.sig; var params_after; + function testFun() { params_after = arguments; return result.val; } + let fun = new WebAssembly.Function({parameters:p, results:r}, testFun); + let result_after = fun.apply(undefined, params.val); + assertArrayEquals(params.exp, params_after); + assertEquals(result.exp, result_after); + }); +})(); + +(function TestFunctionConstructedCoercionsThrow() { + let proxy_throw = new Proxy([1, 2], { + get: function(obj, prop) { + if (prop == 1) { + throw new Error("abc"); + } + return Reflect.get(obj, prop); }, + }); + function* generator_throw() { + yield 1; + throw new Error("def"); + } + let testcases = [ + { val: 0, + error: Error, + msg: /not iterable/ }, + { val: [1], + error: TypeError, + msg: /multi-return length mismatch/ }, + { val: [1, 2, 3], + error: TypeError, + msg: /multi-return length mismatch/ }, + { val: proxy_throw, + error: Error, + msg: /abc/ }, + { val: generator_throw(), + error: Error, + msg: /def/ }, + ]; + testcases.forEach(function({val, error, msg}) { + fun = new WebAssembly.Function({parameters:[], results:["i32", "i32"]}, + () => val); + assertThrows(fun, error, msg); + }) +})(); diff --git a/deps/v8/test/mjsunit/wasm/type-reflection.js b/deps/v8/test/mjsunit/wasm/type-reflection.js index a9a0b87143..bac877d187 100644 --- a/deps/v8/test/mjsunit/wasm/type-reflection.js +++ b/deps/v8/test/mjsunit/wasm/type-reflection.js @@ -533,7 +533,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); table.set(0, fun1); builder.addFunction('main', kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index ]) .exportFunc(); @@ -554,7 +554,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js'); table.set(0, fun); builder.addFunction('main', kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallIndirect, sig_index, table_index, kExprDrop ]) diff --git a/deps/v8/test/mjsunit/wasm/unicode.js b/deps/v8/test/mjsunit/wasm/unicode.js index 2b5f5ce9fe..73dc0608c6 100644 --- a/deps/v8/test/mjsunit/wasm/unicode.js +++ b/deps/v8/test/mjsunit/wasm/unicode.js @@ -9,7 +9,7 @@ function checkImport( var builder = new WasmModuleBuilder(); builder.addImport(imported_module_name, imported_function_name, kSig_i_i); builder.addFunction('call_imp', kSig_i_i) - .addBody([kExprGetLocal, 0, kExprCallFunction, 0]) + .addBody([kExprLocalGet, 0, kExprCallFunction, 0]) .exportFunc(); let imp = i => i + 3; @@ -29,10 +29,10 @@ function checkExports( exported_name_add) { var builder = new WasmModuleBuilder(); builder.addFunction(internal_name_mul, kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Mul]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Mul]) .exportAs(exported_name_mul); builder.addFunction(internal_name_add, kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportAs(exported_name_add); let instance = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/user-properties-exported.js b/deps/v8/test/mjsunit/wasm/user-properties-exported.js index 80f2077f3c..0b2f249e05 100644 --- a/deps/v8/test/mjsunit/wasm/user-properties-exported.js +++ b/deps/v8/test/mjsunit/wasm/user-properties-exported.js @@ -13,7 +13,7 @@ load("test/mjsunit/wasm/user-properties-common.js"); var builder = new WasmModuleBuilder(); builder.addFunction("exp", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("exp"); let module1 = builder.toModule(); diff --git a/deps/v8/test/mjsunit/wasm/user-properties-module.js b/deps/v8/test/mjsunit/wasm/user-properties-module.js index 69a1f898d7..84727e1b53 100644 --- a/deps/v8/test/mjsunit/wasm/user-properties-module.js +++ b/deps/v8/test/mjsunit/wasm/user-properties-module.js @@ -14,7 +14,7 @@ load("test/mjsunit/wasm/user-properties-common.js"); builder.addImport("m", "f", kSig_i_i); builder.addFunction("main", kSig_i_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprCallFunction, 0]) .exportAs("main"); builder.addMemory(1, 1, false) diff --git a/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js b/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js index 3b1a333c7f..3d9512cf85 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js +++ b/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js @@ -140,7 +140,7 @@ function genUnop(name, sig) { builder.addImport('Math', name, sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- + kExprLocalGet, 0, // -- kExprCallFunction, 0 ]) // -- .exportAs('main'); @@ -155,8 +155,8 @@ function genBinop(name, sig) { builder.addImport('Math', name, sig_index); builder.addFunction('main', sig_index) .addBody([ - kExprGetLocal, 0, // -- - kExprGetLocal, 1, // -- + kExprLocalGet, 0, // -- + kExprLocalGet, 1, // -- kExprCallFunction, 0 ]) // -- .exportAs('main'); diff --git a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js index 45af969d09..b4d7cae41b 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js @@ -84,6 +84,7 @@ let kSharedHasMaximumFlag = 3; let kActiveNoIndex = 0; let kPassive = 1; let kActiveWithIndex = 2; +let kPassiveWithElements = 5; // Function declaration flags let kDeclFunctionName = 0x01; @@ -209,11 +210,11 @@ let kExprReturnCall = 0x12; let kExprReturnCallIndirect = 0x13; let kExprDrop = 0x1a; let kExprSelect = 0x1b; -let kExprGetLocal = 0x20; -let kExprSetLocal = 0x21; -let kExprTeeLocal = 0x22; -let kExprGetGlobal = 0x23; -let kExprSetGlobal = 0x24; +let kExprLocalGet = 0x20; +let kExprLocalSet = 0x21; +let kExprLocalTee = 0x22; +let kExprGlobalGet = 0x23; +let kExprGlobalSet = 0x24; let kExprTableGet = 0x25; let kExprTableSet = 0x26; let kExprI32LoadMem = 0x28; @@ -464,6 +465,9 @@ let kExprI64AtomicCompareExchange16U = 0x4d; let kExprI64AtomicCompareExchange32U = 0x4e; // Simd opcodes. +let kExprS128LoadMem = 0x00; +let kExprS128StoreMem = 0x01; +let kExprI32x4Splat = 0x0c; let kExprF32x4Min = 0x9e; // Compilation hint constants. @@ -1093,7 +1097,7 @@ class WasmModuleBuilder { } } else { // Emit a global-index initializer. - section.emit_u8(kExprGetGlobal); + section.emit_u8(kExprGlobalGet); section.emit_u32v(global.init_index); } section.emit_u8(kExprEnd); // end of init expression @@ -1158,19 +1162,22 @@ class WasmModuleBuilder { section.emit_u32v(init.table); } if (init.is_global) { - section.emit_u8(kExprGetGlobal); + section.emit_u8(kExprGlobalGet); } else { section.emit_u8(kExprI32Const); } section.emit_u32v(init.base); section.emit_u8(kExprEnd); + if (init.table != 0) { + section.emit_u8(kExternalFunction); + } section.emit_u32v(init.array.length); for (let index of init.array) { section.emit_u32v(index); } } else { // Passive segment. - section.emit_u8(kPassive); // flags + section.emit_u8(kPassiveWithElements); // flags section.emit_u8(kWasmAnyFunc); section.emit_u32v(init.array.length); for (let index of init.array) { @@ -1290,7 +1297,7 @@ class WasmModuleBuilder { section.emit_u8(0); // linear memory index 0 / flags if (seg.is_global) { // initializer is a global variable - section.emit_u8(kExprGetGlobal); + section.emit_u8(kExprGlobalGet); section.emit_u32v(seg.addr); } else { // initializer is a constant diff --git a/deps/v8/test/mjsunit/wasm/worker-interpreter.js b/deps/v8/test/mjsunit/wasm/worker-interpreter.js index ccf6d279a0..9a7ab60756 100644 --- a/deps/v8/test/mjsunit/wasm/worker-interpreter.js +++ b/deps/v8/test/mjsunit/wasm/worker-interpreter.js @@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); (function TestPostInterpretedModule() { let builder = new WasmModuleBuilder(); let add = builder.addFunction("add", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); let module = builder.toModule(); diff --git a/deps/v8/test/mjsunit/wasm/worker-module.js b/deps/v8/test/mjsunit/wasm/worker-module.js index f626263b25..76d84daaba 100644 --- a/deps/v8/test/mjsunit/wasm/worker-module.js +++ b/deps/v8/test/mjsunit/wasm/worker-module.js @@ -9,7 +9,7 @@ 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]) + .addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add]) .exportFunc(); let module = builder.toModule(); |