| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-debug-as debug --turbo-filter=g --allow-natives-syntax | 5 // Flags: --expose-debug-as debug --turbo-filter=g --allow-natives-syntax |
| 6 | 6 |
| 7 // Test that Debug::PrepareForBreakPoints can deal with turbofan code (g) | 7 // Test that Debug::PrepareForBreakPoints can deal with turbofan code (g) |
| 8 // on the stack. Without deoptimization support, we will not be able to | 8 // on the stack. Without deoptimization support, we will not be able to |
| 9 // replace optimized code for g by unoptimized code with debug break slots. | 9 // replace optimized code for g by unoptimized code with debug break slots. |
| 10 // This would cause stepping to fail (V8 issue 3660). | 10 // This would cause stepping to fail (V8 issue 3660). |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 debugger; // Break 0 | 26 debugger; // Break 0 |
| 27 } // Break 1 | 27 } // Break 1 |
| 28 | 28 |
| 29 Debug = debug.Debug; | 29 Debug = debug.Debug; |
| 30 var exception = null; | 30 var exception = null; |
| 31 var break_count = 0; | 31 var break_count = 0; |
| 32 | 32 |
| 33 function listener(event, exec_state, event_data, data) { | 33 function listener(event, exec_state, event_data, data) { |
| 34 if (event != Debug.DebugEvent.Break) return; | 34 if (event != Debug.DebugEvent.Break) return; |
| 35 try { | 35 try { |
| 36 exec_state.prepareStep(Debug.StepAction.StepNext, 1); | 36 exec_state.prepareStep(Debug.StepAction.StepNext); |
| 37 print(exec_state.frame(0).sourceLineText()); | 37 print(exec_state.frame(0).sourceLineText()); |
| 38 var match = exec_state.frame(0).sourceLineText().match(/Break (\d)/); | 38 var match = exec_state.frame(0).sourceLineText().match(/Break (\d)/); |
| 39 assertNotNull(match); | 39 assertNotNull(match); |
| 40 assertEquals(break_count++, parseInt(match[1])); | 40 assertEquals(break_count++, parseInt(match[1])); |
| 41 } catch (e) { | 41 } catch (e) { |
| 42 print(e + e.stack); | 42 print(e + e.stack); |
| 43 exception = e; | 43 exception = e; |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 f(0); | 47 f(0); |
| 48 f(0); | 48 f(0); |
| 49 %OptimizeFunctionOnNextCall(g); | 49 %OptimizeFunctionOnNextCall(g); |
| 50 | 50 |
| 51 Debug.setListener(listener); | 51 Debug.setListener(listener); |
| 52 | 52 |
| 53 f(1); | 53 f(1); |
| 54 | 54 |
| 55 Debug.setListener(null); // Break 9 | 55 Debug.setListener(null); // Break 9 |
| 56 assertNull(exception); | 56 assertNull(exception); |
| 57 assertEquals(10, break_count); | 57 assertEquals(10, break_count); |
| OLD | NEW |