blob: 72fff8546c8c17bc8c13cddc7f89f6b4d17d364e [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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
Ben Murdochc5610432016-08-08 18:44:38 +01005// Flags: --use-osr
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00006
7function f1(a,b,c) {
8 var x = 0;
9 var y = 0;
10 var z = 0;
11 while (a > 0) { x += 19; a--; }
12 while (b > 0) { y += 23; b--; }
13 while (c > 0) { z += 29; c--; }
14 return x + y + z;
15}
16
17function f2(a,b,c) {
18 var x = 0;
19 var y = 0;
20 var z = 0;
21 while (a > 0) { x += 19; a--; }
22 while (b > 0) { y += 23; b--; }
23 while (c > 0) { z += 29; c--; }
24 return x + y + z;
25}
26
27
28function f3(a,b,c) {
29 var x = 0;
30 var y = 0;
31 var z = 0;
32 while (a > 0) { x += 19; a--; }
33 while (b > 0) { y += 23; b--; }
34 while (c > 0) { z += 29; c--; }
35 return x + y + z;
36}
37
38function check(f,a,b,c) {
39 assertEquals(a * 19 + b * 23 + c * 29, f(a,b,c));
40}
41
42check(f1, 50000, 5, 6);
43check(f2, 4, 50000, 6);
44check(f3, 11, 12, 50000);