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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 if (FLAG_lazy && allow_lazy) { | 496 if (FLAG_lazy && allow_lazy) { |
497 code = ComputeLazyCompile(literal->num_parameters()); | 497 code = ComputeLazyCompile(literal->num_parameters()); |
498 } else { | 498 } else { |
499 // The bodies of function literals have not yet been visited by | 499 // The bodies of function literals have not yet been visited by |
500 // the AST optimizer/analyzer. | 500 // the AST optimizer/analyzer. |
501 if (!Rewriter::Optimize(literal)) { | 501 if (!Rewriter::Optimize(literal)) { |
502 return Handle<JSFunction>::null(); | 502 return Handle<JSFunction>::null(); |
503 } | 503 } |
504 | 504 |
505 // Generate code and return it. | 505 // Generate code and return it. |
| 506 bool is_compiled = false; |
506 if (FLAG_fast_compiler && literal->try_fast_codegen()) { | 507 if (FLAG_fast_compiler && literal->try_fast_codegen()) { |
507 CodeGenSelector selector; | 508 CodeGenSelector selector; |
508 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); | 509 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); |
509 if (code_gen == CodeGenSelector::FAST) { | 510 if (code_gen == CodeGenSelector::FAST) { |
510 code = FastCodeGenerator::MakeCode(literal, | 511 code = FastCodeGenerator::MakeCode(literal, |
511 script, | 512 script, |
512 false); // Not eval. | 513 false); // Not eval. |
| 514 is_compiled = true; |
513 } | 515 } |
514 ASSERT(code_gen == CodeGenSelector::NORMAL); | 516 } |
515 } else { | 517 |
| 518 if (!is_compiled) { |
| 519 // We didn't try the fast compiler, or we failed to select it. |
516 code = CodeGenerator::MakeCode(literal, | 520 code = CodeGenerator::MakeCode(literal, |
517 script, | 521 script, |
518 false); // Not eval. | 522 false); // Not eval. |
519 } | 523 } |
520 | 524 |
521 // Check for stack-overflow exception. | 525 // Check for stack-overflow exception. |
522 if (code.is_null()) { | 526 if (code.is_null()) { |
523 caller->SetStackOverflow(); | 527 caller->SetStackOverflow(); |
524 return Handle<JSFunction>::null(); | 528 return Handle<JSFunction>::null(); |
525 } | 529 } |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 | 1085 |
1082 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 1086 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
1083 BAILOUT("ThisFunction"); | 1087 BAILOUT("ThisFunction"); |
1084 } | 1088 } |
1085 | 1089 |
1086 #undef BAILOUT | 1090 #undef BAILOUT |
1087 #undef CHECK_BAILOUT | 1091 #undef CHECK_BAILOUT |
1088 | 1092 |
1089 | 1093 |
1090 } } // namespace v8::internal | 1094 } } // namespace v8::internal |
OLD | NEW |