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

Side by Side Diff: test/mjsunit/es6/debug-stepout-tailcalls.js

Issue 1839043002: [debugger] add test case for stepping out from tail calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 // Flags: --expose-debug-as debug --harmony-tailcalls
6
7 "use strict";
8
9 var Debug = debug.Debug
10 var exception = null;
11 var breaks = 0;
12
13 function f(x) {
14 if (x > 0) {
15 return f(x - 1); // Tail call
16 }
17 debugger; // Break 0
18 }
19
20 function g(x) {
21 return f(x); // Tail call
22 }
23
24 function h(x) {
25 g(x); // Not tail call
26 } // Break 1
27
28
29 function listener(event, exec_state, event_data, data) {
30 if (event != Debug.DebugEvent.Break) return;
31 try {
32 assertTrue(event_data.sourceLineText().indexOf(`Break ${breaks++}`) > 0);
33 exec_state.prepareStep(Debug.StepAction.StepOut);
34 } catch (e) {
35 exception = e;
36 };
37 };
38
39 Debug.setListener(listener);
40
41 h(3);
42
43 Debug.setListener(null); // Break 2
44 assertNull(exception);
45 assertEquals(3, breaks);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698