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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 VariableMap *maps_[3]; | 50 VariableMap *maps_[3]; |
51 }; | 51 }; |
52 | 52 |
53 | 53 |
54 // Sloppy block-scoped function declarations to var-bind | 54 // Sloppy block-scoped function declarations to var-bind |
55 class SloppyBlockFunctionMap : public ZoneHashMap { | 55 class SloppyBlockFunctionMap : public ZoneHashMap { |
56 public: | 56 public: |
57 explicit SloppyBlockFunctionMap(Zone* zone); | 57 explicit SloppyBlockFunctionMap(Zone* zone); |
58 void Declare(Zone* zone, const AstRawString* name, | 58 void Declare(Zone* zone, const AstRawString* name, |
59 SloppyBlockFunctionStatement* statement); | 59 SloppyBlockFunctionStatement* statement); |
60 typedef ZoneVector<SloppyBlockFunctionStatement*> Vector; | |
61 }; | 60 }; |
62 | 61 |
63 | 62 |
64 // Global invariants after AST construction: Each reference (i.e. identifier) | 63 // Global invariants after AST construction: Each reference (i.e. identifier) |
65 // to a JavaScript variable (including global properties) is represented by a | 64 // to a JavaScript variable (including global properties) is represented by a |
66 // VariableProxy node. Immediately after AST construction and before variable | 65 // VariableProxy node. Immediately after AST construction and before variable |
67 // allocation, most VariableProxy nodes are "unresolved", i.e. not bound to a | 66 // allocation, most VariableProxy nodes are "unresolved", i.e. not bound to a |
68 // corresponding variable (though some are bound during parse time). Variable | 67 // corresponding variable (though some are bound during parse time). Variable |
69 // allocation binds each unresolved VariableProxy to one Variable and assigns | 68 // allocation binds each unresolved VariableProxy to one Variable and assigns |
70 // a location. Note that many VariableProxy nodes may refer to the same Java- | 69 // a location. Note that many VariableProxy nodes may refer to the same Java- |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 // Convenience variable; Subclass constructor only | 895 // Convenience variable; Subclass constructor only |
897 Variable* this_function_; | 896 Variable* this_function_; |
898 // Module descriptor; module scopes only. | 897 // Module descriptor; module scopes only. |
899 ModuleDescriptor* module_descriptor_; | 898 ModuleDescriptor* module_descriptor_; |
900 }; | 899 }; |
901 | 900 |
902 } // namespace internal | 901 } // namespace internal |
903 } // namespace v8 | 902 } // namespace v8 |
904 | 903 |
905 #endif // V8_AST_SCOPES_H_ | 904 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |