blob: 8a3f91a67a810d52fc79d9094c092ccc97704923 [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5var error = "error";
6function counter(x) {
7 return (function() { if (x-- == 0) throw error;});
8}
9
10function Module() {
11 "use asm";
12
13 function w0(f) {
14 while (1) f();
15 return 108;
16 }
17
18 function w1(f) {
19 if (1) while (1) f();
20 return 109;
21 }
22
23 function w2(f) {
24 if (1) while (1) f();
25 else while (1) f();
26 return 110;
27 }
28
29 function w3(f) {
30 if (0) while (1) f();
31 return 111;
32 }
33
34 return { w0: w0, w1: w1, w2: w2, w3: w3 };
35}
36
37var m = Module();
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000038assertThrowsEquals(function() { m.w0(counter(5)) }, error);
39assertThrowsEquals(function() { m.w1(counter(5)) }, error);
40assertThrowsEquals(function() { m.w2(counter(5)) }, error);
Emily Bernierd0a1eb72015-03-24 16:35:39 -040041assertEquals(111, m.w3(counter(5)));