Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: src/compiler.cc

Issue 1179393008: [turbofan] Enable concurrent (re)compilation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Typer life cycle. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler.h ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 #define DEF_VISIT(type) \ 325 #define DEF_VISIT(type) \
326 void Visit##type(type* node) override { \ 326 void Visit##type(type* node) override { \
327 HOptimizedGraphBuilder::Visit##type(node); \ 327 HOptimizedGraphBuilder::Visit##type(node); \
328 } 328 }
329 DECLARATION_NODE_LIST(DEF_VISIT) 329 DECLARATION_NODE_LIST(DEF_VISIT)
330 #undef DEF_VISIT 330 #undef DEF_VISIT
331 }; 331 };
332 332
333 333
334 OptimizedCompileJob::~OptimizedCompileJob() { delete pipeline_; }
335
336
334 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { 337 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
335 DCHECK(info()->IsOptimizing()); 338 DCHECK(info()->IsOptimizing());
336 DCHECK(!info()->IsCompilingForDebugging()); 339 DCHECK(!info()->IsCompilingForDebugging());
337 340
338 // Do not use Crankshaft/TurboFan if we need to be able to set break points. 341 // Do not use Crankshaft/TurboFan if we need to be able to set break points.
339 if (isolate()->debug()->has_break_points()) { 342 if (isolate()->debug()->has_break_points()) {
340 return RetryOptimization(kDebuggerHasBreakPoints); 343 return RetryOptimization(kDebuggerHasBreakPoints);
341 } 344 }
342 345
343 // Limit the number of times we try to optimize functions. 346 // Limit the number of times we try to optimize functions.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } else if (FLAG_turbo_type_feedback) { 396 } else if (FLAG_turbo_type_feedback) {
394 info()->MarkAsTypeFeedbackEnabled(); 397 info()->MarkAsTypeFeedbackEnabled();
395 info()->EnsureFeedbackVector(); 398 info()->EnsureFeedbackVector();
396 } 399 }
397 if (!info()->shared_info()->asm_function() || 400 if (!info()->shared_info()->asm_function() ||
398 FLAG_turbo_asm_deoptimization) { 401 FLAG_turbo_asm_deoptimization) {
399 info()->MarkAsDeoptimizationEnabled(); 402 info()->MarkAsDeoptimizationEnabled();
400 } 403 }
401 404
402 Timer t(this, &time_taken_to_create_graph_); 405 Timer t(this, &time_taken_to_create_graph_);
403 compiler::Pipeline pipeline(info()); 406 pipeline_ = new compiler::Pipeline(info());
404 pipeline.GenerateCode(); 407 if (pipeline_->CreateGraph()) {
405 if (!info()->code().is_null()) {
406 return SetLastStatus(SUCCEEDED); 408 return SetLastStatus(SUCCEEDED);
407 } 409 }
410 delete pipeline_;
411 pipeline_ = nullptr;
408 } 412 }
409 413
410 if (!isolate()->use_crankshaft() || dont_crankshaft) { 414 if (!isolate()->use_crankshaft() || dont_crankshaft) {
411 // Crankshaft is entirely disabled. 415 // Crankshaft is entirely disabled.
412 return SetLastStatus(FAILED); 416 return SetLastStatus(FAILED);
413 } 417 }
414 418
415 Scope* scope = info()->scope(); 419 Scope* scope = info()->scope();
416 if (LUnallocated::TooManyParameters(scope->num_parameters())) { 420 if (LUnallocated::TooManyParameters(scope->num_parameters())) {
417 // Crankshaft would require too many Lithium operands. 421 // Crankshaft would require too many Lithium operands.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 479 }
476 480
477 481
478 OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() { 482 OptimizedCompileJob::Status OptimizedCompileJob::OptimizeGraph() {
479 DisallowHeapAllocation no_allocation; 483 DisallowHeapAllocation no_allocation;
480 DisallowHandleAllocation no_handles; 484 DisallowHandleAllocation no_handles;
481 DisallowHandleDereference no_deref; 485 DisallowHandleDereference no_deref;
482 DisallowCodeDependencyChange no_dependency_change; 486 DisallowCodeDependencyChange no_dependency_change;
483 487
484 DCHECK(last_status() == SUCCEEDED); 488 DCHECK(last_status() == SUCCEEDED);
485 // TODO(turbofan): Currently everything is done in the first phase. 489 // TODO(turbofan): Currently everything is done in the first phase.
Michael Starzinger 2015/06/16 12:23:01 nit: TODO no longer applies, let's drop it.
Benedikt Meurer 2015/06/19 12:33:46 Done.
486 if (!info()->code().is_null()) { 490 if (pipeline_) {
Michael Starzinger 2015/06/16 12:23:01 Should we move this down a few lines so that it is
Benedikt Meurer 2015/06/19 12:33:46 Done.
487 return last_status(); 491 if (pipeline_->OptimizeGraph()) return SetLastStatus(SUCCEEDED);
492 return SetLastStatus(BAILED_OUT);
488 } 493 }
489 494
490 Timer t(this, &time_taken_to_optimize_); 495 Timer t(this, &time_taken_to_optimize_);
491 DCHECK(graph_ != NULL); 496 DCHECK(graph_ != NULL);
492 BailoutReason bailout_reason = kNoReason; 497 BailoutReason bailout_reason = kNoReason;
493 498
494 if (graph_->Optimize(&bailout_reason)) { 499 if (graph_->Optimize(&bailout_reason)) {
495 chunk_ = LChunk::NewChunk(graph_); 500 chunk_ = LChunk::NewChunk(graph_);
496 if (chunk_ != NULL) return SetLastStatus(SUCCEEDED); 501 if (chunk_ != NULL) return SetLastStatus(SUCCEEDED);
497 } else if (bailout_reason != kNoReason) { 502 } else if (bailout_reason != kNoReason) {
498 graph_builder_->Bailout(bailout_reason); 503 graph_builder_->Bailout(bailout_reason);
499 } 504 }
500 505
501 return SetLastStatus(BAILED_OUT); 506 return SetLastStatus(BAILED_OUT);
502 } 507 }
503 508
504 509
505 OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() { 510 OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() {
506 DCHECK(last_status() == SUCCEEDED); 511 DCHECK(last_status() == SUCCEEDED);
507 // TODO(turbofan): Currently everything is done in the first phase. 512 // TODO(turbofan): Currently everything is done in the first phase.
Michael Starzinger 2015/06/16 12:23:01 nit: TODO no longer applies, let's drop it.
Benedikt Meurer 2015/06/19 12:33:46 Done.
508 if (!info()->code().is_null()) { 513 if (pipeline_) {
514 Handle<Code> optimized_code = pipeline_->CreateCode();
Michael Starzinger 2015/06/16 12:23:01 This can now be intergrated into the code below, s
Benedikt Meurer 2015/06/19 12:33:46 Done.
515 if (optimized_code.is_null()) return SetLastStatus(BAILED_OUT);
516 DCHECK(optimized_code.is_identical_to(info()->code()));
509 info()->dependencies()->Commit(info()->code()); 517 info()->dependencies()->Commit(info()->code());
510 if (info()->is_deoptimization_enabled()) { 518 if (info()->is_deoptimization_enabled()) {
511 info()->parse_info()->context()->native_context()->AddOptimizedCode( 519 info()->parse_info()->context()->native_context()->AddOptimizedCode(
512 *info()->code()); 520 *info()->code());
513 } 521 }
514 RecordOptimizationStats(); 522 RecordOptimizationStats();
515 return last_status(); 523 return SetLastStatus(SUCCEEDED);
516 } 524 }
517 525
518 DCHECK(!info()->dependencies()->HasAborted()); 526 DCHECK(!info()->dependencies()->HasAborted());
519 DisallowCodeDependencyChange no_dependency_change; 527 DisallowCodeDependencyChange no_dependency_change;
520 DisallowJavascriptExecution no_js(isolate()); 528 DisallowJavascriptExecution no_js(isolate());
521 { // Scope for timer. 529 { // Scope for timer.
522 Timer timer(this, &time_taken_to_codegen_); 530 Timer timer(this, &time_taken_to_codegen_);
523 DCHECK(chunk_ != NULL); 531 DCHECK(chunk_ != NULL);
524 DCHECK(graph_ != NULL); 532 DCHECK(graph_ != NULL);
525 // Deferred handles reference objects that were accessible during 533 // Deferred handles reference objects that were accessible during
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 1576
1569 1577
1570 #if DEBUG 1578 #if DEBUG
1571 void CompilationInfo::PrintAstForTesting() { 1579 void CompilationInfo::PrintAstForTesting() {
1572 PrintF("--- Source from AST ---\n%s\n", 1580 PrintF("--- Source from AST ---\n%s\n",
1573 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1581 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1574 } 1582 }
1575 #endif 1583 #endif
1576 } // namespace internal 1584 } // namespace internal
1577 } // namespace v8 1585 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698