| 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_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
| 6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 // | 656 // |
| 657 // This scope is inside a 'with' of some outer scope. | 657 // This scope is inside a 'with' of some outer scope. |
| 658 bool scope_inside_with_; | 658 bool scope_inside_with_; |
| 659 // This scope or a nested catch scope or with scope contain an 'eval' call. At | 659 // This scope or a nested catch scope or with scope contain an 'eval' call. At |
| 660 // the 'eval' call site this scope is the declaration scope. | 660 // the 'eval' call site this scope is the declaration scope. |
| 661 bool scope_calls_eval_; | 661 bool scope_calls_eval_; |
| 662 // This scope uses "arguments". | 662 // This scope uses "arguments". |
| 663 bool scope_uses_arguments_; | 663 bool scope_uses_arguments_; |
| 664 // This scope uses "super" property ('super.foo'). | 664 // This scope uses "super" property ('super.foo'). |
| 665 bool scope_uses_super_property_; | 665 bool scope_uses_super_property_; |
| 666 // This scope has a parameter called "arguments". |
| 667 bool has_arguments_parameter_; |
| 666 // This scope contains an "use asm" annotation. | 668 // This scope contains an "use asm" annotation. |
| 667 bool asm_module_; | 669 bool asm_module_; |
| 668 // This scope's outer context is an asm module. | 670 // This scope's outer context is an asm module. |
| 669 bool asm_function_; | 671 bool asm_function_; |
| 670 // This scope's declarations might not be executed in order (e.g., switch). | 672 // This scope's declarations might not be executed in order (e.g., switch). |
| 671 bool scope_nonlinear_; | 673 bool scope_nonlinear_; |
| 672 // The language mode of this scope. | 674 // The language mode of this scope. |
| 673 LanguageMode language_mode_; | 675 LanguageMode language_mode_; |
| 674 // Source positions. | 676 // Source positions. |
| 675 int start_position_; | 677 int start_position_; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 MUST_USE_RESULT | 770 MUST_USE_RESULT |
| 769 bool ResolveVariablesRecursively(ParseInfo* info, AstNodeFactory* factory); | 771 bool ResolveVariablesRecursively(ParseInfo* info, AstNodeFactory* factory); |
| 770 | 772 |
| 771 // Scope analysis. | 773 // Scope analysis. |
| 772 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); | 774 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); |
| 773 bool HasTrivialContext() const; | 775 bool HasTrivialContext() const; |
| 774 | 776 |
| 775 // Predicates. | 777 // Predicates. |
| 776 bool MustAllocate(Variable* var); | 778 bool MustAllocate(Variable* var); |
| 777 bool MustAllocateInContext(Variable* var); | 779 bool MustAllocateInContext(Variable* var); |
| 778 bool HasArgumentsParameter(Isolate* isolate); | |
| 779 | 780 |
| 780 // Variable allocation. | 781 // Variable allocation. |
| 781 void AllocateStackSlot(Variable* var); | 782 void AllocateStackSlot(Variable* var); |
| 782 void AllocateHeapSlot(Variable* var); | 783 void AllocateHeapSlot(Variable* var); |
| 783 void AllocateParameterLocals(Isolate* isolate); | 784 void AllocateParameterLocals(); |
| 784 void AllocateNonParameterLocal(Isolate* isolate, Variable* var); | 785 void AllocateNonParameterLocal(Variable* var); |
| 785 void AllocateDeclaredGlobal(Isolate* isolate, Variable* var); | 786 void AllocateDeclaredGlobal(Variable* var); |
| 786 void AllocateNonParameterLocalsAndDeclaredGlobals(Isolate* isolate); | 787 void AllocateNonParameterLocalsAndDeclaredGlobals(); |
| 787 void AllocateVariablesRecursively(Isolate* isolate); | 788 void AllocateVariablesRecursively(); |
| 788 void AllocateParameter(Variable* var, int index); | 789 void AllocateParameter(Variable* var, int index); |
| 789 void AllocateReceiver(); | 790 void AllocateReceiver(); |
| 790 | 791 |
| 791 // Resolve and fill in the allocation information for all variables | 792 // Resolve and fill in the allocation information for all variables |
| 792 // in this scopes. Must be called *after* all scopes have been | 793 // in this scopes. Must be called *after* all scopes have been |
| 793 // processed (parsed) to ensure that unresolved variables can be | 794 // processed (parsed) to ensure that unresolved variables can be |
| 794 // resolved properly. | 795 // resolved properly. |
| 795 // | 796 // |
| 796 // In the case of code compiled and run using 'eval', the context | 797 // In the case of code compiled and run using 'eval', the context |
| 797 // parameter is the context in which eval was called. In all other | 798 // parameter is the context in which eval was called. In all other |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 AstValueFactory* ast_value_factory_; | 832 AstValueFactory* ast_value_factory_; |
| 832 Zone* zone_; | 833 Zone* zone_; |
| 833 | 834 |
| 834 PendingCompilationErrorHandler pending_error_handler_; | 835 PendingCompilationErrorHandler pending_error_handler_; |
| 835 }; | 836 }; |
| 836 | 837 |
| 837 } // namespace internal | 838 } // namespace internal |
| 838 } // namespace v8 | 839 } // namespace v8 |
| 839 | 840 |
| 840 #endif // V8_AST_SCOPES_H_ | 841 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |