| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 shared->start_position(), | 266 shared->start_position(), |
| 267 &unoptimized); | 267 &unoptimized); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 // Check that the unoptimized, shared code is ready for | 271 // Check that the unoptimized, shared code is ready for |
| 272 // optimizations. When using the always_opt flag we disregard the | 272 // optimizations. When using the always_opt flag we disregard the |
| 273 // optimizable marker in the code object and optimize anyway. This | 273 // optimizable marker in the code object and optimize anyway. This |
| 274 // is safe as long as the unoptimized code has deoptimization | 274 // is safe as long as the unoptimized code has deoptimization |
| 275 // support. | 275 // support. |
| 276 ASSERT(FLAG_always_opt || info->shared_info()->code()->optimizable()); | 276 ASSERT(FLAG_always_opt || code->optimizable()); |
| 277 ASSERT(info->shared_info()->has_deoptimization_support()); | 277 ASSERT(info->shared_info()->has_deoptimization_support()); |
| 278 | 278 |
| 279 if (FLAG_trace_hydrogen) { | 279 if (FLAG_trace_hydrogen) { |
| 280 PrintF("-----------------------------------------------------------\n"); | 280 PrintF("-----------------------------------------------------------\n"); |
| 281 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); | 281 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); |
| 282 HTracer::Instance()->TraceCompilation(info->function()); | 282 HTracer::Instance()->TraceCompilation(info->function()); |
| 283 } | 283 } |
| 284 | 284 |
| 285 TypeFeedbackOracle oracle( | 285 TypeFeedbackOracle oracle( |
| 286 Handle<Code>(info->shared_info()->code()), | 286 code, Handle<Context>(info->closure()->context()->global_context())); |
| 287 Handle<Context>(info->closure()->context()->global_context())); | |
| 288 HGraphBuilder builder(&oracle); | 287 HGraphBuilder builder(&oracle); |
| 289 HPhase phase(HPhase::kTotal); | 288 HPhase phase(HPhase::kTotal); |
| 290 HGraph* graph = builder.CreateGraph(info); | 289 HGraph* graph = builder.CreateGraph(info); |
| 291 if (Top::has_pending_exception()) { | 290 if (Top::has_pending_exception()) { |
| 292 info->SetCode(Handle<Code>::null()); | 291 info->SetCode(Handle<Code>::null()); |
| 293 return false; | 292 return false; |
| 294 } | 293 } |
| 295 | 294 |
| 296 if (graph != NULL && FLAG_build_lithium) { | 295 if (graph != NULL && FLAG_build_lithium) { |
| 297 Handle<Code> code = graph->Compile(); | 296 Handle<Code> optimized_code = graph->Compile(); |
| 298 if (!code.is_null()) { | 297 if (!optimized_code.is_null()) { |
| 299 info->SetCode(code); | 298 info->SetCode(optimized_code); |
| 300 FinishOptimization(info->closure(), start); | 299 FinishOptimization(info->closure(), start); |
| 301 return true; | 300 return true; |
| 302 } | 301 } |
| 303 } | 302 } |
| 304 | 303 |
| 305 // Compilation with the Hydrogen compiler failed. Keep using the | 304 // Compilation with the Hydrogen compiler failed. Keep using the |
| 306 // shared code but mark it as unoptimizable. | 305 // shared code but mark it as unoptimizable. |
| 307 AbortAndDisable(info); | 306 AbortAndDisable(info); |
| 308 // True indicates the compilation pipeline is still going, not necessarily | 307 // True indicates the compilation pipeline is still going, not necessarily |
| 309 // that we optimized the code. | 308 // that we optimized the code. |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 *name)); | 799 *name)); |
| 801 } | 800 } |
| 802 } | 801 } |
| 803 | 802 |
| 804 GDBJIT(AddCode(name, | 803 GDBJIT(AddCode(name, |
| 805 Handle<Script>(info->script()), | 804 Handle<Script>(info->script()), |
| 806 Handle<Code>(info->code()))); | 805 Handle<Code>(info->code()))); |
| 807 } | 806 } |
| 808 | 807 |
| 809 } } // namespace v8::internal | 808 } } // namespace v8::internal |
| OLD | NEW |