Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: test/mjsunit/asm/asm-validation.js

Issue 2771183002: [wasm][asm.js] Fix and enable several asm.js tests with the new parser. (Closed)
Patch Set: fix one more item Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-module-builder.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --validate-asm --allow-natives-syntax 5 // Flags: --validate-asm --allow-natives-syntax
6 6
7 // Note that this test file contains tests that explicitly check modules are 7 // Note that this test file contains tests that explicitly check modules are
8 // valid asm.js and then break them with invalid instantiation arguments. If 8 // valid asm.js and then break them with invalid instantiation arguments. If
9 // this script is run more than once (e.g. --stress-opt) then modules remain 9 // this script is run more than once (e.g. --stress-opt) then modules remain
10 // broken in the second run and assertions would fail. We prevent re-runs. 10 // broken in the second run and assertions would fail. We prevent re-runs.
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 function Module(stdlib) { 332 function Module(stdlib) {
333 "use asm"; 333 "use asm";
334 var set = 0; 334 var set = 0;
335 var foo = stdlib[set]; 335 var foo = stdlib[set];
336 return {}; 336 return {};
337 } 337 }
338 var m = Module(this); 338 var m = Module(this);
339 assertFalse(%IsAsmWasmCode(Module)); 339 assertFalse(%IsAsmWasmCode(Module));
340 })(); 340 })();
341 341
342 (function TestBadishBooleanExprAnnotation() {
343 function Module() {
344 "use asm";
345 function foo(x) {
346 x = x | 0;
347 x = (x + 1) | false;
348 return x | 0;
349 }
350 return { foo: foo };
351 }
352 var m = Module();
353 // We all false here because the parser optimizes expressons like:
354 // !123 to false.
355 assertTrue(%IsAsmWasmCode(Module));
356 assertEquals(4, m.foo(3));
357 })();
358
359 (function TestBadFroundTrue() { 342 (function TestBadFroundTrue() {
360 function Module(stdlib) { 343 function Module(stdlib) {
361 "use asm"; 344 "use asm";
362 var fround = stdlib.Math.fround; 345 var fround = stdlib.Math.fround;
363 function foo() { 346 function foo() {
364 var x = fround(true); 347 var x = fround(true);
365 return +x; 348 return +x;
366 } 349 }
367 return { foo: foo }; 350 return { foo: foo };
368 } 351 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 var o = Module(); 472 var o = Module();
490 assertValidAsm(Module); 473 assertValidAsm(Module);
491 assertFalse(o instanceof WebAssembly.Instance); 474 assertFalse(o instanceof WebAssembly.Instance);
492 assertTrue(o instanceof Object); 475 assertTrue(o instanceof Object);
493 assertTrue(o.__proto__ === Object.prototype); 476 assertTrue(o.__proto__ === Object.prototype);
494 o.x = 5; 477 o.x = 5;
495 assertTrue(typeof o.x === 'number'); 478 assertTrue(typeof o.x === 'number');
496 assertTrue(o.__single_function__ === undefined); 479 assertTrue(o.__single_function__ === undefined);
497 assertTrue(o.__foreign_init__ === undefined); 480 assertTrue(o.__foreign_init__ === undefined);
498 })(); 481 })();
OLDNEW
« no previous file with comments | « src/wasm/wasm-module-builder.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698