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

Side by Side Diff: src/scopes.h

Issue 1154103005: Refactor lexical home object binding (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase 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 unified diff | Download patch
« no previous file with comments | « src/ppc/full-codegen-ppc.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
422 Variable* this_function_var() const { 412 Variable* this_function_var() const {
423 // This is only used in derived constructors atm. 413 // This is only used in derived constructors atm.
424 DCHECK(this_function_ == nullptr || 414 DCHECK(this_function_ == nullptr ||
425 (is_function_scope() && IsSubclassConstructor(function_kind()))); 415 (is_function_scope() && (IsConstructor(function_kind()) ||
416 IsConciseMethod(function_kind()) ||
417 IsAccessorFunction(function_kind()))));
426 return this_function_; 418 return this_function_;
427 } 419 }
428 420
429 // Declarations list. 421 // Declarations list.
430 ZoneList<Declaration*>* declarations() { return &decls_; } 422 ZoneList<Declaration*>* declarations() { return &decls_; }
431 423
432 // Inner scope list. 424 // Inner scope list.
433 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } 425 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; }
434 426
435 // The scope immediately surrounding this scope, or NULL. 427 // The scope immediately surrounding this scope, or NULL.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 // Declarations. 569 // Declarations.
578 ZoneList<Declaration*> decls_; 570 ZoneList<Declaration*> decls_;
579 // Convenience variable. 571 // Convenience variable.
580 Variable* receiver_; 572 Variable* receiver_;
581 // Function variable, if any; function scopes only. 573 // Function variable, if any; function scopes only.
582 VariableDeclaration* function_; 574 VariableDeclaration* function_;
583 // new.target variable, function scopes only. 575 // new.target variable, function scopes only.
584 Variable* new_target_; 576 Variable* new_target_;
585 // Convenience variable; function scopes only. 577 // Convenience variable; function scopes only.
586 Variable* arguments_; 578 Variable* arguments_;
587 // Convenience variable; method scopes only.
588 Variable* home_object_;
589 // Convenience variable; Subclass constructor only 579 // Convenience variable; Subclass constructor only
590 Variable* this_function_; 580 Variable* this_function_;
591 // Module descriptor; module scopes only. 581 // Module descriptor; module scopes only.
592 ModuleDescriptor* module_descriptor_; 582 ModuleDescriptor* module_descriptor_;
593 583
594 // Illegal redeclaration. 584 // Illegal redeclaration.
595 Expression* illegal_redecl_; 585 Expression* illegal_redecl_;
596 586
597 // Scope-specific information computed during parsing. 587 // Scope-specific information computed during parsing.
598 // 588 //
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 PendingCompilationErrorHandler pending_error_handler_; 764 PendingCompilationErrorHandler pending_error_handler_;
775 765
776 // For tracking which classes are declared consecutively. Needed for strong 766 // For tracking which classes are declared consecutively. Needed for strong
777 // mode. 767 // mode.
778 int class_declaration_group_start_; 768 int class_declaration_group_start_;
779 }; 769 };
780 770
781 } } // namespace v8::internal 771 } } // namespace v8::internal
782 772
783 #endif // V8_SCOPES_H_ 773 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/ppc/full-codegen-ppc.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698