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

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

Issue 2345233003: [base] Move hashmap allocator to a field (Closed)
Patch Set: Remove zone arguments where the parameters were removed so that the bloody thing compiles again 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/ast.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/base/hashmap.h" 8 #include "src/base/hashmap.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 17 matching lines...) Expand all
28 explicit VariableMap(Zone* zone); 28 explicit VariableMap(Zone* zone);
29 29
30 Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name, 30 Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name,
31 VariableMode mode, VariableKind kind, 31 VariableMode mode, VariableKind kind,
32 InitializationFlag initialization_flag, 32 InitializationFlag initialization_flag,
33 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, 33 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned,
34 bool* added = nullptr); 34 bool* added = nullptr);
35 35
36 Variable* Lookup(const AstRawString* name); 36 Variable* Lookup(const AstRawString* name);
37 void Remove(Variable* var); 37 void Remove(Variable* var);
38 void Add(Zone* zone, Variable* var); 38 void Add(Variable* var);
39 }; 39 };
40 40
41 41
42 // Sloppy block-scoped function declarations to var-bind 42 // Sloppy block-scoped function declarations to var-bind
43 class SloppyBlockFunctionMap : public ZoneHashMap { 43 class SloppyBlockFunctionMap : public ZoneHashMap {
44 public: 44 public:
45 explicit SloppyBlockFunctionMap(Zone* zone); 45 explicit SloppyBlockFunctionMap(Zone* zone);
46 void Declare(Zone* zone, const AstRawString* name, 46 void Declare(const AstRawString* name,
47 SloppyBlockFunctionStatement* statement); 47 SloppyBlockFunctionStatement* statement);
48 }; 48 };
49 49
50 enum class AnalyzeMode { kRegular, kDebugger }; 50 enum class AnalyzeMode { kRegular, kDebugger };
51 51
52 // Global invariants after AST construction: Each reference (i.e. identifier) 52 // Global invariants after AST construction: Each reference (i.e. identifier)
53 // to a JavaScript variable (including global properties) is represented by a 53 // to a JavaScript variable (including global properties) is represented by a
54 // VariableProxy node. Immediately after AST construction and before variable 54 // VariableProxy node. Immediately after AST construction and before variable
55 // allocation, most VariableProxy nodes are "unresolved", i.e. not bound to a 55 // allocation, most VariableProxy nodes are "unresolved", i.e. not bound to a
56 // corresponding variable (though some are bound during parse time). Variable 56 // corresponding variable (though some are bound during parse time). Variable
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 // initializers. 740 // initializers.
741 void AddLocal(Variable* var) { 741 void AddLocal(Variable* var) {
742 DCHECK(!already_resolved_); 742 DCHECK(!already_resolved_);
743 // Temporaries are only placed in ClosureScopes. 743 // Temporaries are only placed in ClosureScopes.
744 DCHECK_EQ(GetClosureScope(), this); 744 DCHECK_EQ(GetClosureScope(), this);
745 locals_.Add(var, zone()); 745 locals_.Add(var, zone());
746 } 746 }
747 747
748 void DeclareSloppyBlockFunction(const AstRawString* name, 748 void DeclareSloppyBlockFunction(const AstRawString* name,
749 SloppyBlockFunctionStatement* statement) { 749 SloppyBlockFunctionStatement* statement) {
750 sloppy_block_function_map_.Declare(zone(), name, statement); 750 sloppy_block_function_map_.Declare(name, statement);
751 } 751 }
752 752
753 // Go through sloppy_block_function_map_ and hoist those (into this scope) 753 // Go through sloppy_block_function_map_ and hoist those (into this scope)
754 // which should be hoisted. 754 // which should be hoisted.
755 void HoistSloppyBlockFunctions(AstNodeFactory* factory); 755 void HoistSloppyBlockFunctions(AstNodeFactory* factory);
756 756
757 SloppyBlockFunctionMap* sloppy_block_function_map() { 757 SloppyBlockFunctionMap* sloppy_block_function_map() {
758 return &sloppy_block_function_map_; 758 return &sloppy_block_function_map_;
759 } 759 }
760 760
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 void AllocateModuleVariables(); 863 void AllocateModuleVariables();
864 864
865 private: 865 private:
866 ModuleDescriptor* module_descriptor_; 866 ModuleDescriptor* module_descriptor_;
867 }; 867 };
868 868
869 } // namespace internal 869 } // namespace internal
870 } // namespace v8 870 } // namespace v8
871 871
872 #endif // V8_AST_SCOPES_H_ 872 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698