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
7function dbg(x) {
8  debugger;
9}
10
11function foo() {
12  arguments[0];
13  dbg();
14}
15
16function bar() {
17  var t = { a : 1 };
18  dbg();
19  return t.a;
20}
21
22foo(1);
23foo(1);
24bar(1);
25bar(1);
26%OptimizeFunctionOnNextCall(foo);
27%OptimizeFunctionOnNextCall(bar);
28
29var Debug = debug.Debug;
30Debug.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
40foo(1);
41bar(1);
42