blob: edb627a57ba7c505e9e71a6b4e87a43a01a15c7e [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
5// 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 for (var i = 0; i < 2; i++) {
12 while (a > 0) { x += 19; a--; }
13 while (b > 0) { y += 23; b--; }
14 while (c > 0) { z += 29; c--; }
15 }
16 return x + y + z;
17}
18
19function f2(a,b,c) {
20 var x = 0;
21 var y = 0;
22 var z = 0;
23 for (var i = 0; i < 2; i++) {
24 while (a > 0) { x += 19; a--; }
25 while (b > 0) { y += 23; b--; }
26 while (c > 0) { z += 29; c--; }
27 }
28 return x + y + z;
29}
30
31
32function f3(a,b,c) {
33 var x = 0;
34 var y = 0;
35 var z = 0;
36 for (var i = 0; i < 2; i++) {
37 while (a > 0) { x += 19; a--; }
38 while (b > 0) { y += 23; b--; }
39 while (c > 0) { z += 29; c--; }
40 }
41 return x + y + z;
42}
43
44function check(f,a,b,c) {
45 assertEquals(a * 19 + b * 23 + c * 29, f(a,b,c));
46}
47
48check(f1, 50000, 5, 6);
49check(f2, 4, 50000, 6);
50check(f3, 11, 12, 50000);