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

Side by Side Diff: test/debugger/debug/es6/generators-relocation.js

Issue 2476303003: Revert of [debugger] Migrate more debugger tests to inspector (Closed)
Patch Set: Created 4 years, 1 month 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 | « test/debugger/debug/es6/debug-stepout-tailcalls.js ('k') | test/debugger/debug/for-in-opt.js » ('j') | 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 2014 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
6 var Debug = debug.Debug;
7
8 function assertIteratorResult(value, done, result) {
9 assertEquals({value: value, done: done}, result);
10 }
11
12 function RunTest(formals_and_body, args, value1, value2) {
13 // A null listener. It isn't important what the listener does.
14 function listener(event, exec_state, event_data, data) {
15 }
16
17 // Create the generator function outside a debugging context. It will probably
18 // be lazily compiled.
19 var gen = (function*(){}).constructor.apply(null, formals_and_body);
20
21 // Instantiate the generator object.
22 var obj = gen.apply(null, args);
23
24 // Advance to the first yield.
25 assertIteratorResult(value1, false, obj.next());
26
27 // Enable the debugger, which should force recompilation of the generator
28 // function and relocation of the suspended generator activation.
29 Debug.setListener(listener);
30
31 // Add a breakpoint on line 3 (the second yield).
32 var bp = Debug.setBreakPoint(gen, 3);
33
34 // Check that the generator resumes and suspends properly.
35 assertIteratorResult(value2, false, obj.next());
36
37 // Disable debugger -- should not force recompilation.
38 Debug.clearBreakPoint(bp);
39 Debug.setListener(null);
40
41 // Run to completion.
42 assertIteratorResult(undefined, true, obj.next());
43 }
44
45 function prog(a, b, c) {
46 return a + ';\n' + 'yield ' + b + ';\n' + 'yield ' + c;
47 }
48
49 // Simple empty local scope.
50 RunTest([prog('', '1', '2')], [], 1, 2);
51
52 RunTest([prog('for (;;) break', '1', '2')], [], 1, 2);
53
54 RunTest([prog('while (0) foo()', '1', '2')], [], 1, 2);
55
56 RunTest(['a', prog('var x = 3', 'a', 'x')], [1], 1, 3);
57
58 RunTest(['a', prog('', '1', '2')], [42], 1, 2);
59
60 RunTest(['a', prog('for (;;) break', '1', '2')], [42], 1, 2);
OLDNEW
« no previous file with comments | « test/debugger/debug/es6/debug-stepout-tailcalls.js ('k') | test/debugger/debug/for-in-opt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698