| // Copyright 2014 the V8 project authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // Flags: --turbo-filter=g |
| // Test that Debug::PrepareForBreakPoints can deal with turbofan code (g) |
| // on the stack. Without deoptimization support, we will not be able to |
| // replace optimized code for g by unoptimized code with debug break slots. |
| // This would cause stepping to fail (V8 issue 3660). |
| function listener(event, exec_state, event_data, data) { |
| if (event != Debug.DebugEvent.Break) return; |
| exec_state.prepareStep(Debug.StepAction.StepNext); |
| print(exec_state.frame(0).sourceLineText()); |
| var match = exec_state.frame(0).sourceLineText().match(/Break (\d)/); |
| assertEquals(break_count++, parseInt(match[1])); |
| %PrepareFunctionForOptimization(g); |
| %OptimizeFunctionOnNextCall(g); |
| Debug.setListener(listener); |
| Debug.setListener(null); // Break 9 |
| assertEquals(10, break_count); |