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

Side by Side Diff: test/mjsunit/wasm/unreachable-validation.js

Issue 2696813002: [wasm] Inspect right control frames for unreachable flag (Closed)
Patch Set: Avoid conversion warning 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
« no previous file with comments | « test/mjsunit/wasm/globals.js ('k') | test/mjsunit/wasm/wasm-module-builder.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 // Set unittest to false to run this test and just print results, without failin g. 10 // Set unittest to false to run this test and just print results, without failin g.
(...skipping 22 matching lines...) Expand all
33 33
34 let V = true; 34 let V = true;
35 let I = false; 35 let I = false;
36 let X = undefined; 36 let X = undefined;
37 37
38 let nop = kExprNop; 38 let nop = kExprNop;
39 let iadd = kExprI32Add; 39 let iadd = kExprI32Add;
40 let unr = kExprUnreachable; 40 let unr = kExprUnreachable;
41 let ret = kExprReturn; 41 let ret = kExprReturn;
42 let br0 = [kExprBr, 0]; 42 let br0 = [kExprBr, 0];
43 let brt = [kExprBrTable, 0, 0]; 43 let br1 = [kExprBr, 1];
44 let brt0 = [kExprBrTable, 0, 0];
45 let brt1 = [kExprBrTable, 0, 1];
46 let brt01 = [kExprBrTable, 1, 0, 1];
44 let f32 = [kExprF32Const, 0, 0, 0, 0]; 47 let f32 = [kExprF32Const, 0, 0, 0, 0];
45 let zero = [kExprI32Const, 0]; 48 let zero = [kExprI32Const, 0];
46 let if_else_empty = [kExprIf, kWasmStmt, kExprElse, kExprEnd]; 49 let if_else_empty = [kExprIf, kWasmStmt, kExprElse, kExprEnd];
47 let if_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprEnd]; 50 let if_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprEnd];
48 let if_else_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprElse, kExprUnreach able, kExprEnd]; 51 let if_else_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprElse, kExprUnreach able, kExprEnd];
49 let block_unr = [kExprBlock, kWasmStmt, kExprUnreachable, kExprEnd]; 52 let block_unr = [kExprBlock, kWasmStmt, kExprUnreachable, kExprEnd];
50 let loop_unr = [kExprLoop, kWasmStmt, kExprUnreachable, kExprEnd]; 53 let loop_unr = [kExprLoop, kWasmStmt, kExprUnreachable, kExprEnd];
51 let block_block_unr = [kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprUnreac hable, kExprEnd, kExprEnd]; 54 let block_block_unr = [kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprUnreac hable, kExprEnd, kExprEnd];
55 let block = [kExprBlock, kWasmStmt]
56 let iblock = [kExprBlock, kWasmI32]
57 let fblock = [kExprBlock, kWasmF32]
58 let end = kExprEnd;
52 let drop = kExprDrop; 59 let drop = kExprDrop;
53 60
54 run(V, "U", [unr]); 61 run(V, "U", [unr]);
55 run(V, 'U U', [unr, unr]); 62 run(V, 'U U', [unr, unr]);
56 run(V, "(if 0 () else ())", [...zero, ...if_else_empty]); 63 run(V, "(if 0 () else ())", [...zero, ...if_else_empty]);
57 run(V, "(if 0 U)", [...zero, ...if_unr]); 64 run(V, "(if 0 U)", [...zero, ...if_unr]);
58 run(V, "(if 0 U U)", [...zero, ...if_else_unr]); 65 run(V, "(if 0 U U)", [...zero, ...if_else_unr]);
59 run(I, "(if 0 U) iadd", [...zero, ...if_unr, iadd]); 66 run(I, "(if 0 U) iadd", [...zero, ...if_unr, iadd]);
60 run(I, "(if 0 U) iadd drop", [...zero, ...if_unr, iadd, drop]); 67 run(I, "(if 0 U) iadd drop", [...zero, ...if_unr, iadd, drop]);
61 run(V, "0 0 (if 0 U) iadd drop", [...zero, ...zero, ...zero, ...if_unr, iadd, dr op]); 68 run(V, "0 0 (if 0 U) iadd drop", [...zero, ...zero, ...zero, ...if_unr, iadd, dr op]);
62 run(V, "(if 0 U) 0 0 iadd drop", [...zero, ...if_unr, ...zero, ...zero, iadd, dr op]); 69 run(V, "(if 0 U) 0 0 iadd drop", [...zero, ...if_unr, ...zero, ...zero, iadd, dr op]);
63 70
64 run(V, "(block U)", [...block_unr]); 71 run(V, "(block U)", [...block_unr]);
65 run(V, "(loop U)", [...loop_unr]); 72 run(V, "(loop U)", [...loop_unr]);
66 run(V, "(if 0 U U)", [...zero, ...if_else_unr]); 73 run(V, "(if 0 U U)", [...zero, ...if_else_unr]);
67 74
68 run(V, 'U nop', [unr, nop]); 75 run(V, 'U nop', [unr, nop]);
69 run(V, 'U iadd drop', [unr, iadd, drop]); 76 run(V, 'U iadd drop', [unr, iadd, drop]);
70 run(V, 'br0 iadd drop', [...br0, iadd, drop]); 77 run(V, 'br0 iadd drop', [...br0, iadd, drop]);
71 run(V, '0 brt iadd drop', [...zero, ...brt, iadd, drop]); 78 run(V, '0 brt0 iadd drop', [...zero, ...brt0, iadd, drop]);
72 run(V, 'ret iadd drop', [ret, iadd, drop]); 79 run(V, 'ret iadd drop', [ret, iadd, drop]);
73 80
74 run(V, 'U 0 0 iadd drop', [unr, ...zero, ...zero, iadd, drop]); 81 run(V, 'U 0 0 iadd drop', [unr, ...zero, ...zero, iadd, drop]);
75 run(V, 'br0 0 0 iadd drop', [...br0, ...zero, ...zero, iadd, drop]); 82 run(V, 'br0 0 0 iadd drop', [...br0, ...zero, ...zero, iadd, drop]);
76 run(V, '0 brt 0 0 iadd drop', [...zero, ...brt, ...zero, ...zero, iadd, drop]); 83 run(V, '0 brt0 0 0 iadd drop', [...zero, ...brt0, ...zero, ...zero, iadd, drop]) ;
77 run(V, 'ret 0 0 iadd drop', [ret, ...zero, ...zero, iadd, drop]); 84 run(V, 'ret 0 0 iadd drop', [ret, ...zero, ...zero, iadd, drop]);
78 85
79 run(I, 'br0 iadd', [...br0, iadd]); 86 run(I, 'br0 iadd', [...br0, iadd]);
80 run(I, '0 brt iadd', [...zero, ...brt, iadd]); 87 run(I, '0 brt0 iadd', [...zero, ...brt0, iadd]);
81 run(I, 'ret iadd', [ret, iadd]); 88 run(I, 'ret iadd', [ret, iadd]);
82 run(I, '0 0 br0 iadd', [...zero, ...zero, ...br0, iadd]); 89 run(I, '0 0 br0 iadd', [...zero, ...zero, ...br0, iadd]);
83 run(I, '0 0 ret iadd', [...zero, ...zero, ret, iadd]); 90 run(I, '0 0 ret iadd', [...zero, ...zero, ret, iadd]);
84 91
85 run(I, '(block U) iadd drop', [...block_unr, iadd, drop]); 92 run(I, '(block U) iadd drop', [...block_unr, iadd, drop]);
86 run(I, '(block (block U)) iadd drop', [...block_block_unr, iadd, drop]); 93 run(I, '(block (block U)) iadd drop', [...block_block_unr, iadd, drop]);
87 run(I, '(loop U) iadd drop', [...loop_unr, iadd]); 94 run(I, '(loop U) iadd drop', [...loop_unr, iadd]);
88 run(I, '(if 0 U U) iadd drop', [...zero, ...if_else_unr, iadd, drop]); 95 run(I, '(if 0 U U) iadd drop', [...zero, ...if_else_unr, iadd, drop]);
89 96
90 run(V, 'U 0 0 iadd drop', [unr, ...zero, ...zero, iadd, drop]); 97 run(V, 'U 0 0 iadd drop', [unr, ...zero, ...zero, iadd, drop]);
(...skipping 13 matching lines...) Expand all
104 run(I, "(loop U) 0f 0 iadd drop", [...loop_unr, ...f32, ...zero, iadd, drop]); 111 run(I, "(loop U) 0f 0 iadd drop", [...loop_unr, ...f32, ...zero, iadd, drop]);
105 run(I, "(block (block U)) 0f 0 iadd drop", [...block_block_unr, ...f32, ...zero, iadd, drop]); 112 run(I, "(block (block U)) 0f 0 iadd drop", [...block_block_unr, ...f32, ...zero, iadd, drop]);
106 113
107 run(V, '0f U iadd drop', [...f32, unr, iadd, drop]); 114 run(V, '0f U iadd drop', [...f32, unr, iadd, drop]);
108 run(V, '0f 0 U iadd drop', [...f32, ...zero, unr, iadd, drop]); 115 run(V, '0f 0 U iadd drop', [...f32, ...zero, unr, iadd, drop]);
109 run(I, "0f 0 (block U) iadd drop", [...f32, ...zero, ...block_unr, iadd, drop]); 116 run(I, "0f 0 (block U) iadd drop", [...f32, ...zero, ...block_unr, iadd, drop]);
110 run(V, '0f U 0 iadd drop', [...f32, unr, ...zero, iadd, drop]); 117 run(V, '0f U 0 iadd drop', [...f32, unr, ...zero, iadd, drop]);
111 run(I, "0 U 0f iadd drop", [...zero, unr, ...zero, ...f32, iadd, drop]); 118 run(I, "0 U 0f iadd drop", [...zero, unr, ...zero, ...f32, iadd, drop]);
112 run(I, "0f (block U) 0 iadd drop", [...f32, ...block_unr, ...zero, iadd, drop]); 119 run(I, "0f (block U) 0 iadd drop", [...f32, ...block_unr, ...zero, iadd, drop]);
113 run(I, "0 (block U) 0f iadd drop", [...zero, ...block_unr, ...f32, iadd, drop]); 120 run(I, "0 (block U) 0f iadd drop", [...zero, ...block_unr, ...f32, iadd, drop]);
121
122 run(I, "(iblock 0 (block br1)) drop", [...iblock, ...zero, ...block, ...br1, end , end, drop]);
123 run(I, "(iblock 0 (block 0 brt1)) drop", [...iblock, ...zero, ...block, ...zero, ...brt1, end, end, drop]);
124 run(I, "(block (iblock 0 0 brt01) drop)", [...block, ...iblock, ...zero, ...zero , ...brt01, end, drop, end]);
125 run(I, "U (iblock 0 (block br1)) drop", [unr, ...iblock, ...zero, ...block, ...b r1, end, end, drop]);
126 run(I, "U (iblock 0 (block 0 brt1)) drop", [unr, ...iblock, ...zero, ...block, . ..zero, ...brt1, end, end, drop]);
127 run(I, "U (block (iblock 0 0 brt01) drop)", [unr, ...block, ...iblock, ...zero, ...zero, ...brt01, end, drop, end]);
128 run(V, "(iblock (iblock U 0 brt01)) drop", [...iblock, ...iblock, unr, ...zero, ...brt01, end, end, drop]);
129 run(I, "(block (fblock U 0 brt01) drop)", [...iblock, ...fblock, unr, ...zero, . ..brt01, end, drop, end]);
130 run(I, "(iblock (fblock U 0 brt01) drop 0) drop", [...iblock, ...fblock, unr, .. .zero, ...brt01, end, drop, ...zero, end, drop]);
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/globals.js ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698