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

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

Issue 2481103002: [wasm] [asm.js] Don't allow bad return types from a global constant (Closed)
Patch Set: Created 4 years, 1 month 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 | « test/cctest/asmjs/test-asm-typer.cc ('k') | test/mjsunit/asm/regress-660813.js » ('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 function assertValidAsm(func) { 7 function assertValidAsm(func) {
8 assertTrue(%IsAsmWasmCode(func)); 8 assertTrue(%IsAsmWasmCode(func));
9 } 9 }
10 10
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 "use asm"; 276 "use asm";
277 function foo() { return 123; } 277 function foo() { return 123; }
278 return { foo: foo }; 278 return { foo: foo };
279 } 279 }
280 var heap = new ArrayBuffer(1024 * 1024); 280 var heap = new ArrayBuffer(1024 * 1024);
281 var ModuleBound = Module.bind(this, {}, {}, heap); 281 var ModuleBound = Module.bind(this, {}, {}, heap);
282 var m = ModuleBound(); 282 var m = ModuleBound();
283 assertValidAsm(Module); 283 assertValidAsm(Module);
284 assertEquals(123, m.foo()); 284 assertEquals(123, m.foo());
285 })(); 285 })();
286
287 (function TestBadConstUnsignedReturn() {
288 function Module() {
289 "use asm";
290 const i = 0xffffffff;
291 function foo() { return i; }
292 return { foo: foo };
293 }
294 var m = Module();
295 assertTrue(%IsNotAsmWasmCode(Module));
296 assertEquals(0xffffffff, m.foo());
297 })();
OLDNEW
« no previous file with comments | « test/cctest/asmjs/test-asm-typer.cc ('k') | test/mjsunit/asm/regress-660813.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698