Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: src/ast/scopes.cc

Issue 2220293003: Remove two more special cases from Scope::MustAllocate(Variable*) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 0336c3e809fe40149dea3511f81fe5fc8f55bf7b..f9b5a8a5eeae83fb56da967575fae149d4887b4c 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -1302,7 +1302,7 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy,
} else if (outer_scope_ != nullptr && this != max_outer_scope) {
var = outer_scope_->LookupRecursive(proxy, binding_kind, factory,
max_outer_scope);
- if (*binding_kind == BOUND && (is_function_scope() || is_with_scope())) {
+ if (*binding_kind == BOUND && is_function_scope()) {
var->ForceContextAllocation();
}
} else {
@@ -1321,7 +1321,11 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy,
// the associated variable has to be marked as potentially being accessed
// from inside of an inner with scope (the property may not be in the 'with'
// object).
- if (var != NULL && proxy->is_assigned()) var->set_maybe_assigned();
+ if (var != NULL) {
+ var->set_is_used();
+ var->ForceContextAllocation();
+ if (proxy->is_assigned()) var->set_maybe_assigned();
+ }
*binding_kind = DYNAMIC_LOOKUP;
return NULL;
} else if (calls_sloppy_eval() && is_declaration_scope() &&
@@ -1487,12 +1491,12 @@ bool Scope::MustAllocate(Variable* var) {
// via an eval() call. This is only possible if the variable has a
// visible name.
if ((var->is_this() || !var->raw_name()->IsEmpty()) &&
- (var->has_forced_context_allocation() || scope_calls_eval_ ||
- inner_scope_calls_eval_ || is_catch_scope() || is_block_scope() ||
+ (scope_calls_eval_ || inner_scope_calls_eval_ || is_catch_scope() ||
is_script_scope())) {
var->set_is_used();
if (scope_calls_eval_ || inner_scope_calls_eval_) var->set_maybe_assigned();
}
+ DCHECK(!var->has_forced_context_allocation() || var->is_used());
// Global variables do not need to be allocated.
return !var->IsGlobalObjectProperty() && var->is_used();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698