Chromium Code Reviews| 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; |
|
adamk
2015/10/15 07:38:45
The other callers of NeedsContext() only call it o
rmcilroy
2015/10/15 09:23:07
I could do this, however personally I think it is
adamk
2015/10/15 09:34:32
What I'm saying is that testing "is_with_scope()"
rmcilroy
2015/10/15 14:06:16
Acknowledged.
|
| + } |
| 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(); |