Chromium Code Reviews| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 } | 112 } |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 // Optimize the AST. | 115 // Optimize the AST. |
| 116 if (!Rewriter::Optimize(literal)) { | 116 if (!Rewriter::Optimize(literal)) { |
| 117 // Signal a stack overflow by returning a null handle. The stack | 117 // Signal a stack overflow by returning a null handle. The stack |
| 118 // overflow exception will be thrown by the caller. | 118 // overflow exception will be thrown by the caller. |
| 119 return Handle<Code>::null(); | 119 return Handle<Code>::null(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // No support for FastCodeGenerator on MIPS yet. | |
| 123 #ifndef V8_TARGET_ARCH_MIPS | |
|
Søren Thygesen Gjesse
2010/01/19 22:59:12
Please get rid of this #ifdef. You can create a Fa
Alexandre
2010/01/22 23:08:42
Removed.
On 2010/01/19 22:59:12, Søren Gjesse wrot
| |
| 122 // Generate code and return it. | 124 // Generate code and return it. |
| 123 if (FLAG_fast_compiler) { | 125 if (FLAG_fast_compiler) { |
| 124 // If there is no shared function info, try the fast code | 126 // If there is no shared function info, try the fast code |
| 125 // generator for code in the global scope. Otherwise obey the | 127 // generator for code in the global scope. Otherwise obey the |
| 126 // explicit hint in the shared function info. | 128 // explicit hint in the shared function info. |
| 127 if (shared.is_null() && !literal->scope()->is_global_scope()) { | 129 if (shared.is_null() && !literal->scope()->is_global_scope()) { |
| 128 if (FLAG_trace_bailout) PrintF("Non-global scope\n"); | 130 if (FLAG_trace_bailout) PrintF("Non-global scope\n"); |
| 129 } else if (!shared.is_null() && !shared->try_fast_codegen()) { | 131 } else if (!shared.is_null() && !shared->try_fast_codegen()) { |
| 130 if (FLAG_trace_bailout) PrintF("No hint to try fast\n"); | 132 if (FLAG_trace_bailout) PrintF("No hint to try fast\n"); |
| 131 } else { | 133 } else { |
| 132 CodeGenSelector selector; | 134 CodeGenSelector selector; |
| 133 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); | 135 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); |
| 134 if (code_gen == CodeGenSelector::FAST) { | 136 if (code_gen == CodeGenSelector::FAST) { |
| 135 return FastCodeGenerator::MakeCode(literal, script, is_eval); | 137 return FastCodeGenerator::MakeCode(literal, script, is_eval); |
| 136 } | 138 } |
| 137 ASSERT(code_gen == CodeGenSelector::NORMAL); | 139 ASSERT(code_gen == CodeGenSelector::NORMAL); |
| 138 } | 140 } |
| 139 } | 141 } |
| 140 return CodeGenerator::MakeCode(literal, script, is_eval); | 142 return CodeGenerator::MakeCode(literal, script, is_eval); |
| 143 #else | |
| 144 return CodeGenerator::MakeCode(literal, script, is_eval); | |
| 145 #endif | |
| 141 } | 146 } |
| 142 | 147 |
| 143 | 148 |
| 144 static bool IsValidJSON(FunctionLiteral* lit) { | 149 static bool IsValidJSON(FunctionLiteral* lit) { |
| 145 if (lit->body()->length() != 1) | 150 if (lit->body()->length() != 1) |
| 146 return false; | 151 return false; |
| 147 Statement* stmt = lit->body()->at(0); | 152 Statement* stmt = lit->body()->at(0); |
| 148 if (stmt->AsExpressionStatement() == NULL) | 153 if (stmt->AsExpressionStatement() == NULL) |
| 149 return false; | 154 return false; |
| 150 Expression* expr = stmt->AsExpressionStatement()->expression(); | 155 Expression* expr = stmt->AsExpressionStatement()->expression(); |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 | 1090 |
| 1086 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 1091 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
| 1087 BAILOUT("ThisFunction"); | 1092 BAILOUT("ThisFunction"); |
| 1088 } | 1093 } |
| 1089 | 1094 |
| 1090 #undef BAILOUT | 1095 #undef BAILOUT |
| 1091 #undef CHECK_BAILOUT | 1096 #undef CHECK_BAILOUT |
| 1092 | 1097 |
| 1093 | 1098 |
| 1094 } } // namespace v8::internal | 1099 } } // namespace v8::internal |
| OLD | NEW |