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

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

Issue 2670673002: [wasm] Implement polymorphic checking, matching the reference interpreter. (Closed)
Patch Set: Fix test-run-simd 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
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 21 matching lines...) Expand all
32 } 32 }
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 f32 = [kExprF32Const, 0, 0, 0, 0]; 44 let f32 = [kExprF32Const, 0, 0, 0, 0];
44 let zero = [kExprI32Const, 0]; 45 let zero = [kExprI32Const, 0];
45 let if_else_empty = [kExprIf, kWasmStmt, kExprElse, kExprEnd]; 46 let if_else_empty = [kExprIf, kWasmStmt, kExprElse, kExprEnd];
46 let if_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprEnd]; 47 let if_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprEnd];
47 let if_else_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprElse, kExprUnreach able, kExprEnd]; 48 let if_else_unr = [kExprIf, kWasmStmt, kExprUnreachable, kExprElse, kExprUnreach able, kExprEnd];
48 let block_unr = [kExprBlock, kWasmStmt, kExprUnreachable, kExprEnd]; 49 let block_unr = [kExprBlock, kWasmStmt, kExprUnreachable, kExprEnd];
49 let loop_unr = [kExprLoop, kWasmStmt, kExprUnreachable, kExprEnd]; 50 let loop_unr = [kExprLoop, kWasmStmt, kExprUnreachable, kExprEnd];
50 let block_block_unr = [kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprUnreac hable, kExprEnd, kExprEnd]; 51 let block_block_unr = [kExprBlock, kWasmStmt, kExprBlock, kWasmStmt, kExprUnreac hable, kExprEnd, kExprEnd];
51 let drop = kExprDrop; 52 let drop = kExprDrop;
52 53
53 run(V, "U", [unr]); 54 run(V, "U", [unr]);
54 run(V, "U U", [unr, unr]); 55 run(V, 'U U', [unr, unr]);
55 run(V, "(if 0 () else ())", [...zero, ...if_else_empty]); 56 run(V, "(if 0 () else ())", [...zero, ...if_else_empty]);
56 run(V, "(if 0 U)", [...zero, ...if_unr]); 57 run(V, "(if 0 U)", [...zero, ...if_unr]);
57 run(V, "(if 0 U U)", [...zero, ...if_else_unr]); 58 run(V, "(if 0 U U)", [...zero, ...if_else_unr]);
58 run(I, "(if 0 U) iadd", [...zero, ...if_unr, iadd]); 59 run(I, "(if 0 U) iadd", [...zero, ...if_unr, iadd]);
59 run(I, "(if 0 U) iadd drop", [...zero, ...if_unr, iadd, drop]); 60 run(I, "(if 0 U) iadd drop", [...zero, ...if_unr, iadd, drop]);
60 run(V, "0 0 (if 0 U) iadd drop", [...zero, ...zero, ...zero, ...if_unr, iadd, dr op]); 61 run(V, "0 0 (if 0 U) iadd drop", [...zero, ...zero, ...zero, ...if_unr, iadd, dr op]);
61 run(V, "(if 0 U) 0 0 iadd drop", [...zero, ...if_unr, ...zero, ...zero, iadd, dr op]); 62 run(V, "(if 0 U) 0 0 iadd drop", [...zero, ...if_unr, ...zero, ...zero, iadd, dr op]);
62 63
63 run(V, "(block U)", [...block_unr]); 64 run(V, "(block U)", [...block_unr]);
64 run(V, "(loop U)", [...loop_unr]); 65 run(V, "(loop U)", [...loop_unr]);
65 run(V, "(if 0 U U)", [...zero, ...if_else_unr]); 66 run(V, "(if 0 U U)", [...zero, ...if_else_unr]);
66 67
67 run(V, "U nop", [unr, nop]); 68 run(V, 'U nop', [unr, nop]);
68 run(V, "U iadd drop", [unr, iadd, drop]); 69 run(V, 'U iadd drop', [unr, iadd, drop]);
69 run(V, "br0 iadd drop", [br0, iadd, drop]); 70 run(V, 'br0 iadd drop', [...br0, iadd, drop]);
70 run(V, "ret iadd drop", [ret, iadd, drop]); 71 run(V, '0 brt iadd drop', [...zero, ...brt, iadd, drop]);
72 run(V, 'ret iadd drop', [ret, iadd, drop]);
71 73
72 run(V, "br0 iadd", [br0, iadd]); 74 run(V, 'U 0 0 iadd drop', [unr, ...zero, ...zero, iadd, drop]);
73 run(V, "ret iadd", [ret, iadd]); 75 run(V, 'br0 0 0 iadd drop', [...br0, ...zero, ...zero, iadd, drop]);
74 run(V, "0 0 br0 iadd", [...zero, ...zero, br0, iadd]); 76 run(V, '0 brt 0 0 iadd drop', [...zero, ...brt, ...zero, ...zero, iadd, drop]);
75 run(V, "0 0 ret iadd", [...zero, ...zero, ret, iadd]); 77 run(V, 'ret 0 0 iadd drop', [ret, ...zero, ...zero, iadd, drop]);
76 78
77 run(V, "(block U) iadd drop", [...block_unr, iadd, drop]); 79 run(I, 'br0 iadd', [...br0, iadd]);
78 run(V, "(block (block U)) iadd drop", [...block_block_unr, iadd, drop]); 80 run(I, '0 brt iadd', [...zero, ...brt, iadd]);
79 run(V, "(loop U) iadd drop", [...loop_unr, iadd]); 81 run(I, 'ret iadd', [ret, iadd]);
80 run(V, "(if 0 U U) iadd drop", [...zero, ...if_else_unr, iadd, drop]); 82 run(I, '0 0 br0 iadd', [...zero, ...zero, ...br0, iadd]);
83 run(I, '0 0 ret iadd', [...zero, ...zero, ret, iadd]);
81 84
82 run(V, "U 0 0 iadd drop", [unr, ...zero, ...zero, iadd, drop]); 85 run(I, '(block U) iadd drop', [...block_unr, iadd, drop]);
86 run(I, '(block (block U)) iadd drop', [...block_block_unr, iadd, drop]);
87 run(I, '(loop U) iadd drop', [...loop_unr, iadd]);
88 run(I, '(if 0 U U) iadd drop', [...zero, ...if_else_unr, iadd, drop]);
89
90 run(V, 'U 0 0 iadd drop', [unr, ...zero, ...zero, iadd, drop]);
83 run(V, "(block U) 0 0 iadd drop", [...block_unr, ...zero, ...zero, iadd, drop]); 91 run(V, "(block U) 0 0 iadd drop", [...block_unr, ...zero, ...zero, iadd, drop]);
84 run(V, "(loop U) 0 0 iadd drop", [...loop_unr, ...zero, ...zero, iadd, drop]); 92 run(V, "(loop U) 0 0 iadd drop", [...loop_unr, ...zero, ...zero, iadd, drop]);
85 run(V, "(block (block U)) 0 0 iadd drop", [...block_block_unr, ...zero, ...zero, iadd, drop]); 93 run(V, "(block (block U)) 0 0 iadd drop", [...block_block_unr, ...zero, ...zero, iadd, drop]);
86 run(V, "0 0 U iadd drop", [...zero, ...zero, unr, iadd, drop]); 94 run(V, '0 0 U iadd drop', [...zero, ...zero, unr, iadd, drop]);
87 run(V, "0 0 (block U) iadd drop", [...zero, ...zero, ...block_unr, iadd, drop]); 95 run(V, "0 0 (block U) iadd drop", [...zero, ...zero, ...block_unr, iadd, drop]);
88 run(V, "0 0 (loop U) iadd drop", [...zero, ...zero, ...loop_unr, iadd, drop]); 96 run(V, "0 0 (loop U) iadd drop", [...zero, ...zero, ...loop_unr, iadd, drop]);
89 run(V, "0 0 (block (block U)) iadd drop", [...zero, ...zero, ...block_block_unr, iadd, drop]); 97 run(V, "0 0 (block (block U)) iadd drop", [...zero, ...zero, ...block_block_unr, iadd, drop]);
90 98
91 run(I, "U 0f iadd drop", [unr, ...f32, iadd, drop]); 99 run(I, "U 0f iadd drop", [unr, ...f32, iadd, drop]);
92 run(I, "U 0f 0 iadd drop", [unr, ...f32, ...zero, iadd, drop]); 100 run(I, "U 0f 0 iadd drop", [unr, ...f32, ...zero, iadd, drop]);
93 run(I, "U 0 0f iadd drop", [unr, ...zero, ...f32, iadd, drop]); 101 run(I, "U 0 0f iadd drop", [unr, ...zero, ...f32, iadd, drop]);
94 run(I, "(if 0 U U) 0f 0 iadd drop", [...zero, ...if_else_unr, ...f32, ...zero, i add, drop]); 102 run(I, "(if 0 U U) 0f 0 iadd drop", [...zero, ...if_else_unr, ...f32, ...zero, i add, drop]);
95 run(I, "(block U) 0f 0 iadd drop", [...block_unr, ...f32, ...zero, iadd, drop]); 103 run(I, "(block U) 0f 0 iadd drop", [...block_unr, ...f32, ...zero, iadd, drop]);
96 run(I, "(loop U) 0f 0 iadd drop", [...loop_unr, ...f32, ...zero, iadd, drop]); 104 run(I, "(loop U) 0f 0 iadd drop", [...loop_unr, ...f32, ...zero, iadd, drop]);
97 run(I, "(block (block U)) 0f 0 iadd drop", [...block_block_unr, ...f32, ...zero, iadd, drop]); 105 run(I, "(block (block U)) 0f 0 iadd drop", [...block_block_unr, ...f32, ...zero, iadd, drop]);
98 106
99 run(V, "0f U iadd drop", [...f32, unr, iadd, drop]); 107 run(V, '0f U iadd drop', [...f32, unr, iadd, drop]);
100 run(V, "0f 0 U iadd drop", [...f32, ...zero, unr, iadd, drop]); 108 run(V, '0f 0 U iadd drop', [...f32, ...zero, unr, iadd, drop]);
101 run(I, "0f 0 (block U) iadd drop", [...f32, ...zero, ...block_unr, iadd, drop]); 109 run(I, "0f 0 (block U) iadd drop", [...f32, ...zero, ...block_unr, iadd, drop]);
102 run(V, "0f U 0 iadd drop", [...f32, unr, ...zero, iadd, drop]); 110 run(V, '0f U 0 iadd drop', [...f32, unr, ...zero, iadd, drop]);
103 run(I, "0 U 0f iadd drop", [...zero, unr, ...zero, ...f32, iadd, drop]); 111 run(I, "0 U 0f iadd drop", [...zero, unr, ...zero, ...f32, iadd, drop]);
104 run(I, "0f (block U) 0 iadd drop", [...f32, ...block_unr, ...zero, iadd, drop]); 112 run(I, "0f (block U) 0 iadd drop", [...f32, ...block_unr, ...zero, iadd, drop]);
105 run(I, "0 (block U) 0f iadd drop", [...zero, ...block_unr, ...f32, iadd, drop]); 113 run(I, "0 (block U) 0f iadd drop", [...zero, ...block_unr, ...f32, iadd, drop]);
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-wasm-breakpoints.cc ('k') | test/unittests/wasm/function-body-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698