| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 Handle<String> name = info()->function()->debug_name(); | 461 Handle<String> name = info()->function()->debug_name(); |
| 462 PrintF("-----------------------------------------------------------\n"); | 462 PrintF("-----------------------------------------------------------\n"); |
| 463 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); | 463 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); |
| 464 isolate()->GetHTracer()->TraceCompilation(info()); | 464 isolate()->GetHTracer()->TraceCompilation(info()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 // Type-check the function. | 467 // Type-check the function. |
| 468 AstTyper::Run(info()); | 468 AstTyper::Run(info()); |
| 469 | 469 |
| 470 graph_builder_ = FLAG_emit_opt_code_positions | 470 graph_builder_ = FLAG_emit_opt_code_positions |
| 471 ? new(info()->zone()) HOptimizedGraphBuilderWithPotisions(info()) | 471 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
| 472 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 472 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
| 473 | 473 |
| 474 Timer t(this, &time_taken_to_create_graph_); | 474 Timer t(this, &time_taken_to_create_graph_); |
| 475 graph_ = graph_builder_->CreateGraph(); | 475 graph_ = graph_builder_->CreateGraph(); |
| 476 | 476 |
| 477 if (isolate()->has_pending_exception()) { | 477 if (isolate()->has_pending_exception()) { |
| 478 info()->SetCode(Handle<Code>::null()); | 478 info()->SetCode(Handle<Code>::null()); |
| 479 return SetLastStatus(FAILED); | 479 return SetLastStatus(FAILED); |
| 480 } | 480 } |
| 481 | 481 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 506 DisallowHeapAllocation no_allocation; | 506 DisallowHeapAllocation no_allocation; |
| 507 DisallowHandleAllocation no_handles; | 507 DisallowHandleAllocation no_handles; |
| 508 DisallowHandleDereference no_deref; | 508 DisallowHandleDereference no_deref; |
| 509 DisallowCodeDependencyChange no_dependency_change; | 509 DisallowCodeDependencyChange no_dependency_change; |
| 510 | 510 |
| 511 ASSERT(last_status() == SUCCEEDED); | 511 ASSERT(last_status() == SUCCEEDED); |
| 512 Timer t(this, &time_taken_to_optimize_); | 512 Timer t(this, &time_taken_to_optimize_); |
| 513 ASSERT(graph_ != NULL); | 513 ASSERT(graph_ != NULL); |
| 514 BailoutReason bailout_reason = kNoReason; | 514 BailoutReason bailout_reason = kNoReason; |
| 515 if (!graph_->Optimize(&bailout_reason)) { | 515 if (!graph_->Optimize(&bailout_reason)) { |
| 516 if (bailout_reason == kNoReason) graph_builder_->Bailout(bailout_reason); | 516 if (bailout_reason != kNoReason) graph_builder_->Bailout(bailout_reason); |
| 517 return SetLastStatus(BAILED_OUT); | 517 return SetLastStatus(BAILED_OUT); |
| 518 } else { | 518 } else { |
| 519 chunk_ = LChunk::NewChunk(graph_); | 519 chunk_ = LChunk::NewChunk(graph_); |
| 520 if (chunk_ == NULL) { | 520 if (chunk_ == NULL) { |
| 521 return SetLastStatus(BAILED_OUT); | 521 return SetLastStatus(BAILED_OUT); |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 return SetLastStatus(SUCCEEDED); | 524 return SetLastStatus(SUCCEEDED); |
| 525 } | 525 } |
| 526 | 526 |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 AllowHandleDereference allow_deref; | 1361 AllowHandleDereference allow_deref; |
| 1362 bool tracing_on = info()->IsStub() | 1362 bool tracing_on = info()->IsStub() |
| 1363 ? FLAG_trace_hydrogen_stubs | 1363 ? FLAG_trace_hydrogen_stubs |
| 1364 : (FLAG_trace_hydrogen && | 1364 : (FLAG_trace_hydrogen && |
| 1365 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1365 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1366 return (tracing_on && | 1366 return (tracing_on && |
| 1367 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1367 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 } } // namespace v8::internal | 1370 } } // namespace v8::internal |
| OLD | NEW |