OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 public: | 127 public: |
128 #define DECLARE_TYPE_ENUM(type) k##type, | 128 #define DECLARE_TYPE_ENUM(type) k##type, |
129 enum Type { | 129 enum Type { |
130 AST_NODE_LIST(DECLARE_TYPE_ENUM) | 130 AST_NODE_LIST(DECLARE_TYPE_ENUM) |
131 kInvalid = -1 | 131 kInvalid = -1 |
132 }; | 132 }; |
133 #undef DECLARE_TYPE_ENUM | 133 #undef DECLARE_TYPE_ENUM |
134 | 134 |
135 static const int kNoNumber = -1; | 135 static const int kNoNumber = -1; |
136 static const int kFunctionEntryId = 2; // Using 0 could disguise errors. | 136 static const int kFunctionEntryId = 2; // Using 0 could disguise errors. |
| 137 // This AST id identifies the point after the declarations have been |
| 138 // visited. We need it to capture the environment effects of declarations |
| 139 // that emit code (function declarations). |
| 140 static const int kDeclarationsId = 3; |
137 | 141 |
138 // Override ZoneObject's new to count allocated AST nodes. | 142 // Override ZoneObject's new to count allocated AST nodes. |
139 void* operator new(size_t size, Zone* zone) { | 143 void* operator new(size_t size, Zone* zone) { |
140 Isolate* isolate = zone->isolate(); | 144 Isolate* isolate = zone->isolate(); |
141 isolate->set_ast_node_count(isolate->ast_node_count() + 1); | 145 isolate->set_ast_node_count(isolate->ast_node_count() + 1); |
142 return zone->New(static_cast<int>(size)); | 146 return zone->New(static_cast<int>(size)); |
143 } | 147 } |
144 | 148 |
145 AstNode() {} | 149 AstNode() {} |
146 | 150 |
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 | 2257 |
2254 private: | 2258 private: |
2255 Isolate* isolate_; | 2259 Isolate* isolate_; |
2256 bool stack_overflow_; | 2260 bool stack_overflow_; |
2257 }; | 2261 }; |
2258 | 2262 |
2259 | 2263 |
2260 } } // namespace v8::internal | 2264 } } // namespace v8::internal |
2261 | 2265 |
2262 #endif // V8_AST_H_ | 2266 #endif // V8_AST_H_ |
OLD | NEW |