| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 status = job.OptimizeGraph(); | 317 status = job.OptimizeGraph(); |
| 318 if (status != RecompileJob::SUCCEEDED) { | 318 if (status != RecompileJob::SUCCEEDED) { |
| 319 status = job.AbortOptimization(); | 319 status = job.AbortOptimization(); |
| 320 return status != RecompileJob::FAILED; | 320 return status != RecompileJob::FAILED; |
| 321 } | 321 } |
| 322 status = job.GenerateAndInstallCode(); | 322 status = job.GenerateAndInstallCode(); |
| 323 return status != RecompileJob::FAILED; | 323 return status != RecompileJob::FAILED; |
| 324 } | 324 } |
| 325 | 325 |
| 326 | 326 |
| 327 class HOptimizedGraphBuilderWithPotisions: public HOptimizedGraphBuilder { | 327 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { |
| 328 public: | 328 public: |
| 329 explicit HOptimizedGraphBuilderWithPotisions(CompilationInfo* info) | 329 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) |
| 330 : HOptimizedGraphBuilder(info) { | 330 : HOptimizedGraphBuilder(info) { |
| 331 } | 331 } |
| 332 | 332 |
| 333 #define DEF_VISIT(type) \ | 333 #define DEF_VISIT(type) \ |
| 334 virtual void Visit##type(type* node) V8_OVERRIDE { \ | 334 virtual void Visit##type(type* node) V8_OVERRIDE { \ |
| 335 if (node->position() != RelocInfo::kNoPosition) { \ | 335 if (node->position() != RelocInfo::kNoPosition) { \ |
| 336 SetSourcePosition(node->position()); \ | 336 SetSourcePosition(node->position()); \ |
| 337 } \ | 337 } \ |
| 338 HOptimizedGraphBuilder::Visit##type(node); \ | 338 HOptimizedGraphBuilder::Visit##type(node); \ |
| 339 } | 339 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 Handle<String> name = info()->function()->debug_name(); | 470 Handle<String> name = info()->function()->debug_name(); |
| 471 PrintF("-----------------------------------------------------------\n"); | 471 PrintF("-----------------------------------------------------------\n"); |
| 472 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); | 472 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); |
| 473 isolate()->GetHTracer()->TraceCompilation(info()); | 473 isolate()->GetHTracer()->TraceCompilation(info()); |
| 474 } | 474 } |
| 475 | 475 |
| 476 // Type-check the function. | 476 // Type-check the function. |
| 477 AstTyper::Run(info()); | 477 AstTyper::Run(info()); |
| 478 | 478 |
| 479 graph_builder_ = FLAG_emit_opt_code_positions | 479 graph_builder_ = FLAG_emit_opt_code_positions |
| 480 ? new(info()->zone()) HOptimizedGraphBuilderWithPotisions(info()) | 480 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
| 481 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 481 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
| 482 | 482 |
| 483 Timer t(this, &time_taken_to_create_graph_); | 483 Timer t(this, &time_taken_to_create_graph_); |
| 484 graph_ = graph_builder_->CreateGraph(); | 484 graph_ = graph_builder_->CreateGraph(); |
| 485 | 485 |
| 486 if (isolate()->has_pending_exception()) { | 486 if (isolate()->has_pending_exception()) { |
| 487 info()->SetCode(Handle<Code>::null()); | 487 info()->SetCode(Handle<Code>::null()); |
| 488 return SetLastStatus(FAILED); | 488 return SetLastStatus(FAILED); |
| 489 } | 489 } |
| 490 | 490 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 515 DisallowHeapAllocation no_allocation; | 515 DisallowHeapAllocation no_allocation; |
| 516 DisallowHandleAllocation no_handles; | 516 DisallowHandleAllocation no_handles; |
| 517 DisallowHandleDereference no_deref; | 517 DisallowHandleDereference no_deref; |
| 518 DisallowCodeDependencyChange no_dependency_change; | 518 DisallowCodeDependencyChange no_dependency_change; |
| 519 | 519 |
| 520 ASSERT(last_status() == SUCCEEDED); | 520 ASSERT(last_status() == SUCCEEDED); |
| 521 Timer t(this, &time_taken_to_optimize_); | 521 Timer t(this, &time_taken_to_optimize_); |
| 522 ASSERT(graph_ != NULL); | 522 ASSERT(graph_ != NULL); |
| 523 BailoutReason bailout_reason = kNoReason; | 523 BailoutReason bailout_reason = kNoReason; |
| 524 if (!graph_->Optimize(&bailout_reason)) { | 524 if (!graph_->Optimize(&bailout_reason)) { |
| 525 if (bailout_reason == kNoReason) graph_builder_->Bailout(bailout_reason); | 525 if (bailout_reason != kNoReason) graph_builder_->Bailout(bailout_reason); |
| 526 return SetLastStatus(BAILED_OUT); | 526 return SetLastStatus(BAILED_OUT); |
| 527 } else { | 527 } else { |
| 528 chunk_ = LChunk::NewChunk(graph_); | 528 chunk_ = LChunk::NewChunk(graph_); |
| 529 if (chunk_ == NULL) { | 529 if (chunk_ == NULL) { |
| 530 return SetLastStatus(BAILED_OUT); | 530 return SetLastStatus(BAILED_OUT); |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 return SetLastStatus(SUCCEEDED); | 533 return SetLastStatus(SUCCEEDED); |
| 534 } | 534 } |
| 535 | 535 |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 AllowHandleDereference allow_deref; | 1370 AllowHandleDereference allow_deref; |
| 1371 bool tracing_on = info()->IsStub() | 1371 bool tracing_on = info()->IsStub() |
| 1372 ? FLAG_trace_hydrogen_stubs | 1372 ? FLAG_trace_hydrogen_stubs |
| 1373 : (FLAG_trace_hydrogen && | 1373 : (FLAG_trace_hydrogen && |
| 1374 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1374 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1375 return (tracing_on && | 1375 return (tracing_on && |
| 1376 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1376 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 } } // namespace v8::internal | 1379 } } // namespace v8::internal |
| OLD | NEW |