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 --expose-debug-as debug 6 7 function dbg(x) { 8 debugger; 9 } 10 11 function foo() { 12 arguments[0]; 13 dbg(); 14 } 15 16 function bar() { 17 var t = { a : 1 }; 18 dbg(); 19 return t.a; 20 } 21 22 foo(1); 23 foo(1); 24 bar(1); 25 bar(1); 26 %OptimizeFunctionOnNextCall(foo); 27 %OptimizeFunctionOnNextCall(bar); 28 29 var Debug = debug.Debug; 30 Debug.setListener(function(event, exec_state, event_data, data) { 31 if (event != Debug.DebugEvent.Break) return; 32 for (var i = 0; i < exec_state.frameCount(); i++) { 33 var f = exec_state.frame(i); 34 for (var j = 0; j < f.localCount(); j++) { 35 print("'" + f.localName(j) + "' = " + f.localValue(j).value()); 36 } 37 } 38 }); 39 40 foo(1); 41 bar(1); 42