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

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

Issue 2664493002: [wasm][asm.js] Make asm.js->wasm return a regular object. (Closed)
Patch Set: fix Created 3 years, 10 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
« src/wasm/wasm-module.cc ('K') | « src/wasm/wasm-module.cc ('k') | no next file » | 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 b = b | 0; 469 b = b | 0;
470 // Disallowed because conditional yields int, even when both sides 470 // Disallowed because conditional yields int, even when both sides
471 // are signed. 471 // are signed.
472 return 1 ? a | 0 : b | 0; 472 return 1 ? a | 0 : b | 0;
473 } 473 }
474 return foo; 474 return foo;
475 } 475 }
476 Module(); 476 Module();
477 assertFalse(% IsAsmWasmCode(Module)); 477 assertFalse(% IsAsmWasmCode(Module));
478 })(); 478 })();
479
480 (function TestAsmIsRegular() {
481 function Module() {
482 'use asm';
483 var g = 123;
484 function foo() {
485 return g | 0;
486 }
487 return {x: foo};
488 }
489 var o = Module();
490 assertValidAsm(Module);
491 assertFalse(o instanceof WebAssembly.Instance);
492 assertTrue(o instanceof Object);
493 assertTrue(o.__proto__ === Object.prototype);
494 o.x = 5;
495 assertTrue(typeof o.x === 'number');
496 assertTrue(o.__single_function__ === undefined);
497 assertTrue(o.__foreign_init__ === undefined);
498 })();
OLDNEW
« src/wasm/wasm-module.cc ('K') | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698