| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 return static_cast<AstRawString*>(variables_.Start()->key); | 334 return static_cast<AstRawString*>(variables_.Start()->key); |
| 335 } | 335 } |
| 336 | 336 |
| 337 // --------------------------------------------------------------------------- | 337 // --------------------------------------------------------------------------- |
| 338 // Variable allocation. | 338 // Variable allocation. |
| 339 | 339 |
| 340 // Collect variables in this scope. Note that the function variable - if | 340 // Collect variables in this scope. Note that the function variable - if |
| 341 // present - is not collected and should be handled separately. | 341 // present - is not collected and should be handled separately. |
| 342 void CollectVariables(ZoneList<Variable*>* stack_locals, | 342 void CollectVariables(ZoneList<Variable*>* stack_locals, |
| 343 ZoneList<Variable*>* context_locals, | 343 ZoneList<Variable*>* context_locals, |
| 344 ZoneList<Variable*>* context_globals); | 344 ZoneList<Variable*>* context_globals, |
| 345 ZoneList<Variable*>* module_vars = nullptr); |
| 345 | 346 |
| 346 // Result of variable allocation. | 347 // Result of variable allocation. |
| 347 int num_stack_slots() const { return num_stack_slots_; } | 348 int num_stack_slots() const { return num_stack_slots_; } |
| 348 int num_heap_slots() const { return num_heap_slots_; } | 349 int num_heap_slots() const { return num_heap_slots_; } |
| 349 int num_global_slots() const { return num_global_slots_; } | 350 int num_global_slots() const { return num_global_slots_; } |
| 350 | 351 |
| 351 int StackLocalCount() const; | 352 int StackLocalCount() const; |
| 352 int ContextLocalCount() const; | 353 int ContextLocalCount() const; |
| 353 int ContextGlobalCount() const; | 354 int ContextGlobalCount() const; |
| 354 | 355 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 // Convenience variable; function scopes only. | 832 // Convenience variable; function scopes only. |
| 832 Variable* arguments_; | 833 Variable* arguments_; |
| 833 // Convenience variable; Subclass constructor only | 834 // Convenience variable; Subclass constructor only |
| 834 Variable* this_function_; | 835 Variable* this_function_; |
| 835 }; | 836 }; |
| 836 | 837 |
| 837 class ModuleScope final : public DeclarationScope { | 838 class ModuleScope final : public DeclarationScope { |
| 838 public: | 839 public: |
| 839 ModuleScope(DeclarationScope* script_scope, | 840 ModuleScope(DeclarationScope* script_scope, |
| 840 AstValueFactory* ast_value_factory); | 841 AstValueFactory* ast_value_factory); |
| 842 ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info, |
| 843 AstValueFactory* ast_value_factory); |
| 841 | 844 |
| 842 ModuleDescriptor* module() const { | 845 ModuleDescriptor* module() const { |
| 843 DCHECK_NOT_NULL(module_descriptor_); | 846 DCHECK_NOT_NULL(module_descriptor_); |
| 844 return module_descriptor_; | 847 return module_descriptor_; |
| 845 } | 848 } |
| 846 | 849 |
| 847 // Set MODULE as VariableLocation for all variables that will live in some | 850 // Set MODULE as VariableLocation for all variables that will live in some |
| 848 // module's export table. | 851 // module's export table. |
| 849 void AllocateModuleVariables(); | 852 void AllocateModuleVariables(); |
| 850 | 853 |
| 851 private: | 854 private: |
| 852 ModuleDescriptor* module_descriptor_; | 855 ModuleDescriptor* module_descriptor_; |
| 853 }; | 856 }; |
| 854 | 857 |
| 855 } // namespace internal | 858 } // namespace internal |
| 856 } // namespace v8 | 859 } // namespace v8 |
| 857 | 860 |
| 858 #endif // V8_AST_SCOPES_H_ | 861 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |