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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 if (rest_index_ >= 0) return false; | 402 if (rest_index_ >= 0) return false; |
403 return true; | 403 return true; |
404 } | 404 } |
405 | 405 |
406 // The local variable 'arguments' if we need to allocate it; NULL otherwise. | 406 // The local variable 'arguments' if we need to allocate it; NULL otherwise. |
407 Variable* arguments() const { | 407 Variable* arguments() const { |
408 DCHECK(!is_arrow_scope() || arguments_ == nullptr); | 408 DCHECK(!is_arrow_scope() || arguments_ == nullptr); |
409 return arguments_; | 409 return arguments_; |
410 } | 410 } |
411 | 411 |
| 412 // A local variable to the [[HomeObject]] used by methods if we need to |
| 413 // allocate it; NULL otherwise. |
| 414 Variable* home_object_var() const { |
| 415 DCHECK(home_object_ == nullptr || |
| 416 (is_function_scope() && (IsConciseMethod(function_kind()) || |
| 417 IsAccessorFunction(function_kind()) || |
| 418 IsConstructor(function_kind())))); |
| 419 return home_object_; |
| 420 } |
| 421 |
412 // Declarations list. | 422 // Declarations list. |
413 ZoneList<Declaration*>* declarations() { return &decls_; } | 423 ZoneList<Declaration*>* declarations() { return &decls_; } |
414 | 424 |
415 // Inner scope list. | 425 // Inner scope list. |
416 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } | 426 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } |
417 | 427 |
418 // The scope immediately surrounding this scope, or NULL. | 428 // The scope immediately surrounding this scope, or NULL. |
419 Scope* outer_scope() const { return outer_scope_; } | 429 Scope* outer_scope() const { return outer_scope_; } |
420 | 430 |
421 // The ModuleDescriptor for this scope; only for module scopes. | 431 // The ModuleDescriptor for this scope; only for module scopes. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // Declarations. | 570 // Declarations. |
561 ZoneList<Declaration*> decls_; | 571 ZoneList<Declaration*> decls_; |
562 // Convenience variable. | 572 // Convenience variable. |
563 Variable* receiver_; | 573 Variable* receiver_; |
564 // Function variable, if any; function scopes only. | 574 // Function variable, if any; function scopes only. |
565 VariableDeclaration* function_; | 575 VariableDeclaration* function_; |
566 // new.target variable, function scopes only. | 576 // new.target variable, function scopes only. |
567 Variable* new_target_; | 577 Variable* new_target_; |
568 // Convenience variable; function scopes only. | 578 // Convenience variable; function scopes only. |
569 Variable* arguments_; | 579 Variable* arguments_; |
| 580 // Convenience variable; method scopes only. |
| 581 Variable* home_object_; |
570 // Module descriptor; module scopes only. | 582 // Module descriptor; module scopes only. |
571 ModuleDescriptor* module_descriptor_; | 583 ModuleDescriptor* module_descriptor_; |
572 | 584 |
573 // Illegal redeclaration. | 585 // Illegal redeclaration. |
574 Expression* illegal_redecl_; | 586 Expression* illegal_redecl_; |
575 | 587 |
576 // Scope-specific information computed during parsing. | 588 // Scope-specific information computed during parsing. |
577 // | 589 // |
578 // This scope is inside a 'with' of some outer scope. | 590 // This scope is inside a 'with' of some outer scope. |
579 bool scope_inside_with_; | 591 bool scope_inside_with_; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 PendingCompilationErrorHandler pending_error_handler_; | 765 PendingCompilationErrorHandler pending_error_handler_; |
754 | 766 |
755 // For tracking which classes are declared consecutively. Needed for strong | 767 // For tracking which classes are declared consecutively. Needed for strong |
756 // mode. | 768 // mode. |
757 int class_declaration_group_start_; | 769 int class_declaration_group_start_; |
758 }; | 770 }; |
759 | 771 |
760 } } // namespace v8::internal | 772 } } // namespace v8::internal |
761 | 773 |
762 #endif // V8_SCOPES_H_ | 774 #endif // V8_SCOPES_H_ |
OLD | NEW |