PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/jaeger/argumentsOptimize-2.js

http://github.com/zpao/v8monkey
JavaScript | 27 lines | 23 code | 4 blank | 0 comment | 4 complexity | 3c827d4184d993a583e9ef4eaabc6043 MD5 | raw file
 1
 2function foo() {
 3  var x = 0;
 4  for (var i = arguments.length - 1; i >= 0; i--)
 5    x += arguments[i];
 6  return x;
 7}
 8
 9function bar() {
10  var x = 0;
11  for (var i = 0; i < arguments.length; i++)
12    x += arguments[i];
13  return x;
14}
15
16function baz(a,b,c,d,e) {
17  var x = 0;
18  for (var i = 0; i < arguments.length; i++)
19    x += arguments[i];
20  return x;
21}
22
23for (var i = 0; i < 10; i++) {
24  assertEq(foo(1,2,3,4,5), 15);
25  assertEq(bar(1,2.5,true,{valueOf:function() { return 10}},"five"), "14.5five");
26  assertEq(baz(1,2,3,4,5), 15);
27}