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

Unified Diff: src/ast/scopes.cc

Issue 2261693002: Dont track scope_inside_with_ explicitly (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Don't duplicate InsideWithScope walk in HasTrivialOuterContext 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
« src/ast/scopes.h ('K') | « src/ast/scopes.h ('k') | 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 417345a5ef8b6ae33969c54126d16c98d5d4188d..63f9b5ddc3acc9b996f52f04800ef055aa54b78b 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -91,7 +91,6 @@ Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type)
force_context_allocation_ =
!is_function_scope() && outer_scope->has_forced_context_allocation();
outer_scope_->AddInnerScope(this);
- scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope();
}
}
@@ -208,7 +207,6 @@ void Scope::SetDefaults() {
set_language_mode(SLOPPY);
- scope_inside_with_ = false;
scope_calls_eval_ = false;
scope_uses_super_property_ = false;
has_arguments_parameter_ = false;
@@ -256,10 +254,6 @@ Scope* Scope::DeserializeScopeChain(Isolate* isolate, Zone* zone,
with_scope->set_is_debug_evaluate_scope();
}
current_scope = with_scope;
- // All the inner scopes are inside a with.
- for (Scope* s = innermost_scope; s != nullptr; s = s->outer_scope()) {
- s->scope_inside_with_ = true;
- }
} else if (context->IsScriptContext()) {
Handle<ScopeInfo> scope_info(context->scope_info(), isolate);
current_scope = new (zone)
@@ -886,7 +880,7 @@ bool Scope::HasTrivialContext() const {
// return true.
for (const Scope* scope = this; scope != NULL; scope = scope->outer_scope_) {
if (scope->is_eval_scope()) return false;
- if (scope->scope_inside_with_) return false;
+ if (scope->InsideWithScope()) return false;
if (scope->ContextLocalCount() > 0) return false;
if (scope->ContextGlobalCount() > 0) return false;
}
@@ -895,12 +889,11 @@ bool Scope::HasTrivialContext() const {
bool Scope::HasTrivialOuterContext() const {
- Scope* outer = outer_scope_;
- if (outer == NULL) return true;
+ if (outer_scope_ == nullptr) return true;
// Note that the outer context may be trivial in general, but the current
// scope may be inside a 'with' statement in which case the outer context
// for this scope is not trivial.
- return !scope_inside_with_ && outer->HasTrivialContext();
+ return !is_with_scope() && outer_scope_->HasTrivialContext();
neis 2016/08/19 14:33:41 Now the code doesn't quite match the comment anymo
Toon Verwaest 2016/08/19 18:00:35 I'll do so in a follow-up
}
@@ -1171,7 +1164,6 @@ void Scope::Print(int n) {
}
if (IsAsmModule()) Indent(n1, "// scope is an asm module\n");
if (IsAsmFunction()) Indent(n1, "// scope is an asm function\n");
- if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
if (scope_uses_super_property_)
Indent(n1, "// scope uses 'super' property\n");
« src/ast/scopes.h ('K') | « src/ast/scopes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698