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/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 return SetLastStatus(FAILED); | 404 return SetLastStatus(FAILED); |
405 } | 405 } |
406 if (FLAG_hydrogen_stats) { | 406 if (FLAG_hydrogen_stats) { |
407 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); | 407 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 DCHECK(info()->shared_info()->has_deoptimization_support()); | 411 DCHECK(info()->shared_info()->has_deoptimization_support()); |
412 DCHECK(!info()->is_first_compile()); | 412 DCHECK(!info()->is_first_compile()); |
413 | 413 |
414 // Check the enabling conditions for TurboFan. | 414 bool optimization_disabled = info()->shared_info()->optimization_disabled(); |
415 bool dont_crankshaft = info()->shared_info()->dont_crankshaft(); | 415 bool dont_crankshaft = info()->shared_info()->dont_crankshaft(); |
416 if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || | 416 |
417 (dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0) || | 417 // Check the enabling conditions for Turbofan. |
418 info()->closure()->PassesFilter(FLAG_turbo_filter)) && | 418 // 1. "use asm" code. |
419 (FLAG_turbo_osr || !info()->is_osr())) { | 419 bool is_turbofanable_asm = FLAG_turbo_asm && |
| 420 info()->shared_info()->asm_function() && |
| 421 !optimization_disabled; |
| 422 |
| 423 // 2. Fallback for features unsupported by Crankshaft. |
| 424 bool is_unsupported_by_crankshaft_but_turbofanable = |
| 425 dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0 && |
| 426 !optimization_disabled; |
| 427 |
| 428 // 3. Explicitly enabled by the command-line filter. |
| 429 bool passes_turbo_filter = info()->closure()->PassesFilter(FLAG_turbo_filter); |
| 430 |
| 431 // If this is OSR request, OSR must be enabled by Turbofan. |
| 432 bool passes_osr_test = FLAG_turbo_osr || !info()->is_osr(); |
| 433 |
| 434 if ((is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable || |
| 435 passes_turbo_filter) && |
| 436 passes_osr_test) { |
420 // Use TurboFan for the compilation. | 437 // Use TurboFan for the compilation. |
421 if (FLAG_trace_opt) { | 438 if (FLAG_trace_opt) { |
422 OFStream os(stdout); | 439 OFStream os(stdout); |
423 os << "[compiling method " << Brief(*info()->closure()) | 440 os << "[compiling method " << Brief(*info()->closure()) |
424 << " using TurboFan"; | 441 << " using TurboFan"; |
425 if (info()->is_osr()) os << " OSR"; | 442 if (info()->is_osr()) os << " OSR"; |
426 os << "]" << std::endl; | 443 os << "]" << std::endl; |
427 } | 444 } |
428 | 445 |
429 if (info()->shared_info()->asm_function()) { | 446 if (info()->shared_info()->asm_function()) { |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 } | 1855 } |
1839 | 1856 |
1840 #if DEBUG | 1857 #if DEBUG |
1841 void CompilationInfo::PrintAstForTesting() { | 1858 void CompilationInfo::PrintAstForTesting() { |
1842 PrintF("--- Source from AST ---\n%s\n", | 1859 PrintF("--- Source from AST ---\n%s\n", |
1843 PrettyPrinter(isolate()).PrintProgram(literal())); | 1860 PrettyPrinter(isolate()).PrintProgram(literal())); |
1844 } | 1861 } |
1845 #endif | 1862 #endif |
1846 } // namespace internal | 1863 } // namespace internal |
1847 } // namespace v8 | 1864 } // namespace v8 |
OLD | NEW |