| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_SCOPES_H_ | 5 #ifndef V8_SCOPES_H_ |
| 6 #define V8_SCOPES_H_ | 6 #define V8_SCOPES_H_ |
| 7 | 7 |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/pending-compilation-error-handler.h" | 9 #include "src/pending-compilation-error-handler.h" |
| 10 #include "src/zone.h" | 10 #include "src/zone.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // Whether this needs to be represented by a runtime context. | 350 // Whether this needs to be represented by a runtime context. |
| 351 bool NeedsContext() const { | 351 bool NeedsContext() const { |
| 352 // Catch and module scopes always have heap slots. | 352 // Catch and module scopes always have heap slots. |
| 353 DCHECK(!is_catch_scope() || num_heap_slots() > 0); | 353 DCHECK(!is_catch_scope() || num_heap_slots() > 0); |
| 354 DCHECK(!is_module_scope() || num_heap_slots() > 0); | 354 DCHECK(!is_module_scope() || num_heap_slots() > 0); |
| 355 return is_with_scope() || num_heap_slots() > 0; | 355 return is_with_scope() || num_heap_slots() > 0; |
| 356 } | 356 } |
| 357 | 357 |
| 358 bool NeedsHomeObject() const { | 358 bool NeedsHomeObject() const { |
| 359 return scope_uses_super_property_ || | 359 return scope_uses_super_property_ || |
| 360 (scope_calls_eval_ && (IsConciseMethod(function_kind()) || | 360 ((scope_calls_eval_ || inner_scope_calls_eval_) && |
| 361 IsAccessorFunction(function_kind()) || | 361 (IsConciseMethod(function_kind()) || |
| 362 IsClassConstructor(function_kind()))); | 362 IsAccessorFunction(function_kind()) || |
| 363 IsClassConstructor(function_kind()))); |
| 363 } | 364 } |
| 364 | 365 |
| 365 const Scope* NearestOuterEvalScope() const { | 366 const Scope* NearestOuterEvalScope() const { |
| 366 if (is_eval_scope()) return this; | 367 if (is_eval_scope()) return this; |
| 367 if (outer_scope() == nullptr) return nullptr; | 368 if (outer_scope() == nullptr) return nullptr; |
| 368 return outer_scope()->NearestOuterEvalScope(); | 369 return outer_scope()->NearestOuterEvalScope(); |
| 369 } | 370 } |
| 370 | 371 |
| 371 // --------------------------------------------------------------------------- | 372 // --------------------------------------------------------------------------- |
| 372 // Accessors. | 373 // Accessors. |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 | 841 |
| 841 // For tracking which classes are declared consecutively. Needed for strong | 842 // For tracking which classes are declared consecutively. Needed for strong |
| 842 // mode. | 843 // mode. |
| 843 int class_declaration_group_start_; | 844 int class_declaration_group_start_; |
| 844 }; | 845 }; |
| 845 | 846 |
| 846 } // namespace internal | 847 } // namespace internal |
| 847 } // namespace v8 | 848 } // namespace v8 |
| 848 | 849 |
| 849 #endif // V8_SCOPES_H_ | 850 #endif // V8_SCOPES_H_ |
| OLD | NEW |