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

Unified Diff: src/scopes.h

Issue 1404793004: Add support for calculating a scopes maximum nested context chain. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 2 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/interpreter/bytecode-generator.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 26c092fe3e4d16f8dfbd86eaf172710c645e2123..16581d776f09355a099645170a69ce53bb0c18e1 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -341,7 +341,12 @@ class Scope: public ZoneObject {
bool is_nonlinear() const { return scope_nonlinear_; }
// Whether this needs to be represented by a runtime context.
- bool NeedsContext() const { return num_heap_slots() > 0; }
+ bool NeedsContext() const {
+ // Catch and module scopes always have heap slots.
+ DCHECK(!is_catch_scope() || num_heap_slots() > 0);
+ DCHECK(!is_module_scope() || num_heap_slots() > 0);
+ return is_with_scope() || num_heap_slots() > 0;
+ }
bool NeedsHomeObject() const {
return scope_uses_super_property_ ||
@@ -519,6 +524,10 @@ class Scope: public ZoneObject {
// The number of contexts between this and scope; zero if this == scope.
int ContextChainLength(Scope* scope);
+ // The maximum number of nested contexts required for this scope and any inner
+ // scopes.
+ int MaxNestedContextChainLength();
+
// Find the first function, script, eval or (declaration) block scope. This is
// the scope where var declarations will be hoisted to in the implementation.
Scope* DeclarationScope();
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698