45a8167477
This is a quick fix for the hole leaking from generators via the debugger's frame inspection feature: when collecting the arguments, convert each hole to undefined. In the long term, we probably want to remember and restore the actual arguments rather than pushing these dummy arguments on each resume. BUG=v8:5164 Review-Url: https://codereview.chromium.org/2122923003 Cr-Commit-Position: refs/heads/master@{#37544}
45 lines
924 B
JavaScript
45 lines
924 B
JavaScript
// 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
|
|
|
|
var failure = null;
|
|
var args;
|
|
|
|
function listener(event, exec_state, event_data, data) {
|
|
if (event != debug.Debug.DebugEvent.Break) return;
|
|
try {
|
|
args = exec_state.frame(0).evaluate('arguments').value();
|
|
} catch (e) {
|
|
failure = e;
|
|
}
|
|
}
|
|
|
|
debug.Debug.setListener(listener);
|
|
|
|
function* gen(a, b) {
|
|
debugger;
|
|
yield a;
|
|
yield b;
|
|
}
|
|
|
|
var foo = gen(1, 2);
|
|
|
|
foo.next()
|
|
assertEquals(2, args.length);
|
|
assertEquals(undefined, args[0]);
|
|
assertEquals(undefined, args[1]);
|
|
|
|
foo.next()
|
|
assertEquals(2, args.length);
|
|
assertEquals(undefined, args[0]);
|
|
assertEquals(undefined, args[1]);
|
|
|
|
foo.next()
|
|
assertEquals(2, args.length);
|
|
assertEquals(undefined, args[0]);
|
|
assertEquals(undefined, args[1]);
|
|
|
|
assertNull(failure);
|