OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 info->zone()); | 301 info->zone()); |
302 HGraphBuilder builder(info, &oracle); | 302 HGraphBuilder builder(info, &oracle); |
303 HPhase phase(HPhase::kTotal); | 303 HPhase phase(HPhase::kTotal); |
304 HGraph* graph = builder.CreateGraph(); | 304 HGraph* graph = builder.CreateGraph(); |
305 if (info->isolate()->has_pending_exception()) { | 305 if (info->isolate()->has_pending_exception()) { |
306 info->SetCode(Handle<Code>::null()); | 306 info->SetCode(Handle<Code>::null()); |
307 return false; | 307 return false; |
308 } | 308 } |
309 | 309 |
310 if (graph != NULL) { | 310 if (graph != NULL) { |
311 Handle<Code> optimized_code = graph->Compile(); | 311 SmartArrayPointer<char> bailout_reason; |
312 if (!optimized_code.is_null()) { | 312 if (!graph->Optimize(&bailout_reason)) { |
313 info->SetCode(optimized_code); | 313 if (!bailout_reason.is_empty()) builder.Bailout(*bailout_reason); |
314 FinishOptimization(info->closure(), start); | 314 } else { |
315 return true; | 315 LChunkBase* chunk = LChunkBase::NewChunk(graph); |
| 316 if (chunk != NULL) { |
| 317 Handle<Code> optimized_code = chunk->Codegen(); |
| 318 if (!optimized_code.is_null()) { |
| 319 info->SetCode(optimized_code); |
| 320 FinishOptimization(info->closure(), start); |
| 321 return true; |
| 322 } |
| 323 } |
316 } | 324 } |
317 } | 325 } |
318 | 326 |
319 // Keep using the shared code. | 327 // Keep using the shared code. |
320 info->AbortOptimization(); | 328 info->AbortOptimization(); |
321 if (!builder.inline_bailout()) { | 329 if (!builder.inline_bailout()) { |
322 // Mark the shared code as unoptimizable unless it was an inlined | 330 // Mark the shared code as unoptimizable unless it was an inlined |
323 // function that bailed out. | 331 // function that bailed out. |
324 info->shared_info()->DisableOptimization(); | 332 info->shared_info()->DisableOptimization(); |
325 } | 333 } |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 } | 878 } |
871 } | 879 } |
872 | 880 |
873 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 881 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
874 Handle<Script>(info->script()), | 882 Handle<Script>(info->script()), |
875 Handle<Code>(info->code()), | 883 Handle<Code>(info->code()), |
876 info)); | 884 info)); |
877 } | 885 } |
878 | 886 |
879 } } // namespace v8::internal | 887 } } // namespace v8::internal |
OLD | NEW |