Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 6340773eab6fe4cee7da8eed08de2d5d77a77d07..e341accd9071bcaa1c21692d9739203ab261cb52 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -308,11 +308,19 @@ static bool MakeCrankshaftCode(CompilationInfo* info) { |
} |
if (graph != NULL) { |
- Handle<Code> optimized_code = graph->Compile(); |
- if (!optimized_code.is_null()) { |
- info->SetCode(optimized_code); |
- FinishOptimization(info->closure(), start); |
- return true; |
+ SmartArrayPointer<char> bailout_reason; |
+ if (!graph->Optimize(&bailout_reason)) { |
+ if (!bailout_reason.is_empty()) builder.Bailout(*bailout_reason); |
+ } else { |
+ LChunkBase* chunk = LChunkBase::NewChunk(graph); |
+ if (chunk != NULL) { |
+ Handle<Code> optimized_code = chunk->Codegen(); |
+ if (!optimized_code.is_null()) { |
+ info->SetCode(optimized_code); |
+ FinishOptimization(info->closure(), start); |
+ return true; |
+ } |
+ } |
} |
} |