blob: df4076c411982c7fb6fe9bfdfcca264f69c6068e [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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: --allow-natives-syntax --use-osr --turbo-osr
6
7"use strict";
8
9function foo() {
10 var result;
11 {
12 let sum = 0;
13 for (var i = 0; i < 100; i++) {
14 if (i == 50) %OptimizeOsr();
15 sum += i;
16 }
17 result = ret;
18 function ret() {
19 return sum;
20 }
21 }
22 return result;
23}
24
25assertEquals(4950, foo()());
26assertEquals(4950, foo()());
27assertEquals(4950, foo()());