Chromium Code Reviews| Index: test/mjsunit/ignition/debug-step-mixed-stack.js |
| diff --git a/test/mjsunit/ignition/debug-step-mixed-stack.js b/test/mjsunit/ignition/debug-step-mixed-stack.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a4404c9b4798d0bdef7434016082d0a241252f3f |
| --- /dev/null |
| +++ b/test/mjsunit/ignition/debug-step-mixed-stack.js |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 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: --expose-debug-as debug --allow-natives-syntax |
|
jgruber
2016/08/12 12:51:34
Would it be possible to add --ignition-staging her
Yang
2016/08/12 13:27:23
We have test variants that explicitly include --ig
|
| + |
| +Debug = debug.Debug |
| + |
| +var exception = null; |
| +var frame_depth = 11; |
| +var break_point; |
|
jgruber
2016/08/12 12:51:34
This appears to be unused.
Yang
2016/08/12 13:27:23
Removed.
|
| + |
| +function listener(event, exec_state, event_data, data) { |
| + if (event != Debug.DebugEvent.Break) return; |
| + try { |
| + assertEquals(frame_depth, exec_state.frameCount()); |
| + assertTrue(/\/\/ Break$/.test(exec_state.frame(0).sourceLineText())); |
| + assertEquals(12 - frame_depth, exec_state.frame(0).evaluate("x").value()); |
| + if (frame_depth > 2) exec_state.prepareStep(Debug.StepAction.StepOut); |
| + frame_depth--; |
| + } catch (e) { |
| + exception = e; |
| + print(e + e.stack); |
| + } |
| +} |
| + |
| +function ChooseCode(f, x) { |
| + switch (x % 2) { |
| + case 0: |
| + %BaselineFunctionOnNextCall(f); |
| + break; |
| + case 1: |
| + %InterpretFunctionOnNextCall(f); |
| + break; |
| + } |
| +} |
| + |
| +function factorial(x) { |
| + ChooseCode(factorial, x); |
| + if (x == 1) { |
| + debugger; // Break |
| + return 1; |
| + } |
| + var factor = factorial(x - 1); |
| + return x * factor; // Break |
| +} |
| + |
| +Debug.setListener(listener); |
| + |
| +assertEquals(3628800, factorial(10)); |
| + |
| +Debug.setListener(null); |
| +assertNull(exception); |
| +assertEquals(1, frame_depth); |