Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: cherry-pick 09de996 from V8 upstream #11905

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 6
#define V8_BUILD_NUMBER 326
#define V8_PATCH_LEVEL 56
#define V8_PATCH_LEVEL 57

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/parsing/parser-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -5008,7 +5008,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseSwitchStatement(

{
BlockState cases_block_state(zone(), &scope_state_);
cases_block_state.set_start_position(scanner()->location().beg_pos);
cases_block_state.set_start_position(switch_pos);
cases_block_state.SetNonlinear();
typename Types::Target target(this, switch_statement);

Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/parsing/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,10 @@ Statement* Parser::RewriteSwitchStatement(Expression* tag,
Block* cases_block = factory()->NewBlock(NULL, 1, false, kNoSourcePosition);
cases_block->statements()->Add(switch_statement, zone());
cases_block->set_scope(scope);
DCHECK_IMPLIES(scope != nullptr,
switch_statement->position() >= scope->start_position());
DCHECK_IMPLIES(scope != nullptr,
switch_statement->position() < scope->end_position());
switch_block->statements()->Add(cases_block, zone());
return switch_block;
}
Expand Down
49 changes: 49 additions & 0 deletions deps/v8/test/debugger/regress/regress-6085.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2017 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.

function* serialize() {
debugger;
switch (0) {
case 0:
let x = 1;
return x; // Check scopes
}
}

let exception = null;
let step_count = 0;
let scopes_checked = false;

function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
if (exec_state.frame().sourceLineText().includes("Check scopes")) {
let expected = [ debug.ScopeType.Block,
debug.ScopeType.Local,
debug.ScopeType.Script,
debug.ScopeType.Global ];
for (let i = 0; i < exec_state.frame().scopeCount(); i++) {
assertEquals(expected[i], exec_state.frame().scope(i).scopeType());
}
scopes_checked = true;
}
if (step_count++ < 3) exec_state.prepareStep(Debug.StepAction.StepNext);
} catch (e) {
exception = e;
print(e, e.stack);
}
}



let Debug = debug.Debug;
Debug.setListener(listener);

let gen = serialize();
gen.next();

Debug.setListener(null);
assertNull(exception);
assertEquals(4, step_count);
assertTrue(scopes_checked);