MCPcopy Index your code
hub / github.com/nodejs/node / RunTest

Function RunTest

deps/v8/test/debugger/debug/es6/generators-relocation.js:13–46  ·  view source on GitHub ↗
(formals_and_body, args, value1, value2)

Source from the content-addressed store, hash-verified

11}
12
13function RunTest(formals_and_body, args, value1, value2) {
14 // A null listener. It isn't important what the listener does.
15 function listener(event, exec_state, event_data, data) {
16 }
17
18 // Create the generator function outside a debugging context. It will probably
19 // be lazily compiled.
20 var gen = (function*(){}).constructor.apply(null, formals_and_body);
21
22 // Instantiate the generator object.
23 var obj = gen.apply(null, args);
24
25 // Advance to the first yield.
26 assertIteratorResult(value1, false, obj.next());
27
28 // Enable the debugger, which should force recompilation of the generator
29 // function and relocation of the suspended generator activation.
30 Debug.setListener(listener);
31
32 gc();
33
34 // Add a breakpoint on line 3 (the second yield).
35 var bp = Debug.setBreakPoint(gen, 3);
36
37 // Check that the generator resumes and suspends properly.
38 assertIteratorResult(value2, false, obj.next());
39
40 // Disable debugger -- should not force recompilation.
41 Debug.clearBreakPoint(bp);
42 Debug.setListener(null);
43
44 // Run to completion.
45 assertIteratorResult(undefined, true, obj.next());
46}
47
48function prog(a, b, c) {
49 return a + ';\n' + 'yield ' + b + ';\n' + 'yield ' + c;

Callers 1

Calls 7

setListenerMethod · 0.80
setBreakPointMethod · 0.80
clearBreakPointMethod · 0.80
assertIteratorResultFunction · 0.70
nextMethod · 0.65
gcFunction · 0.50
applyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…