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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 bool has_function_literal_; | 52 bool has_function_literal_; |
53 // Helper object for function name inferring. | 53 // Helper object for function name inferring. |
54 FuncNameInferrer func_name_inferrer_; | 54 FuncNameInferrer func_name_inferrer_; |
55 | 55 |
56 // Helpers | 56 // Helpers |
57 void OptimizeArguments(ZoneList<Expression*>* arguments); | 57 void OptimizeArguments(ZoneList<Expression*>* arguments); |
58 | 58 |
59 // Node visitors. | 59 // Node visitors. |
60 #define DEF_VISIT(type) \ | 60 #define DEF_VISIT(type) \ |
61 virtual void Visit##type(type* node); | 61 virtual void Visit##type(type* node); |
62 NODE_LIST(DEF_VISIT) | 62 AST_NODE_LIST(DEF_VISIT) |
63 #undef DEF_VISIT | 63 #undef DEF_VISIT |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(AstOptimizer); | 65 DISALLOW_COPY_AND_ASSIGN(AstOptimizer); |
66 }; | 66 }; |
67 | 67 |
68 | 68 |
69 void AstOptimizer::Optimize(ZoneList<Statement*>* statements) { | 69 void AstOptimizer::Optimize(ZoneList<Statement*>* statements) { |
70 int len = statements->length(); | 70 int len = statements->length(); |
71 for (int i = 0; i < len; i++) { | 71 for (int i = 0; i < len; i++) { |
72 Visit(statements->at(i)); | 72 Visit(statements->at(i)); |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 550 |
551 Expression* SetResult(Expression* value) { | 551 Expression* SetResult(Expression* value) { |
552 result_assigned_ = true; | 552 result_assigned_ = true; |
553 return new Assignment(Token::ASSIGN, result_, value, | 553 return new Assignment(Token::ASSIGN, result_, value, |
554 RelocInfo::kNoPosition); | 554 RelocInfo::kNoPosition); |
555 } | 555 } |
556 | 556 |
557 // Node visitors. | 557 // Node visitors. |
558 #define DEF_VISIT(type) \ | 558 #define DEF_VISIT(type) \ |
559 virtual void Visit##type(type* node); | 559 virtual void Visit##type(type* node); |
560 NODE_LIST(DEF_VISIT) | 560 AST_NODE_LIST(DEF_VISIT) |
561 #undef DEF_VISIT | 561 #undef DEF_VISIT |
562 }; | 562 }; |
563 | 563 |
564 | 564 |
565 void Processor::Process(ZoneList<Statement*>* statements) { | 565 void Processor::Process(ZoneList<Statement*>* statements) { |
566 for (int i = statements->length() - 1; i >= 0; --i) { | 566 for (int i = statements->length() - 1; i >= 0; --i) { |
567 Visit(statements->at(i)); | 567 Visit(statements->at(i)); |
568 } | 568 } |
569 } | 569 } |
570 | 570 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 optimizer.Optimize(body); | 834 optimizer.Optimize(body); |
835 if (optimizer.HasStackOverflow()) { | 835 if (optimizer.HasStackOverflow()) { |
836 return false; | 836 return false; |
837 } | 837 } |
838 } | 838 } |
839 return true; | 839 return true; |
840 } | 840 } |
841 | 841 |
842 | 842 |
843 } } // namespace v8::internal | 843 } } // namespace v8::internal |
OLD | NEW |