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/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 | 15 |
16 class AstNumberingVisitor FINAL : public AstVisitor { | 16 class AstNumberingVisitor FINAL : public AstVisitor { |
17 public: | 17 public: |
18 explicit AstNumberingVisitor(Zone* zone) | 18 explicit AstNumberingVisitor(Zone* zone) |
19 : AstVisitor(), next_id_(BailoutId::FirstUsable().ToInt()) { | 19 : AstVisitor(), |
| 20 next_id_(BailoutId::FirstUsable().ToInt()), |
| 21 dont_crankshaft_reason_(kNoReason), |
| 22 dont_turbofan_reason_(kNoReason) { |
20 InitializeAstVisitor(zone); | 23 InitializeAstVisitor(zone); |
21 } | 24 } |
22 | 25 |
23 void Renumber(FunctionLiteral* node); | 26 void Renumber(FunctionLiteral* node); |
24 | 27 |
25 private: | 28 private: |
26 // AST node visitor interface. | 29 // AST node visitor interface. |
27 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; | 30 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; |
28 AST_NODE_LIST(DEFINE_VISIT) | 31 AST_NODE_LIST(DEFINE_VISIT) |
29 #undef DEFINE_VISIT | 32 #undef DEFINE_VISIT |
30 | 33 |
31 void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; | 34 void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; |
32 void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE; | 35 void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE; |
33 void VisitArguments(ZoneList<Expression*>* arguments); | 36 void VisitArguments(ZoneList<Expression*>* arguments); |
34 void VisitObjectLiteralProperty(ObjectLiteralProperty* property); | 37 void VisitObjectLiteralProperty(ObjectLiteralProperty* property); |
35 | 38 |
36 int ReserveIdRange(int n) { | 39 int ReserveIdRange(int n) { |
37 int tmp = next_id_; | 40 int tmp = next_id_; |
38 next_id_ += n; | 41 next_id_ += n; |
39 return tmp; | 42 return tmp; |
40 } | 43 } |
41 | 44 |
42 void IncrementNodeCount() { properties_.add_node_count(1); } | 45 void IncrementNodeCount() { properties_.add_node_count(1); } |
| 46 void DisableCrankshaft(BailoutReason reason) { |
| 47 dont_crankshaft_reason_ = reason; |
| 48 properties_.flags()->Add(kDontSelfOptimize); |
| 49 } |
| 50 // TODO(turbofan): Remove the dont_turbofan_reason once no nodes are |
| 51 // DontTurbofanNode. That set of nodes must be kept in sync with |
| 52 // Pipeline::GenerateCode. |
| 53 void DisableTurbofan(BailoutReason reason) { |
| 54 dont_crankshaft_reason_ = reason; |
| 55 dont_turbofan_reason_ = reason; |
| 56 DisableSelfOptimization(); |
| 57 } |
| 58 void DisableSelfOptimization() { |
| 59 properties_.flags()->Add(kDontSelfOptimize); |
| 60 } |
| 61 void DisableCaching(BailoutReason reason) { |
| 62 dont_crankshaft_reason_ = reason; |
| 63 DisableSelfOptimization(); |
| 64 properties_.flags()->Add(kDontCache); |
| 65 } |
| 66 |
| 67 BailoutReason dont_optimize_reason() const { |
| 68 return (dont_turbofan_reason_ != kNoReason) ? dont_turbofan_reason_ |
| 69 : dont_crankshaft_reason_; |
| 70 } |
43 | 71 |
44 int next_id_; | 72 int next_id_; |
45 AstProperties properties_; | 73 AstProperties properties_; |
| 74 BailoutReason dont_crankshaft_reason_; |
| 75 BailoutReason dont_turbofan_reason_; |
46 | 76 |
47 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 77 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
48 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); | 78 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); |
49 }; | 79 }; |
50 | 80 |
51 | 81 |
52 void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) { | 82 void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) { |
53 IncrementNodeCount(); | 83 IncrementNodeCount(); |
54 VisitVariableProxy(node->proxy()); | 84 VisitVariableProxy(node->proxy()); |
55 } | 85 } |
56 | 86 |
57 | 87 |
58 void AstNumberingVisitor::VisitExportDeclaration(ExportDeclaration* node) { | 88 void AstNumberingVisitor::VisitExportDeclaration(ExportDeclaration* node) { |
59 IncrementNodeCount(); | 89 IncrementNodeCount(); |
| 90 DisableCrankshaft(kExportDeclaration); |
60 VisitVariableProxy(node->proxy()); | 91 VisitVariableProxy(node->proxy()); |
61 } | 92 } |
62 | 93 |
63 | 94 |
64 void AstNumberingVisitor::VisitModuleUrl(ModuleUrl* node) { | 95 void AstNumberingVisitor::VisitModuleUrl(ModuleUrl* node) { |
65 IncrementNodeCount(); | 96 IncrementNodeCount(); |
| 97 DisableCrankshaft(kModuleUrl); |
66 } | 98 } |
67 | 99 |
68 | 100 |
69 void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) { | 101 void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) { |
70 IncrementNodeCount(); | 102 IncrementNodeCount(); |
71 } | 103 } |
72 | 104 |
73 | 105 |
74 void AstNumberingVisitor::VisitContinueStatement(ContinueStatement* node) { | 106 void AstNumberingVisitor::VisitContinueStatement(ContinueStatement* node) { |
75 IncrementNodeCount(); | 107 IncrementNodeCount(); |
76 } | 108 } |
77 | 109 |
78 | 110 |
79 void AstNumberingVisitor::VisitBreakStatement(BreakStatement* node) { | 111 void AstNumberingVisitor::VisitBreakStatement(BreakStatement* node) { |
80 IncrementNodeCount(); | 112 IncrementNodeCount(); |
81 } | 113 } |
82 | 114 |
83 | 115 |
84 void AstNumberingVisitor::VisitDebuggerStatement(DebuggerStatement* node) { | 116 void AstNumberingVisitor::VisitDebuggerStatement(DebuggerStatement* node) { |
85 IncrementNodeCount(); | 117 IncrementNodeCount(); |
| 118 DisableCrankshaft(kDebuggerStatement); |
86 node->set_base_id(ReserveIdRange(DebuggerStatement::num_ids())); | 119 node->set_base_id(ReserveIdRange(DebuggerStatement::num_ids())); |
87 } | 120 } |
88 | 121 |
89 | 122 |
90 void AstNumberingVisitor::VisitNativeFunctionLiteral( | 123 void AstNumberingVisitor::VisitNativeFunctionLiteral( |
91 NativeFunctionLiteral* node) { | 124 NativeFunctionLiteral* node) { |
92 IncrementNodeCount(); | 125 IncrementNodeCount(); |
| 126 DisableCrankshaft(kNativeFunctionLiteral); |
93 node->set_base_id(ReserveIdRange(NativeFunctionLiteral::num_ids())); | 127 node->set_base_id(ReserveIdRange(NativeFunctionLiteral::num_ids())); |
94 } | 128 } |
95 | 129 |
96 | 130 |
97 void AstNumberingVisitor::VisitLiteral(Literal* node) { | 131 void AstNumberingVisitor::VisitLiteral(Literal* node) { |
98 IncrementNodeCount(); | 132 IncrementNodeCount(); |
99 node->set_base_id(ReserveIdRange(Literal::num_ids())); | 133 node->set_base_id(ReserveIdRange(Literal::num_ids())); |
100 } | 134 } |
101 | 135 |
102 | 136 |
103 void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) { | 137 void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) { |
104 IncrementNodeCount(); | 138 IncrementNodeCount(); |
105 node->set_base_id(ReserveIdRange(RegExpLiteral::num_ids())); | 139 node->set_base_id(ReserveIdRange(RegExpLiteral::num_ids())); |
106 } | 140 } |
107 | 141 |
108 | 142 |
109 void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) { | 143 void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) { |
110 IncrementNodeCount(); | 144 IncrementNodeCount(); |
| 145 if (node->var()->IsLookupSlot()) { |
| 146 DisableCrankshaft(kReferenceToAVariableWhichRequiresDynamicLookup); |
| 147 } |
111 node->set_base_id(ReserveIdRange(VariableProxy::num_ids())); | 148 node->set_base_id(ReserveIdRange(VariableProxy::num_ids())); |
112 } | 149 } |
113 | 150 |
114 | 151 |
115 void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) { | 152 void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) { |
116 IncrementNodeCount(); | 153 IncrementNodeCount(); |
117 node->set_base_id(ReserveIdRange(ThisFunction::num_ids())); | 154 node->set_base_id(ReserveIdRange(ThisFunction::num_ids())); |
118 } | 155 } |
119 | 156 |
120 | 157 |
121 void AstNumberingVisitor::VisitSuperReference(SuperReference* node) { | 158 void AstNumberingVisitor::VisitSuperReference(SuperReference* node) { |
122 IncrementNodeCount(); | 159 IncrementNodeCount(); |
| 160 DisableTurbofan(kSuperReference); |
123 node->set_base_id(ReserveIdRange(SuperReference::num_ids())); | 161 node->set_base_id(ReserveIdRange(SuperReference::num_ids())); |
124 Visit(node->this_var()); | 162 Visit(node->this_var()); |
125 } | 163 } |
126 | 164 |
127 | 165 |
128 void AstNumberingVisitor::VisitModuleDeclaration(ModuleDeclaration* node) { | 166 void AstNumberingVisitor::VisitModuleDeclaration(ModuleDeclaration* node) { |
129 IncrementNodeCount(); | 167 IncrementNodeCount(); |
| 168 DisableCrankshaft(kModuleDeclaration); |
130 VisitVariableProxy(node->proxy()); | 169 VisitVariableProxy(node->proxy()); |
131 Visit(node->module()); | 170 Visit(node->module()); |
132 } | 171 } |
133 | 172 |
134 | 173 |
135 void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) { | 174 void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) { |
136 IncrementNodeCount(); | 175 IncrementNodeCount(); |
| 176 DisableCrankshaft(kImportDeclaration); |
137 VisitVariableProxy(node->proxy()); | 177 VisitVariableProxy(node->proxy()); |
138 Visit(node->module()); | 178 Visit(node->module()); |
139 } | 179 } |
140 | 180 |
141 | 181 |
142 void AstNumberingVisitor::VisitModuleVariable(ModuleVariable* node) { | 182 void AstNumberingVisitor::VisitModuleVariable(ModuleVariable* node) { |
143 IncrementNodeCount(); | 183 IncrementNodeCount(); |
| 184 DisableCrankshaft(kModuleVariable); |
144 Visit(node->proxy()); | 185 Visit(node->proxy()); |
145 } | 186 } |
146 | 187 |
147 | 188 |
148 void AstNumberingVisitor::VisitModulePath(ModulePath* node) { | 189 void AstNumberingVisitor::VisitModulePath(ModulePath* node) { |
149 IncrementNodeCount(); | 190 IncrementNodeCount(); |
| 191 DisableCrankshaft(kModulePath); |
150 Visit(node->module()); | 192 Visit(node->module()); |
151 } | 193 } |
152 | 194 |
153 | 195 |
154 void AstNumberingVisitor::VisitModuleStatement(ModuleStatement* node) { | 196 void AstNumberingVisitor::VisitModuleStatement(ModuleStatement* node) { |
155 IncrementNodeCount(); | 197 IncrementNodeCount(); |
| 198 DisableCrankshaft(kModuleStatement); |
156 Visit(node->body()); | 199 Visit(node->body()); |
157 } | 200 } |
158 | 201 |
159 | 202 |
160 void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) { | 203 void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) { |
161 IncrementNodeCount(); | 204 IncrementNodeCount(); |
162 Visit(node->expression()); | 205 Visit(node->expression()); |
163 } | 206 } |
164 | 207 |
165 | 208 |
166 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { | 209 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { |
167 IncrementNodeCount(); | 210 IncrementNodeCount(); |
168 Visit(node->expression()); | 211 Visit(node->expression()); |
169 } | 212 } |
170 | 213 |
171 | 214 |
172 void AstNumberingVisitor::VisitYield(Yield* node) { | 215 void AstNumberingVisitor::VisitYield(Yield* node) { |
173 IncrementNodeCount(); | 216 IncrementNodeCount(); |
| 217 DisableCrankshaft(kYield); |
174 node->set_base_id(ReserveIdRange(Yield::num_ids())); | 218 node->set_base_id(ReserveIdRange(Yield::num_ids())); |
175 Visit(node->generator_object()); | 219 Visit(node->generator_object()); |
176 Visit(node->expression()); | 220 Visit(node->expression()); |
177 } | 221 } |
178 | 222 |
179 | 223 |
180 void AstNumberingVisitor::VisitThrow(Throw* node) { | 224 void AstNumberingVisitor::VisitThrow(Throw* node) { |
181 IncrementNodeCount(); | 225 IncrementNodeCount(); |
182 node->set_base_id(ReserveIdRange(Throw::num_ids())); | 226 node->set_base_id(ReserveIdRange(Throw::num_ids())); |
183 Visit(node->exception()); | 227 Visit(node->exception()); |
(...skipping 24 matching lines...) Expand all Loading... |
208 | 252 |
209 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { | 253 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { |
210 IncrementNodeCount(); | 254 IncrementNodeCount(); |
211 VisitVariableProxy(node->proxy()); | 255 VisitVariableProxy(node->proxy()); |
212 VisitFunctionLiteral(node->fun()); | 256 VisitFunctionLiteral(node->fun()); |
213 } | 257 } |
214 | 258 |
215 | 259 |
216 void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) { | 260 void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) { |
217 IncrementNodeCount(); | 261 IncrementNodeCount(); |
| 262 DisableCaching(kModuleLiteral); |
218 VisitBlock(node->body()); | 263 VisitBlock(node->body()); |
219 } | 264 } |
220 | 265 |
221 | 266 |
222 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { | 267 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { |
223 IncrementNodeCount(); | 268 IncrementNodeCount(); |
| 269 if (node->is_jsruntime()) { |
| 270 // Don't try to optimize JS runtime calls because we bailout on them. |
| 271 DisableCrankshaft(kCallToAJavaScriptRuntimeFunction); |
| 272 } |
224 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); | 273 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); |
225 VisitArguments(node->arguments()); | 274 VisitArguments(node->arguments()); |
226 } | 275 } |
227 | 276 |
228 | 277 |
229 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { | 278 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { |
230 IncrementNodeCount(); | 279 IncrementNodeCount(); |
| 280 DisableCrankshaft(kWithStatement); |
231 Visit(node->expression()); | 281 Visit(node->expression()); |
232 Visit(node->statement()); | 282 Visit(node->statement()); |
233 } | 283 } |
234 | 284 |
235 | 285 |
236 void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) { | 286 void AstNumberingVisitor::VisitDoWhileStatement(DoWhileStatement* node) { |
237 IncrementNodeCount(); | 287 IncrementNodeCount(); |
| 288 DisableSelfOptimization(); |
238 node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids())); | 289 node->set_base_id(ReserveIdRange(DoWhileStatement::num_ids())); |
239 Visit(node->body()); | 290 Visit(node->body()); |
240 Visit(node->cond()); | 291 Visit(node->cond()); |
241 } | 292 } |
242 | 293 |
243 | 294 |
244 void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) { | 295 void AstNumberingVisitor::VisitWhileStatement(WhileStatement* node) { |
245 IncrementNodeCount(); | 296 IncrementNodeCount(); |
| 297 DisableSelfOptimization(); |
246 node->set_base_id(ReserveIdRange(WhileStatement::num_ids())); | 298 node->set_base_id(ReserveIdRange(WhileStatement::num_ids())); |
247 Visit(node->cond()); | 299 Visit(node->cond()); |
248 Visit(node->body()); | 300 Visit(node->body()); |
249 } | 301 } |
250 | 302 |
251 | 303 |
252 void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) { | 304 void AstNumberingVisitor::VisitTryCatchStatement(TryCatchStatement* node) { |
253 IncrementNodeCount(); | 305 IncrementNodeCount(); |
| 306 DisableTurbofan(kTryCatchStatement); |
254 Visit(node->try_block()); | 307 Visit(node->try_block()); |
255 Visit(node->catch_block()); | 308 Visit(node->catch_block()); |
256 } | 309 } |
257 | 310 |
258 | 311 |
259 void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) { | 312 void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) { |
260 IncrementNodeCount(); | 313 IncrementNodeCount(); |
| 314 DisableTurbofan(kTryFinallyStatement); |
261 Visit(node->try_block()); | 315 Visit(node->try_block()); |
262 Visit(node->finally_block()); | 316 Visit(node->finally_block()); |
263 } | 317 } |
264 | 318 |
265 | 319 |
266 void AstNumberingVisitor::VisitProperty(Property* node) { | 320 void AstNumberingVisitor::VisitProperty(Property* node) { |
267 IncrementNodeCount(); | 321 IncrementNodeCount(); |
268 node->set_base_id(ReserveIdRange(Property::num_ids())); | 322 node->set_base_id(ReserveIdRange(Property::num_ids())); |
269 Visit(node->key()); | 323 Visit(node->key()); |
270 Visit(node->obj()); | 324 Visit(node->obj()); |
(...skipping 20 matching lines...) Expand all Loading... |
291 void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) { | 345 void AstNumberingVisitor::VisitCompareOperation(CompareOperation* node) { |
292 IncrementNodeCount(); | 346 IncrementNodeCount(); |
293 node->set_base_id(ReserveIdRange(CompareOperation::num_ids())); | 347 node->set_base_id(ReserveIdRange(CompareOperation::num_ids())); |
294 Visit(node->left()); | 348 Visit(node->left()); |
295 Visit(node->right()); | 349 Visit(node->right()); |
296 } | 350 } |
297 | 351 |
298 | 352 |
299 void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) { | 353 void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) { |
300 IncrementNodeCount(); | 354 IncrementNodeCount(); |
| 355 DisableSelfOptimization(); |
301 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); | 356 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); |
302 Visit(node->each()); | 357 Visit(node->each()); |
303 Visit(node->enumerable()); | 358 Visit(node->enumerable()); |
304 Visit(node->body()); | 359 Visit(node->body()); |
305 } | 360 } |
306 | 361 |
307 | 362 |
308 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { | 363 void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) { |
309 IncrementNodeCount(); | 364 IncrementNodeCount(); |
| 365 DisableTurbofan(kForOfStatement); |
310 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); | 366 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); |
311 Visit(node->assign_iterator()); | 367 Visit(node->assign_iterator()); |
312 Visit(node->next_result()); | 368 Visit(node->next_result()); |
313 Visit(node->result_done()); | 369 Visit(node->result_done()); |
314 Visit(node->assign_each()); | 370 Visit(node->assign_each()); |
315 Visit(node->body()); | 371 Visit(node->body()); |
316 } | 372 } |
317 | 373 |
318 | 374 |
319 void AstNumberingVisitor::VisitConditional(Conditional* node) { | 375 void AstNumberingVisitor::VisitConditional(Conditional* node) { |
(...skipping 30 matching lines...) Expand all Loading... |
350 void AstNumberingVisitor::VisitCaseClause(CaseClause* node) { | 406 void AstNumberingVisitor::VisitCaseClause(CaseClause* node) { |
351 IncrementNodeCount(); | 407 IncrementNodeCount(); |
352 node->set_base_id(ReserveIdRange(CaseClause::num_ids())); | 408 node->set_base_id(ReserveIdRange(CaseClause::num_ids())); |
353 if (!node->is_default()) Visit(node->label()); | 409 if (!node->is_default()) Visit(node->label()); |
354 VisitStatements(node->statements()); | 410 VisitStatements(node->statements()); |
355 } | 411 } |
356 | 412 |
357 | 413 |
358 void AstNumberingVisitor::VisitForStatement(ForStatement* node) { | 414 void AstNumberingVisitor::VisitForStatement(ForStatement* node) { |
359 IncrementNodeCount(); | 415 IncrementNodeCount(); |
| 416 DisableSelfOptimization(); |
360 node->set_base_id(ReserveIdRange(ForStatement::num_ids())); | 417 node->set_base_id(ReserveIdRange(ForStatement::num_ids())); |
361 if (node->init() != NULL) Visit(node->init()); | 418 if (node->init() != NULL) Visit(node->init()); |
362 if (node->cond() != NULL) Visit(node->cond()); | 419 if (node->cond() != NULL) Visit(node->cond()); |
363 if (node->next() != NULL) Visit(node->next()); | 420 if (node->next() != NULL) Visit(node->next()); |
364 Visit(node->body()); | 421 Visit(node->body()); |
365 } | 422 } |
366 | 423 |
367 | 424 |
368 void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) { | 425 void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) { |
369 IncrementNodeCount(); | 426 IncrementNodeCount(); |
| 427 DisableTurbofan(kClassLiteral); |
370 node->set_base_id(ReserveIdRange(ClassLiteral::num_ids())); | 428 node->set_base_id(ReserveIdRange(ClassLiteral::num_ids())); |
371 if (node->extends()) Visit(node->extends()); | 429 if (node->extends()) Visit(node->extends()); |
372 if (node->constructor()) Visit(node->constructor()); | 430 if (node->constructor()) Visit(node->constructor()); |
373 for (int i = 0; i < node->properties()->length(); i++) { | 431 for (int i = 0; i < node->properties()->length(); i++) { |
374 VisitObjectLiteralProperty(node->properties()->at(i)); | 432 VisitObjectLiteralProperty(node->properties()->at(i)); |
375 } | 433 } |
376 } | 434 } |
377 | 435 |
378 | 436 |
379 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { | 437 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 518 |
461 Scope* scope = node->scope(); | 519 Scope* scope = node->scope(); |
462 VisitDeclarations(scope->declarations()); | 520 VisitDeclarations(scope->declarations()); |
463 if (scope->is_function_scope() && scope->function() != NULL) { | 521 if (scope->is_function_scope() && scope->function() != NULL) { |
464 // Visit the name of the named function expression. | 522 // Visit the name of the named function expression. |
465 Visit(scope->function()); | 523 Visit(scope->function()); |
466 } | 524 } |
467 VisitStatements(node->body()); | 525 VisitStatements(node->body()); |
468 | 526 |
469 node->set_ast_properties(&properties_); | 527 node->set_ast_properties(&properties_); |
| 528 node->set_dont_optimize_reason(dont_optimize_reason()); |
470 } | 529 } |
471 | 530 |
472 | 531 |
473 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { | 532 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { |
474 AstNumberingVisitor visitor(zone); | 533 AstNumberingVisitor visitor(zone); |
475 visitor.Renumber(function); | 534 visitor.Renumber(function); |
476 return !visitor.HasStackOverflow(); | 535 return !visitor.HasStackOverflow(); |
477 } | 536 } |
478 } | 537 } |
479 } // namespace v8::internal | 538 } // namespace v8::internal |
OLD | NEW |