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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/scopes.h" | 9 #include "src/scopes.h" |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 void AstNumberingVisitor::VisitExportDeclaration(ExportDeclaration* node) { | 102 void AstNumberingVisitor::VisitExportDeclaration(ExportDeclaration* node) { |
103 IncrementNodeCount(); | 103 IncrementNodeCount(); |
104 DisableOptimization(kExportDeclaration); | 104 DisableOptimization(kExportDeclaration); |
105 VisitVariableProxy(node->proxy()); | 105 VisitVariableProxy(node->proxy()); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 void AstNumberingVisitor::VisitModuleUrl(ModuleUrl* node) { | |
110 IncrementNodeCount(); | |
111 DisableOptimization(kModuleUrl); | |
112 } | |
113 | |
114 | |
115 void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) { | 109 void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) { |
116 IncrementNodeCount(); | 110 IncrementNodeCount(); |
117 } | 111 } |
118 | 112 |
119 | 113 |
120 void AstNumberingVisitor::VisitContinueStatement(ContinueStatement* node) { | 114 void AstNumberingVisitor::VisitContinueStatement(ContinueStatement* node) { |
121 IncrementNodeCount(); | 115 IncrementNodeCount(); |
122 } | 116 } |
123 | 117 |
124 | 118 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 166 |
173 void AstNumberingVisitor::VisitSuperReference(SuperReference* node) { | 167 void AstNumberingVisitor::VisitSuperReference(SuperReference* node) { |
174 IncrementNodeCount(); | 168 IncrementNodeCount(); |
175 DisableOptimization(kSuperReference); | 169 DisableOptimization(kSuperReference); |
176 ReserveFeedbackSlots(node); | 170 ReserveFeedbackSlots(node); |
177 node->set_base_id(ReserveIdRange(SuperReference::num_ids())); | 171 node->set_base_id(ReserveIdRange(SuperReference::num_ids())); |
178 Visit(node->this_var()); | 172 Visit(node->this_var()); |
179 } | 173 } |
180 | 174 |
181 | 175 |
182 void AstNumberingVisitor::VisitModuleDeclaration(ModuleDeclaration* node) { | |
183 IncrementNodeCount(); | |
184 DisableOptimization(kModuleDeclaration); | |
185 VisitVariableProxy(node->proxy()); | |
186 Visit(node->module()); | |
187 } | |
188 | |
189 | |
190 void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) { | 176 void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) { |
191 IncrementNodeCount(); | 177 IncrementNodeCount(); |
192 DisableOptimization(kImportDeclaration); | 178 DisableOptimization(kImportDeclaration); |
193 VisitVariableProxy(node->proxy()); | 179 VisitVariableProxy(node->proxy()); |
194 } | 180 } |
195 | 181 |
196 | 182 |
197 void AstNumberingVisitor::VisitModulePath(ModulePath* node) { | |
198 IncrementNodeCount(); | |
199 DisableOptimization(kModulePath); | |
200 Visit(node->module()); | |
201 } | |
202 | |
203 | |
204 void AstNumberingVisitor::VisitModuleStatement(ModuleStatement* node) { | |
205 IncrementNodeCount(); | |
206 DisableOptimization(kModuleStatement); | |
207 Visit(node->body()); | |
208 } | |
209 | |
210 | |
211 void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) { | 183 void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) { |
212 IncrementNodeCount(); | 184 IncrementNodeCount(); |
213 Visit(node->expression()); | 185 Visit(node->expression()); |
214 } | 186 } |
215 | 187 |
216 | 188 |
217 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { | 189 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { |
218 IncrementNodeCount(); | 190 IncrementNodeCount(); |
219 Visit(node->expression()); | 191 Visit(node->expression()); |
220 } | 192 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 231 } |
260 | 232 |
261 | 233 |
262 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { | 234 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { |
263 IncrementNodeCount(); | 235 IncrementNodeCount(); |
264 VisitVariableProxy(node->proxy()); | 236 VisitVariableProxy(node->proxy()); |
265 VisitFunctionLiteral(node->fun()); | 237 VisitFunctionLiteral(node->fun()); |
266 } | 238 } |
267 | 239 |
268 | 240 |
269 void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) { | |
270 IncrementNodeCount(); | |
271 DisableCaching(kModuleLiteral); | |
272 VisitBlock(node->body()); | |
273 } | |
274 | |
275 | |
276 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { | 241 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { |
277 IncrementNodeCount(); | 242 IncrementNodeCount(); |
278 ReserveFeedbackSlots(node); | 243 ReserveFeedbackSlots(node); |
279 if (node->is_jsruntime()) { | 244 if (node->is_jsruntime()) { |
280 // Don't try to optimize JS runtime calls because we bailout on them. | 245 // Don't try to optimize JS runtime calls because we bailout on them. |
281 DisableOptimization(kCallToAJavaScriptRuntimeFunction); | 246 DisableOptimization(kCallToAJavaScriptRuntimeFunction); |
282 } | 247 } |
283 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); | 248 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); |
284 VisitArguments(node->arguments()); | 249 VisitArguments(node->arguments()); |
285 } | 250 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } | 524 } |
560 | 525 |
561 | 526 |
562 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 527 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
563 FunctionLiteral* function) { | 528 FunctionLiteral* function) { |
564 AstNumberingVisitor visitor(isolate, zone); | 529 AstNumberingVisitor visitor(isolate, zone); |
565 return visitor.Renumber(function); | 530 return visitor.Renumber(function); |
566 } | 531 } |
567 } | 532 } |
568 } // namespace v8::internal | 533 } // namespace v8::internal |
OLD | NEW |