| 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/ast-numbering.h" | 5 #include "src/ast-numbering.h" |
| 6 | 6 |
| 7 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/scopes.h" | 8 #include "src/scopes.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 void AstNumberingVisitor::VisitProperty(Property* node) { | 342 void AstNumberingVisitor::VisitProperty(Property* node) { |
| 343 VisitPropertyReference(node); | 343 VisitPropertyReference(node); |
| 344 ReserveFeedbackSlots(node); | 344 ReserveFeedbackSlots(node); |
| 345 } | 345 } |
| 346 | 346 |
| 347 | 347 |
| 348 void AstNumberingVisitor::VisitAssignment(Assignment* node) { | 348 void AstNumberingVisitor::VisitAssignment(Assignment* node) { |
| 349 IncrementNodeCount(); | 349 IncrementNodeCount(); |
| 350 node->set_base_id(ReserveIdRange(Assignment::num_ids())); | 350 node->set_base_id(ReserveIdRange(Assignment::num_ids())); |
| 351 |
| 352 AssignmentPattern* pattern = node->target()->AsAssignmentPattern(); |
| 353 if (pattern && pattern->is_rewritten()) { |
| 354 return Visit(pattern->expression()); |
| 355 } |
| 356 |
| 351 if (node->is_compound()) VisitBinaryOperation(node->binary_operation()); | 357 if (node->is_compound()) VisitBinaryOperation(node->binary_operation()); |
| 352 VisitReference(node->target()); | 358 VisitReference(node->target()); |
| 353 Visit(node->value()); | 359 Visit(node->value()); |
| 354 ReserveFeedbackSlots(node); | 360 ReserveFeedbackSlots(node); |
| 355 } | 361 } |
| 356 | 362 |
| 357 | 363 |
| 358 void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) { | 364 void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) { |
| 359 IncrementNodeCount(); | 365 IncrementNodeCount(); |
| 360 node->set_base_id(ReserveIdRange(BinaryOperation::num_ids())); | 366 node->set_base_id(ReserveIdRange(BinaryOperation::num_ids())); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (node->class_variable_proxy()) { | 472 if (node->class_variable_proxy()) { |
| 467 VisitVariableProxy(node->class_variable_proxy()); | 473 VisitVariableProxy(node->class_variable_proxy()); |
| 468 } | 474 } |
| 469 for (int i = 0; i < node->properties()->length(); i++) { | 475 for (int i = 0; i < node->properties()->length(); i++) { |
| 470 VisitObjectLiteralProperty(node->properties()->at(i)); | 476 VisitObjectLiteralProperty(node->properties()->at(i)); |
| 471 } | 477 } |
| 472 ReserveFeedbackSlots(node); | 478 ReserveFeedbackSlots(node); |
| 473 } | 479 } |
| 474 | 480 |
| 475 | 481 |
| 482 void AstNumberingVisitor::VisitAssignmentPattern(AssignmentPattern* node) { |
| 483 IncrementNodeCount(); |
| 484 Visit(node->expression()); |
| 485 } |
| 486 |
| 487 |
| 476 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { | 488 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { |
| 477 IncrementNodeCount(); | 489 IncrementNodeCount(); |
| 478 node->set_base_id(ReserveIdRange(node->num_ids())); | 490 node->set_base_id(ReserveIdRange(node->num_ids())); |
| 479 for (int i = 0; i < node->properties()->length(); i++) { | 491 for (int i = 0; i < node->properties()->length(); i++) { |
| 480 VisitObjectLiteralProperty(node->properties()->at(i)); | 492 VisitObjectLiteralProperty(node->properties()->at(i)); |
| 481 } | 493 } |
| 482 node->BuildConstantProperties(isolate_); | 494 node->BuildConstantProperties(isolate_); |
| 483 // Mark all computed expressions that are bound to a key that | 495 // Mark all computed expressions that are bound to a key that |
| 484 // is shadowed by a later occurrence of the same key. For the | 496 // is shadowed by a later occurrence of the same key. For the |
| 485 // marked expressions, no store code will be is emitted. | 497 // marked expressions, no store code will be is emitted. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 595 } |
| 584 | 596 |
| 585 | 597 |
| 586 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 598 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
| 587 FunctionLiteral* function) { | 599 FunctionLiteral* function) { |
| 588 AstNumberingVisitor visitor(isolate, zone); | 600 AstNumberingVisitor visitor(isolate, zone); |
| 589 return visitor.Renumber(function); | 601 return visitor.Renumber(function); |
| 590 } | 602 } |
| 591 } // namespace internal | 603 } // namespace internal |
| 592 } // namespace v8 | 604 } // namespace v8 |
| OLD | NEW |