]>
Commit | Line | Data |
---|---|---|
1 | function foo(array) { | |
2 | var result = 0; | |
3 | for (var i = 0; i != array.length; i += 2) { | |
4 | var element = array[i]; | |
5 | if (element === void 0) | |
6 | break; | |
7 | result += array[i]; | |
8 | } | |
9 | return result; | |
10 | } | |
11 | ||
12 | noInline(foo); | |
13 | ||
14 | var array = [1, 2, 3, 4]; | |
15 | for (var i = 0; i < 10000; ++i) { | |
16 | var result = foo(array); | |
17 | if (result != 4) | |
18 | throw "Error: bad result in loop: " + result; | |
19 | } | |
20 | ||
21 | var array = [1, 2, 3]; | |
22 | var result = foo(array); | |
23 | if (result != 4) | |
24 | throw "Error: bad result at end: " + result; |