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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 return SetLastStatus(FAILED); | 368 return SetLastStatus(FAILED); |
369 } | 369 } |
370 if (FLAG_hydrogen_stats) { | 370 if (FLAG_hydrogen_stats) { |
371 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); | 371 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 DCHECK(info()->shared_info()->has_deoptimization_support()); | 375 DCHECK(info()->shared_info()->has_deoptimization_support()); |
376 | 376 |
377 // Check the enabling conditions for TurboFan. | 377 // Check the enabling conditions for TurboFan. |
| 378 bool dont_crankshaft = info()->shared_info()->dont_crankshaft(); |
378 if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || | 379 if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || |
| 380 (dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0) || |
379 info()->closure()->PassesFilter(FLAG_turbo_filter)) && | 381 info()->closure()->PassesFilter(FLAG_turbo_filter)) && |
380 (FLAG_turbo_osr || !info()->is_osr())) { | 382 (FLAG_turbo_osr || !info()->is_osr())) { |
381 // Use TurboFan for the compilation. | 383 // Use TurboFan for the compilation. |
382 if (FLAG_trace_opt) { | 384 if (FLAG_trace_opt) { |
383 OFStream os(stdout); | 385 OFStream os(stdout); |
384 os << "[compiling method " << Brief(*info()->closure()) | 386 os << "[compiling method " << Brief(*info()->closure()) |
385 << " using TurboFan"; | 387 << " using TurboFan"; |
386 if (info()->is_osr()) os << " OSR"; | 388 if (info()->is_osr()) os << " OSR"; |
387 os << "]" << std::endl; | 389 os << "]" << std::endl; |
388 } | 390 } |
389 | 391 |
390 if (info()->shared_info()->asm_function()) { | 392 if (info()->shared_info()->asm_function()) { |
391 info()->MarkAsContextSpecializing(); | 393 info()->MarkAsContextSpecializing(); |
392 } else if (FLAG_turbo_type_feedback) { | 394 } else if (FLAG_turbo_type_feedback) { |
393 info()->MarkAsTypeFeedbackEnabled(); | 395 info()->MarkAsTypeFeedbackEnabled(); |
394 info()->EnsureFeedbackVector(); | 396 info()->EnsureFeedbackVector(); |
395 } | 397 } |
396 | 398 |
397 Timer t(this, &time_taken_to_create_graph_); | 399 Timer t(this, &time_taken_to_create_graph_); |
398 compiler::Pipeline pipeline(info()); | 400 compiler::Pipeline pipeline(info()); |
399 pipeline.GenerateCode(); | 401 pipeline.GenerateCode(); |
400 if (!info()->code().is_null()) { | 402 if (!info()->code().is_null()) { |
401 return SetLastStatus(SUCCEEDED); | 403 return SetLastStatus(SUCCEEDED); |
402 } | 404 } |
403 } | 405 } |
404 | 406 |
405 if (!isolate()->use_crankshaft()) { | 407 if (!isolate()->use_crankshaft() || dont_crankshaft) { |
406 // Crankshaft is entirely disabled. | 408 // Crankshaft is entirely disabled. |
407 return SetLastStatus(FAILED); | 409 return SetLastStatus(FAILED); |
408 } | 410 } |
409 | 411 |
410 Scope* scope = info()->scope(); | 412 Scope* scope = info()->scope(); |
411 if (LUnallocated::TooManyParameters(scope->num_parameters())) { | 413 if (LUnallocated::TooManyParameters(scope->num_parameters())) { |
412 // Crankshaft would require too many Lithium operands. | 414 // Crankshaft would require too many Lithium operands. |
413 return AbortOptimization(kTooManyParameters); | 415 return AbortOptimization(kTooManyParameters); |
414 } | 416 } |
415 | 417 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 static bool Renumber(ParseInfo* parse_info) { | 733 static bool Renumber(ParseInfo* parse_info) { |
732 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(), | 734 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(), |
733 parse_info->function())) { | 735 parse_info->function())) { |
734 return false; | 736 return false; |
735 } | 737 } |
736 Handle<SharedFunctionInfo> shared_info = parse_info->shared_info(); | 738 Handle<SharedFunctionInfo> shared_info = parse_info->shared_info(); |
737 if (!shared_info.is_null()) { | 739 if (!shared_info.is_null()) { |
738 FunctionLiteral* lit = parse_info->function(); | 740 FunctionLiteral* lit = parse_info->function(); |
739 shared_info->set_ast_node_count(lit->ast_node_count()); | 741 shared_info->set_ast_node_count(lit->ast_node_count()); |
740 MaybeDisableOptimization(shared_info, lit->dont_optimize_reason()); | 742 MaybeDisableOptimization(shared_info, lit->dont_optimize_reason()); |
| 743 shared_info->set_dont_crankshaft(lit->flags()->Contains(kDontCrankshaft)); |
741 shared_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 744 shared_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
742 } | 745 } |
743 return true; | 746 return true; |
744 } | 747 } |
745 | 748 |
746 | 749 |
747 bool Compiler::Analyze(ParseInfo* info) { | 750 bool Compiler::Analyze(ParseInfo* info) { |
748 DCHECK(info->function() != NULL); | 751 DCHECK(info->function() != NULL); |
749 if (!Rewriter::Rewrite(info)) return false; | 752 if (!Rewriter::Rewrite(info)) return false; |
750 if (!Scope::Analyze(info)) return false; | 753 if (!Scope::Analyze(info)) return false; |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 } | 1564 } |
1562 | 1565 |
1563 | 1566 |
1564 #if DEBUG | 1567 #if DEBUG |
1565 void CompilationInfo::PrintAstForTesting() { | 1568 void CompilationInfo::PrintAstForTesting() { |
1566 PrintF("--- Source from AST ---\n%s\n", | 1569 PrintF("--- Source from AST ---\n%s\n", |
1567 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1570 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1568 } | 1571 } |
1569 #endif | 1572 #endif |
1570 } } // namespace v8::internal | 1573 } } // namespace v8::internal |
OLD | NEW |