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

Side by Side Diff: src/ast/scopes.h

Issue 2275943005: [modules] Minor refactorings in scopes and scopeinfos. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@modules-serialize-entry
Patch Set: Rebase. Created 4 years, 3 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/ast/scopeinfo.cc ('k') | src/ast/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_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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 const AstRawString* catch_variable_name() const { 334 const AstRawString* catch_variable_name() const {
335 DCHECK(is_catch_scope()); 335 DCHECK(is_catch_scope());
336 DCHECK_EQ(1, num_var()); 336 DCHECK_EQ(1, num_var());
337 return static_cast<AstRawString*>(variables_.Start()->key); 337 return static_cast<AstRawString*>(variables_.Start()->key);
338 } 338 }
339 339
340 // --------------------------------------------------------------------------- 340 // ---------------------------------------------------------------------------
341 // Variable allocation. 341 // Variable allocation.
342 342
343 // Collect stack and context allocated local variables in this scope. Note 343 // Collect variables in this scope. Note that the function variable - if
344 // that the function variable - if present - is not collected and should be 344 // present - is not collected and should be handled separately.
345 // handled separately. 345 void CollectVariables(ZoneList<Variable*>* stack_locals,
346 void CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals, 346 ZoneList<Variable*>* context_locals,
347 ZoneList<Variable*>* context_locals, 347 ZoneList<Variable*>* context_globals);
348 ZoneList<Variable*>* context_globals);
349 348
350 // Result of variable allocation. 349 // Result of variable allocation.
351 int num_stack_slots() const { return num_stack_slots_; } 350 int num_stack_slots() const { return num_stack_slots_; }
352 int num_heap_slots() const { return num_heap_slots_; } 351 int num_heap_slots() const { return num_heap_slots_; }
353 int num_global_slots() const { return num_global_slots_; } 352 int num_global_slots() const { return num_global_slots_; }
354 353
355 int StackLocalCount() const; 354 int StackLocalCount() const;
356 int ContextLocalCount() const; 355 int ContextLocalCount() const;
357 int ContextGlobalCount() const; 356 int ContextGlobalCount() const;
358 357
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 // new.target variable, function scopes only. 828 // new.target variable, function scopes only.
830 Variable* new_target_; 829 Variable* new_target_;
831 // Convenience variable; function scopes only. 830 // Convenience variable; function scopes only.
832 Variable* arguments_; 831 Variable* arguments_;
833 // Convenience variable; Subclass constructor only 832 // Convenience variable; Subclass constructor only
834 Variable* this_function_; 833 Variable* this_function_;
835 }; 834 };
836 835
837 class ModuleScope final : public DeclarationScope { 836 class ModuleScope final : public DeclarationScope {
838 public: 837 public:
839 ModuleScope(Zone* zone, DeclarationScope* script_scope, 838 ModuleScope(DeclarationScope* script_scope,
840 AstValueFactory* ast_value_factory); 839 AstValueFactory* ast_value_factory);
841 840
842 ModuleDescriptor* module() const { 841 ModuleDescriptor* module() const {
843 DCHECK_NOT_NULL(module_descriptor_); 842 DCHECK_NOT_NULL(module_descriptor_);
844 return module_descriptor_; 843 return module_descriptor_;
845 } 844 }
846 845
847 // Set MODULE as VariableLocation for all variables that will live in some 846 // Set MODULE as VariableLocation for all variables that will live in some
848 // module's export table. 847 // module's export table.
849 void AllocateModuleVariables(); 848 void AllocateModuleVariables();
850 849
851 private: 850 private:
852 ModuleDescriptor* module_descriptor_; 851 ModuleDescriptor* module_descriptor_;
853 }; 852 };
854 853
855 } // namespace internal 854 } // namespace internal
856 } // namespace v8 855 } // namespace v8
857 856
858 #endif // V8_AST_SCOPES_H_ 857 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « src/ast/scopeinfo.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698