deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / test / mjsunit / compiler / osr-forin-nested.js
1 // Copyright 2015 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: --turbo-osr --allow-natives-syntax
6
7 function test(e, f, v) {
8   assertEquals(e, f(v));
9   assertEquals(e, f(v));
10   assertEquals(e, f(v));
11 }
12
13 function foo(t) {
14   for (var x in t) {
15     for (var i = 0; i < 2; i++) {
16       %OptimizeOsr();
17     }
18   }
19   return 5;
20 }
21
22 test(5, foo, {x:20});
23
24 function bar(t) {
25   var sum = 0;
26   for (var x in t) {
27     for (var i = 0; i < 2; i++) {
28       %OptimizeOsr();
29       sum += t[x];
30     }
31   }
32   return sum;
33 }
34
35 test(62, bar, {x:20,y:11});