OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 function f() { |
| 6 debugger; |
| 7 return 1; |
| 8 } |
| 9 |
| 10 function g() { |
| 11 return f(); |
| 12 } // Break |
| 13 |
| 14 function h() { |
| 15 return g(); |
| 16 } |
| 17 |
| 18 h(); |
| 19 h(); |
| 20 |
| 21 var Debug = debug.Debug; |
| 22 var step_count = 0; |
| 23 var exception = null; |
| 24 |
| 25 function listener(event, exec_state, event_data, data) { |
| 26 if (event != Debug.DebugEvent.Break) return; |
| 27 try { |
| 28 if (step_count == 0) { |
| 29 exec_state.prepareStep(Debug.StepAction.StepOut); |
| 30 } else { |
| 31 assertTrue(exec_state.frame().sourceLineText().includes('Break')); |
| 32 } |
| 33 step_count++; |
| 34 } catch (e) { |
| 35 exception = e; |
| 36 print(e); |
| 37 } |
| 38 } |
| 39 |
| 40 Debug.setListener(listener); |
| 41 % OptimizeFunctionOnNextCall(h); |
| 42 h(); |
| 43 Debug.setListener(null); |
| 44 assertNull(exception); |
| 45 assertEquals(2, step_count); |
OLD | NEW |