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: --expose-debug-as debug --allow-natives-syntax --use-inlining 6 7var Debug = debug.Debug; 8 9function f1() { 10 return 1; 11} 12 13function f2() { 14 return 2; 15} 16 17function f3() { 18 return f1(); 19} 20 21function f4() { 22 return 4; 23} 24 25 26function optimize(f) { 27 f(); 28 f(); 29 %OptimizeFunctionOnNextCall(f); 30 f(); 31} 32 33optimize(f1); 34optimize(f2); 35optimize(f3); 36 37Debug.setListener(function() {}); 38 39assertOptimized(f1); 40assertOptimized(f2); 41assertOptimized(f3); 42 43Debug.setBreakPoint(f1, 1); 44 45// Setting break point deoptimizes f1 and f3 (which inlines f1). 46assertUnoptimized(f1); 47assertOptimized(f2); 48assertUnoptimized(f3); 49 50// We can optimize with break points set. 51optimize(f4); 52assertOptimized(f4); 53 54Debug.setListener(null); 55