| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); | 282 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); |
| 283 HTracer::Instance()->TraceCompilation(info->function()); | 283 HTracer::Instance()->TraceCompilation(info->function()); |
| 284 } | 284 } |
| 285 | 285 |
| 286 TypeFeedbackOracle oracle( | 286 TypeFeedbackOracle oracle( |
| 287 Handle<Code>(info->shared_info()->code()), | 287 Handle<Code>(info->shared_info()->code()), |
| 288 Handle<Context>(info->closure()->context()->global_context())); | 288 Handle<Context>(info->closure()->context()->global_context())); |
| 289 HGraphBuilder builder(&oracle); | 289 HGraphBuilder builder(&oracle); |
| 290 HPhase phase(HPhase::kTotal); | 290 HPhase phase(HPhase::kTotal); |
| 291 HGraph* graph = builder.CreateGraph(info); | 291 HGraph* graph = builder.CreateGraph(info); |
| 292 if (Top::has_pending_exception()) { |
| 293 info->SetCode(Handle<Code>::null()); |
| 294 return false; |
| 295 } |
| 296 |
| 292 if (graph != NULL && FLAG_build_lithium) { | 297 if (graph != NULL && FLAG_build_lithium) { |
| 293 Handle<Code> code = graph->Compile(); | 298 Handle<Code> code = graph->Compile(); |
| 294 if (!code.is_null()) { | 299 if (!code.is_null()) { |
| 295 info->SetCode(code); | 300 info->SetCode(code); |
| 296 FinishOptimization(info->closure(), start); | 301 FinishOptimization(info->closure(), start); |
| 297 return true; | 302 return true; |
| 298 } | 303 } |
| 299 } | 304 } |
| 300 | 305 |
| 301 // Compilation with the Hydrogen compiler failed. Keep using the | 306 // Compilation with the Hydrogen compiler failed. Keep using the |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 606 |
| 602 // Generate the AST for the lazily compiled function. | 607 // Generate the AST for the lazily compiled function. |
| 603 if (ParserApi::Parse(info)) { | 608 if (ParserApi::Parse(info)) { |
| 604 // Measure how long it takes to do the lazy compilation; only take the | 609 // Measure how long it takes to do the lazy compilation; only take the |
| 605 // rest of the function into account to avoid overlap with the lazy | 610 // rest of the function into account to avoid overlap with the lazy |
| 606 // parsing statistics. | 611 // parsing statistics. |
| 607 HistogramTimerScope timer(&Counters::compile_lazy); | 612 HistogramTimerScope timer(&Counters::compile_lazy); |
| 608 | 613 |
| 609 // Compile the code. | 614 // Compile the code. |
| 610 if (!MakeCode(info)) { | 615 if (!MakeCode(info)) { |
| 611 Top::StackOverflow(); | 616 if (!Top::has_pending_exception()) { |
| 617 Top::StackOverflow(); |
| 618 } |
| 612 } else { | 619 } else { |
| 613 ASSERT(!info->code().is_null()); | 620 ASSERT(!info->code().is_null()); |
| 614 Handle<Code> code = info->code(); | 621 Handle<Code> code = info->code(); |
| 615 Handle<JSFunction> function = info->closure(); | 622 Handle<JSFunction> function = info->closure(); |
| 616 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, | 623 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, |
| 617 Handle<String>(shared->DebugName()), | 624 Handle<String>(shared->DebugName()), |
| 618 shared->start_position(), | 625 shared->start_position(), |
| 619 info); | 626 info); |
| 620 | 627 |
| 621 if (info->IsOptimizing()) { | 628 if (info->IsOptimizing()) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 code->instruction_size())); | 816 code->instruction_size())); |
| 810 } | 817 } |
| 811 } | 818 } |
| 812 | 819 |
| 813 GDBJIT(AddCode(name, | 820 GDBJIT(AddCode(name, |
| 814 Handle<Script>(info->script()), | 821 Handle<Script>(info->script()), |
| 815 Handle<Code>(info->code()))); | 822 Handle<Code>(info->code()))); |
| 816 } | 823 } |
| 817 | 824 |
| 818 } } // namespace v8::internal | 825 } } // namespace v8::internal |
| OLD | NEW |