Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 1 | // 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 | |
| 5 | function Module() { |
| 6 | "use asm"; |
| 7 | |
| 8 | function w0(a) { |
| 9 | a = a | 0; |
| 10 | if (a) while (1); |
| 11 | return 42; |
| 12 | } |
| 13 | |
| 14 | function w1(a) { |
| 15 | a = a | 0; |
| 16 | while (1) return 42; |
| 17 | return 106; |
| 18 | } |
| 19 | |
| 20 | function d0(a) { |
| 21 | a = a | 0; |
| 22 | if (a) do ; while(1); |
| 23 | return 42; |
| 24 | } |
| 25 | |
| 26 | function d1(a) { |
| 27 | a = a | 0; |
| 28 | do return 42; while(1); |
| 29 | return 107; |
| 30 | } |
| 31 | |
| 32 | function f0(a) { |
| 33 | a = a | 0; |
| 34 | if (a) for (;;) ; |
| 35 | return 42; |
| 36 | } |
| 37 | |
| 38 | function f1(a) { |
| 39 | a = a | 0; |
| 40 | for(;;) return 42; |
| 41 | return 108; |
| 42 | } |
| 43 | |
| 44 | return { w0: w0, w1: w1, d0: d0, d1: d1, f0: f0, f1: f1 }; |
| 45 | } |
| 46 | |
| 47 | var m = Module(); |
| 48 | assertEquals(42, m.w0(0)); |
| 49 | assertEquals(42, m.w1(0)); |
| 50 | assertEquals(42, m.d0(0)); |
| 51 | assertEquals(42, m.d1(0)); |
| 52 | assertEquals(42, m.f0(0)); |
| 53 | assertEquals(42, m.f1(0)); |