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

Side by Side Diff: test/mjsunit/wasm/asm-wasm-switch.js

Issue 1830663002: [wasm] Binary 11: AST changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/asm-wasm.js ('k') | test/mjsunit/wasm/calls.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: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 (function TestSwitch0() {
8 function asmModule() {
9 "use asm"
10
11 function caller() {
12 var ret = 0;
13 var x = 7;
14 switch (x) {
15 case 1: {
16 return 0;
17 }
18 case 7: {
19 ret = 5;
20 break;
21 }
22 default: return 0;
23 }
24 return ret|0;
25 }
26
27 return {caller:caller};
28 }
29 var wasm = Wasm.instantiateModuleFromAsm(asmModule.toString());
30 assertEquals(5, wasm.caller());
31 })();
32
7 (function TestSwitch() { 33 (function TestSwitch() {
8 function asmModule() { 34 function asmModule() {
9 "use asm" 35 "use asm"
10 36
11 function caller() { 37 function caller() {
12 var ret = 0; 38 var ret = 0;
13 var x = 7; 39 var x = 7;
14 switch (x) { 40 switch (x) {
15 case 1: return 0; 41 case 1: return 0;
16 case 7: { 42 case 7: {
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 if (k != 56) return "break;"; 459 if (k != 56) return "break;";
434 else return "return 23;"; 460 else return "return 23;";
435 } 461 }
436 wasm = LargeSwitchGenerator(0, 638, 2, handle_case); 462 wasm = LargeSwitchGenerator(0, 638, 2, handle_case);
437 for (var i = 0; i <= 638; i = i + 2) { 463 for (var i = 0; i <= 638; i = i + 2) {
438 if (i == 56) assertEquals(23, wasm.main(i)); 464 if (i == 56) assertEquals(23, wasm.main(i));
439 else assertEquals(-2, wasm.main(i)); 465 else assertEquals(-2, wasm.main(i));
440 } 466 }
441 assertEquals(-1, wasm.main(-1)); 467 assertEquals(-1, wasm.main(-1));
442 })(); 468 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/asm-wasm.js ('k') | test/mjsunit/wasm/calls.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698