OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "ast.h" | 30 #include "ast.h" |
31 #include "scopes.h" | 31 #include "scopes.h" |
32 #include "rewriter.h" | 32 #include "rewriter.h" |
33 | 33 |
34 namespace v8 { namespace internal { | 34 namespace v8 { namespace internal { |
35 | 35 |
36 | 36 |
37 class AstOptimizer: public Visitor { | 37 class AstOptimizer: public AstVisitor { |
38 public: | 38 public: |
39 explicit AstOptimizer() { | 39 explicit AstOptimizer() { |
40 } | 40 } |
41 | 41 |
42 void Optimize(ZoneList<Statement*>* statements); | 42 void Optimize(ZoneList<Statement*>* statements); |
43 | 43 |
44 private: | 44 private: |
45 // Helpers | 45 // Helpers |
46 void OptimizeArguments(ZoneList<Expression*>* arguments); | 46 void OptimizeArguments(ZoneList<Expression*>* arguments); |
47 | 47 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 Visit(node->key()); | 337 Visit(node->key()); |
338 } | 338 } |
339 | 339 |
340 | 340 |
341 void AstOptimizer::VisitCall(Call* node) { | 341 void AstOptimizer::VisitCall(Call* node) { |
342 Visit(node->expression()); | 342 Visit(node->expression()); |
343 OptimizeArguments(node->arguments()); | 343 OptimizeArguments(node->arguments()); |
344 } | 344 } |
345 | 345 |
346 | 346 |
| 347 void AstOptimizer::VisitCallEval(CallEval* node) { |
| 348 Visit(node->expression()); |
| 349 OptimizeArguments(node->arguments()); |
| 350 } |
| 351 |
| 352 |
347 void AstOptimizer::VisitCallNew(CallNew* node) { | 353 void AstOptimizer::VisitCallNew(CallNew* node) { |
348 Visit(node->expression()); | 354 Visit(node->expression()); |
349 OptimizeArguments(node->arguments()); | 355 OptimizeArguments(node->arguments()); |
350 } | 356 } |
351 | 357 |
352 | 358 |
353 void AstOptimizer::VisitCallRuntime(CallRuntime* node) { | 359 void AstOptimizer::VisitCallRuntime(CallRuntime* node) { |
354 OptimizeArguments(node->arguments()); | 360 OptimizeArguments(node->arguments()); |
355 } | 361 } |
356 | 362 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 468 } |
463 } | 469 } |
464 } | 470 } |
465 | 471 |
466 | 472 |
467 void AstOptimizer::VisitThisFunction(ThisFunction* node) { | 473 void AstOptimizer::VisitThisFunction(ThisFunction* node) { |
468 USE(node); | 474 USE(node); |
469 } | 475 } |
470 | 476 |
471 | 477 |
472 class Processor: public Visitor { | 478 class Processor: public AstVisitor { |
473 public: | 479 public: |
474 explicit Processor(VariableProxy* result) | 480 explicit Processor(VariableProxy* result) |
475 : result_(result), | 481 : result_(result), |
476 result_assigned_(false), | 482 result_assigned_(false), |
477 is_set_(false), | 483 is_set_(false), |
478 in_try_(false) { | 484 in_try_(false) { |
479 } | 485 } |
480 | 486 |
481 void Process(ZoneList<Statement*>* statements); | 487 void Process(ZoneList<Statement*>* statements); |
482 bool result_assigned() const { return result_assigned_; } | 488 bool result_assigned() const { return result_assigned_; } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 UNREACHABLE(); | 701 UNREACHABLE(); |
696 } | 702 } |
697 | 703 |
698 | 704 |
699 void Processor::VisitCall(Call* node) { | 705 void Processor::VisitCall(Call* node) { |
700 USE(node); | 706 USE(node); |
701 UNREACHABLE(); | 707 UNREACHABLE(); |
702 } | 708 } |
703 | 709 |
704 | 710 |
| 711 void Processor::VisitCallEval(CallEval* node) { |
| 712 USE(node); |
| 713 UNREACHABLE(); |
| 714 } |
| 715 |
| 716 |
705 void Processor::VisitCallNew(CallNew* node) { | 717 void Processor::VisitCallNew(CallNew* node) { |
706 USE(node); | 718 USE(node); |
707 UNREACHABLE(); | 719 UNREACHABLE(); |
708 } | 720 } |
709 | 721 |
710 | 722 |
711 void Processor::VisitCallRuntime(CallRuntime* node) { | 723 void Processor::VisitCallRuntime(CallRuntime* node) { |
712 USE(node); | 724 USE(node); |
713 UNREACHABLE(); | 725 UNREACHABLE(); |
714 } | 726 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 if (optimizer.HasStackOverflow()) { | 784 if (optimizer.HasStackOverflow()) { |
773 return false; | 785 return false; |
774 } | 786 } |
775 } | 787 } |
776 } | 788 } |
777 return true; | 789 return true; |
778 } | 790 } |
779 | 791 |
780 | 792 |
781 } } // namespace v8::internal | 793 } } // namespace v8::internal |
OLD | NEW |