Commit 5e6f91e7 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Make LookupRecursive less recursive

Recursion is really only useful for sloppy eval and with scopes, which are
uncommon.

Change-Id: I2560b600cab9b00a82d5837a3daa28c8d38c2959
Reviewed-on: https://chromium-review.googlesource.com/c/1322451Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57316}
parent 4001f86a
......@@ -32,8 +32,7 @@ void Scope::ResolveScopesThenForEachVariable(DeclarationScope* max_outer_scope,
next = proxy->next_unresolved();
DCHECK(!proxy->is_resolved());
Variable* var =
lookup->LookupRecursive(info, proxy, max_outer_scope->outer_scope());
Variable* var = Lookup(info, proxy, lookup, max_outer_scope->outer_scope());
if (var == nullptr) {
variable_proxy_stackvisitor(proxy);
} else if (var != Scope::kDummyPreParserVariable &&
......
This diff is collapsed.
......@@ -592,8 +592,15 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
// scope, and stopping when reaching the outer_scope_end scope. If the code is
// executed because of a call to 'eval', the context parameter should be set
// to the calling context of 'eval'.
Variable* LookupRecursive(ParseInfo* info, VariableProxy* proxy,
Scope* outer_scope_end);
static Variable* Lookup(ParseInfo* info, VariableProxy* proxy, Scope* scope,
Scope* outer_scope_end,
bool force_context_allocation = false);
static Variable* LookupWith(ParseInfo* info, VariableProxy* proxy,
Scope* scope, Scope* outer_scope_end,
bool force_context_allocation);
static Variable* LookupSloppyEval(ParseInfo* info, VariableProxy* proxy,
Scope* scope, Scope* outer_scope_end,
bool force_context_allocation);
void ResolveTo(ParseInfo* info, VariableProxy* proxy, Variable* var);
V8_WARN_UNUSED_RESULT bool ResolveVariable(ParseInfo* info,
VariableProxy* proxy);
......
// Copyright 2018 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() { with ({}) { return (()=>this)() } }
var o = {}
assertEquals(o, f.call(o))
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