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" |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 if (node->init() != NULL) Visit(node->init()); | 434 if (node->init() != NULL) Visit(node->init()); |
435 if (node->cond() != NULL) Visit(node->cond()); | 435 if (node->cond() != NULL) Visit(node->cond()); |
436 if (node->next() != NULL) Visit(node->next()); | 436 if (node->next() != NULL) Visit(node->next()); |
437 Visit(node->body()); | 437 Visit(node->body()); |
438 } | 438 } |
439 | 439 |
440 | 440 |
441 void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) { | 441 void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) { |
442 IncrementNodeCount(); | 442 IncrementNodeCount(); |
443 DisableOptimization(kClassLiteral); | 443 DisableOptimization(kClassLiteral); |
444 node->set_base_id(ReserveIdRange(ClassLiteral::num_ids())); | 444 node->set_base_id(ReserveIdRange(node->num_ids())); |
445 if (node->extends()) Visit(node->extends()); | 445 if (node->extends()) Visit(node->extends()); |
446 if (node->constructor()) Visit(node->constructor()); | 446 if (node->constructor()) Visit(node->constructor()); |
447 if (node->class_variable_proxy()) { | 447 if (node->class_variable_proxy()) { |
448 VisitVariableProxy(node->class_variable_proxy()); | 448 VisitVariableProxy(node->class_variable_proxy()); |
449 } | 449 } |
450 for (int i = 0; i < node->properties()->length(); i++) { | 450 for (int i = 0; i < node->properties()->length(); i++) { |
451 VisitObjectLiteralProperty(node->properties()->at(i)); | 451 VisitObjectLiteralProperty(node->properties()->at(i)); |
452 } | 452 } |
453 } | 453 } |
454 | 454 |
455 | 455 |
456 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { | 456 void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) { |
457 IncrementNodeCount(); | 457 IncrementNodeCount(); |
458 node->set_base_id(ReserveIdRange(ObjectLiteral::num_ids())); | 458 node->set_base_id(ReserveIdRange(node->num_ids())); |
459 for (int i = 0; i < node->properties()->length(); i++) { | 459 for (int i = 0; i < node->properties()->length(); i++) { |
460 VisitObjectLiteralProperty(node->properties()->at(i)); | 460 VisitObjectLiteralProperty(node->properties()->at(i)); |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 | 464 |
465 void AstNumberingVisitor::VisitObjectLiteralProperty( | 465 void AstNumberingVisitor::VisitObjectLiteralProperty( |
466 ObjectLiteralProperty* node) { | 466 ObjectLiteralProperty* node) { |
467 if (node->is_computed_name()) DisableOptimization(kComputedPropertyName); | 467 if (node->is_computed_name()) DisableOptimization(kComputedPropertyName); |
468 Visit(node->key()); | 468 Visit(node->key()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 562 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
563 FunctionLiteral* function) { | 563 FunctionLiteral* function) { |
564 AstNumberingVisitor visitor(isolate, zone); | 564 AstNumberingVisitor visitor(isolate, zone); |
565 return visitor.Renumber(function); | 565 return visitor.Renumber(function); |
566 } | 566 } |
567 } | 567 } |
568 } // namespace v8::internal | 568 } // namespace v8::internal |
OLD | NEW |