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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 IncrementNodeCount(); | 217 IncrementNodeCount(); |
218 node->set_base_id(ReserveIdRange(UnaryOperation::num_ids())); | 218 node->set_base_id(ReserveIdRange(UnaryOperation::num_ids())); |
219 Visit(node->expression()); | 219 Visit(node->expression()); |
220 } | 220 } |
221 | 221 |
222 | 222 |
223 void AstNumberingVisitor::VisitCountOperation(CountOperation* node) { | 223 void AstNumberingVisitor::VisitCountOperation(CountOperation* node) { |
224 IncrementNodeCount(); | 224 IncrementNodeCount(); |
225 node->set_base_id(ReserveIdRange(CountOperation::num_ids())); | 225 node->set_base_id(ReserveIdRange(CountOperation::num_ids())); |
226 Visit(node->expression()); | 226 Visit(node->expression()); |
| 227 ReserveFeedbackSlots(node); |
227 } | 228 } |
228 | 229 |
229 | 230 |
230 void AstNumberingVisitor::VisitBlock(Block* node) { | 231 void AstNumberingVisitor::VisitBlock(Block* node) { |
231 IncrementNodeCount(); | 232 IncrementNodeCount(); |
232 node->set_base_id(ReserveIdRange(Block::num_ids())); | 233 node->set_base_id(ReserveIdRange(Block::num_ids())); |
233 if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations()); | 234 if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations()); |
234 VisitStatements(node->statements()); | 235 VisitStatements(node->statements()); |
235 } | 236 } |
236 | 237 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 428 } |
428 } | 429 } |
429 | 430 |
430 | 431 |
431 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { | 432 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { |
432 IncrementNodeCount(); | 433 IncrementNodeCount(); |
433 node->set_base_id(ReserveIdRange(node->num_ids())); | 434 node->set_base_id(ReserveIdRange(node->num_ids())); |
434 for (int i = 0; i < node->properties()->length(); i++) { | 435 for (int i = 0; i < node->properties()->length(); i++) { |
435 VisitObjectLiteralProperty(node->properties()->at(i)); | 436 VisitObjectLiteralProperty(node->properties()->at(i)); |
436 } | 437 } |
| 438 node->BuildConstantProperties(isolate()); |
437 // Mark all computed expressions that are bound to a key that | 439 // Mark all computed expressions that are bound to a key that |
438 // is shadowed by a later occurrence of the same key. For the | 440 // is shadowed by a later occurrence of the same key. For the |
439 // marked expressions, no store code will be is emitted. | 441 // marked expressions, no store code will be is emitted. |
440 node->CalculateEmitStore(zone()); | 442 node->CalculateEmitStore(zone()); |
441 ReserveFeedbackSlots(node); | 443 ReserveFeedbackSlots(node); |
442 } | 444 } |
443 | 445 |
444 | 446 |
445 void AstNumberingVisitor::VisitObjectLiteralProperty( | 447 void AstNumberingVisitor::VisitObjectLiteralProperty( |
446 ObjectLiteralProperty* node) { | 448 ObjectLiteralProperty* node) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 543 } |
542 | 544 |
543 | 545 |
544 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 546 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
545 FunctionLiteral* function) { | 547 FunctionLiteral* function) { |
546 AstNumberingVisitor visitor(isolate, zone); | 548 AstNumberingVisitor visitor(isolate, zone); |
547 return visitor.Renumber(function); | 549 return visitor.Renumber(function); |
548 } | 550 } |
549 } // namespace internal | 551 } // namespace internal |
550 } // namespace v8 | 552 } // namespace v8 |
OLD | NEW |