OLD | NEW |
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 info()->MarkAsContextSpecializing(); | 391 info()->MarkAsContextSpecializing(); |
392 } else if (FLAG_turbo_type_feedback) { | 392 } else if (FLAG_turbo_type_feedback) { |
393 info()->MarkAsTypeFeedbackEnabled(); | 393 info()->MarkAsTypeFeedbackEnabled(); |
394 info()->EnsureFeedbackVector(); | 394 info()->EnsureFeedbackVector(); |
395 } | 395 } |
396 | 396 |
397 Timer t(this, &time_taken_to_create_graph_); | 397 Timer t(this, &time_taken_to_create_graph_); |
398 compiler::Pipeline pipeline(info()); | 398 compiler::Pipeline pipeline(info()); |
399 pipeline.GenerateCode(); | 399 pipeline.GenerateCode(); |
400 if (!info()->code().is_null()) { | 400 if (!info()->code().is_null()) { |
401 info()->dependencies()->Commit(info()->code()); | |
402 return SetLastStatus(SUCCEEDED); | 401 return SetLastStatus(SUCCEEDED); |
403 } | 402 } |
404 } | 403 } |
405 | 404 |
406 // Do not use Crankshaft if the code is intended to be serialized. | 405 // Do not use Crankshaft if the code is intended to be serialized. |
407 if (!isolate()->use_crankshaft()) return SetLastStatus(FAILED); | 406 if (!isolate()->use_crankshaft()) return SetLastStatus(FAILED); |
408 | 407 |
409 if (scope->HasIllegalRedeclaration()) { | 408 if (scope->HasIllegalRedeclaration()) { |
410 // Crankshaft cannot handle illegal redeclarations. | 409 // Crankshaft cannot handle illegal redeclarations. |
411 return AbortOptimization(kFunctionWithIllegalRedeclaration); | 410 return AbortOptimization(kFunctionWithIllegalRedeclaration); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 479 } |
481 | 480 |
482 return SetLastStatus(BAILED_OUT); | 481 return SetLastStatus(BAILED_OUT); |
483 } | 482 } |
484 | 483 |
485 | 484 |
486 OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() { | 485 OptimizedCompileJob::Status OptimizedCompileJob::GenerateCode() { |
487 DCHECK(last_status() == SUCCEEDED); | 486 DCHECK(last_status() == SUCCEEDED); |
488 // TODO(turbofan): Currently everything is done in the first phase. | 487 // TODO(turbofan): Currently everything is done in the first phase. |
489 if (!info()->code().is_null()) { | 488 if (!info()->code().is_null()) { |
| 489 info()->dependencies()->Commit(info()->code()); |
490 if (FLAG_turbo_deoptimization) { | 490 if (FLAG_turbo_deoptimization) { |
491 info()->parse_info()->context()->native_context()->AddOptimizedCode( | 491 info()->parse_info()->context()->native_context()->AddOptimizedCode( |
492 *info()->code()); | 492 *info()->code()); |
493 } | 493 } |
494 RecordOptimizationStats(); | 494 RecordOptimizationStats(); |
495 return last_status(); | 495 return last_status(); |
496 } | 496 } |
497 | 497 |
498 DCHECK(!info()->dependencies()->HasAborted()); | 498 DCHECK(!info()->dependencies()->HasAborted()); |
499 DisallowCodeDependencyChange no_dependency_change; | 499 DisallowCodeDependencyChange no_dependency_change; |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 } | 1545 } |
1546 | 1546 |
1547 | 1547 |
1548 #if DEBUG | 1548 #if DEBUG |
1549 void CompilationInfo::PrintAstForTesting() { | 1549 void CompilationInfo::PrintAstForTesting() { |
1550 PrintF("--- Source from AST ---\n%s\n", | 1550 PrintF("--- Source from AST ---\n%s\n", |
1551 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1551 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1552 } | 1552 } |
1553 #endif | 1553 #endif |
1554 } } // namespace v8::internal | 1554 } } // namespace v8::internal |
OLD | NEW |