Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: test/mjsunit/ignition/debug-break-mixed-stack.js

Issue 2246483002: [debugger] add mixed-stack tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/mjsunit/ignition/debug-step-mixed-stack.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/ignition/debug-break-mixed-stack.js
diff --git a/test/mjsunit/ignition/debug-break-mixed-stack.js b/test/mjsunit/ignition/debug-break-mixed-stack.js
new file mode 100644
index 0000000000000000000000000000000000000000..878a918d5c38d8d2f9da6194af6fc7e28df3ca71
--- /dev/null
+++ b/test/mjsunit/ignition/debug-break-mixed-stack.js
@@ -0,0 +1,52 @@
+// 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
+
+Debug = debug.Debug
+
+var exception = null;
+var frame_depth = 10;
+
+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());
+ frame_depth--;
+ } catch (e) {
+ exception = e;
+ print(e + e.stack);
+ }
+}
+
+function ChooseCode(f, x) {
+ if (x == 1) {
+ Debug.setBreakPoint(factorial, 4);
+ }
+ switch (x % 2) {
+ case 0:
+ %BaselineFunctionOnNextCall(f);
+ break;
+ case 1:
+ %InterpretFunctionOnNextCall(f);
+ break;
+ }
+}
+
+function factorial(x) {
+ ChooseCode(factorial, x);
+ if (x == 1) 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);
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/mjsunit/ignition/debug-step-mixed-stack.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698