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: --allow-natives-syntax --function-context-specialization 6 // Flags: --turbo-filter=f 7 8 (function() { 9 "use strict"; 10 var a = 23; 11 function f() { 12 for (let i = 0; i < 5; ++i) { 13 a--; // Make sure {a} is non-immutable, hence context allocated. 14 function g() { return i } // Make sure block has a context. 15 if (i == 2) %OptimizeOsr(); 16 } 17 return a; 18 } 19 assertEquals(18, f()); 20 })(); 21