Commit f6ee3b5f authored by leszeks's avatar leszeks Committed by Commit bot

[ignition] Fix hole check for dynamic local variables

The fast-path for dynamic local variables was previously checking the
lookup variable rather than the shadowed variable when deciding whether
to add a hole check.

BUG=669540

Review-Url: https://codereview.chromium.org/2551023004
Cr-Commit-Position: refs/heads/master@{#41677}
parent b5a9381a
......@@ -1690,6 +1690,15 @@ void Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy) {
namespace {
bool AccessNeedsHoleCheck(Variable* var, VariableProxy* proxy, Scope* scope) {
if (var->mode() == DYNAMIC_LOCAL) {
// Dynamically introduced variables never need a hole check (since they're
// VAR bindings, either from var or function declarations), but the variable
// they shadow might need a hole check, which we want to do if we decide
// that no shadowing variable was dynamically introoduced.
DCHECK(!var->binding_needs_init());
return AccessNeedsHoleCheck(var->local_if_not_shadowed(), proxy, scope);
}
if (!var->binding_needs_init()) {
return false;
}
......
// 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.
function f({
[
(function g() {
assertThrows(function(){
print(eval("p"));
}, ReferenceError);
})()
]: p
}) {};
f({});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment