OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 code = ComputeLazyCompile(literal->num_parameters()); | 486 code = ComputeLazyCompile(literal->num_parameters()); |
487 } else { | 487 } else { |
488 // The bodies of function literals have not yet been visited by | 488 // The bodies of function literals have not yet been visited by |
489 // the AST optimizer/analyzer. | 489 // the AST optimizer/analyzer. |
490 if (!Rewriter::Optimize(literal)) { | 490 if (!Rewriter::Optimize(literal)) { |
491 return Handle<JSFunction>::null(); | 491 return Handle<JSFunction>::null(); |
492 } | 492 } |
493 | 493 |
494 // Generate code and return it. | 494 // Generate code and return it. |
495 bool is_compiled = false; | 495 bool is_compiled = false; |
496 if (FLAG_fast_compiler && literal->try_fast_codegen()) { | 496 if (FLAG_always_fast_compiler || |
| 497 (FLAG_fast_compiler && literal->try_fast_codegen())) { |
497 CodeGenSelector selector; | 498 CodeGenSelector selector; |
498 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); | 499 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); |
499 if (code_gen == CodeGenSelector::FAST) { | 500 if (code_gen == CodeGenSelector::FAST) { |
500 code = FastCodeGenerator::MakeCode(literal, | 501 code = FastCodeGenerator::MakeCode(literal, |
501 script, | 502 script, |
502 false); // Not eval. | 503 false); // Not eval. |
503 is_compiled = true; | 504 is_compiled = true; |
504 } | 505 } |
505 } | 506 } |
506 | 507 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 697 |
697 | 698 |
698 void CodeGenSelector::VisitWhileStatement(WhileStatement* stmt) { | 699 void CodeGenSelector::VisitWhileStatement(WhileStatement* stmt) { |
699 Visit(stmt->cond()); | 700 Visit(stmt->cond()); |
700 CHECK_BAILOUT; | 701 CHECK_BAILOUT; |
701 Visit(stmt->body()); | 702 Visit(stmt->body()); |
702 } | 703 } |
703 | 704 |
704 | 705 |
705 void CodeGenSelector::VisitForStatement(ForStatement* stmt) { | 706 void CodeGenSelector::VisitForStatement(ForStatement* stmt) { |
706 BAILOUT("ForStatement"); | 707 if (!FLAG_always_fast_compiler) BAILOUT("ForStatement"); |
| 708 if (stmt->init() != NULL) { |
| 709 Visit(stmt->init()); |
| 710 CHECK_BAILOUT; |
| 711 } |
| 712 if (stmt->cond() != NULL) { |
| 713 Visit(stmt->cond()); |
| 714 CHECK_BAILOUT; |
| 715 } |
| 716 Visit(stmt->body()); |
| 717 if (stmt->next() != NULL) { |
| 718 CHECK_BAILOUT; |
| 719 Visit(stmt->next()); |
| 720 } |
707 } | 721 } |
708 | 722 |
709 | 723 |
710 void CodeGenSelector::VisitForInStatement(ForInStatement* stmt) { | 724 void CodeGenSelector::VisitForInStatement(ForInStatement* stmt) { |
711 BAILOUT("ForInStatement"); | 725 BAILOUT("ForInStatement"); |
712 } | 726 } |
713 | 727 |
714 | 728 |
715 void CodeGenSelector::VisitTryCatchStatement(TryCatchStatement* stmt) { | 729 void CodeGenSelector::VisitTryCatchStatement(TryCatchStatement* stmt) { |
716 Visit(stmt->try_block()); | 730 Visit(stmt->try_block()); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 } | 997 } |
984 | 998 |
985 | 999 |
986 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) {} | 1000 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) {} |
987 | 1001 |
988 #undef BAILOUT | 1002 #undef BAILOUT |
989 #undef CHECK_BAILOUT | 1003 #undef CHECK_BAILOUT |
990 | 1004 |
991 | 1005 |
992 } } // namespace v8::internal | 1006 } } // namespace v8::internal |
OLD | NEW |