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

Unified Diff: src/scopes.cc

Issue 1216013002: Parse eagerly inside block scopes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: simplified a lot Created 5 years, 6 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 | « src/scopes.h ('k') | test/mjsunit/regress/regress-4255-1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index 61a75ab16fcf408a0ba79355f4e43d59979564c8..6ec8923721afe8acb8c60457e9c4d19329c72e0d 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -734,6 +734,17 @@ bool Scope::HasLazyCompilableOuterContext() const {
}
+bool Scope::AllowsLazyParsing() const {
+ // If we are inside a block scope, we must parse eagerly to find out how
+ // to allocate variables on the block scope. At this point, declarations may
+ // not have yet been parsed.
+ for (const Scope* scope = this; scope != NULL; scope = scope->outer_scope_) {
+ if (scope->is_block_scope()) return false;
+ }
+ return AllowsLazyCompilation();
+}
+
+
bool Scope::AllowsLazyCompilation() const {
return !force_eager_compilation_ && HasLazyCompilableOuterContext();
}
« no previous file with comments | « src/scopes.h ('k') | test/mjsunit/regress/regress-4255-1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698