| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 if (scope->HasIllegalRedeclaration()) { | 351 if (scope->HasIllegalRedeclaration()) { |
| 352 return AbortOptimization(kFunctionWithIllegalRedeclaration); | 352 return AbortOptimization(kFunctionWithIllegalRedeclaration); |
| 353 } | 353 } |
| 354 | 354 |
| 355 // Check the whitelist for Crankshaft. | 355 // Check the whitelist for Crankshaft. |
| 356 if (!info()->closure()->PassesFilter(FLAG_hydrogen_filter)) { | 356 if (!info()->closure()->PassesFilter(FLAG_hydrogen_filter)) { |
| 357 return AbortOptimization(kHydrogenFilter); | 357 return AbortOptimization(kHydrogenFilter); |
| 358 } | 358 } |
| 359 | 359 |
| 360 // Crankshaft requires a version of fullcode with deoptimization support. | 360 // Optimization requires a version of fullcode with deoptimization support. |
| 361 // Recompile the unoptimized version of the code if the current version | 361 // Recompile the unoptimized version of the code if the current version |
| 362 // doesn't have deoptimization support already. | 362 // doesn't have deoptimization support already. |
| 363 // Otherwise, if we are gathering compilation time and space statistics | 363 // Otherwise, if we are gathering compilation time and space statistics |
| 364 // for hydrogen, gather baseline statistics for a fullcode compilation. | 364 // for hydrogen, gather baseline statistics for a fullcode compilation. |
| 365 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); | 365 bool should_recompile = !info()->shared_info()->has_deoptimization_support(); |
| 366 if (should_recompile || FLAG_hydrogen_stats) { | 366 if (should_recompile || FLAG_hydrogen_stats) { |
| 367 base::ElapsedTimer timer; | 367 base::ElapsedTimer timer; |
| 368 if (FLAG_hydrogen_stats) { | 368 if (FLAG_hydrogen_stats) { |
| 369 timer.Start(); | 369 timer.Start(); |
| 370 } | 370 } |
| 371 if (!Compiler::EnsureDeoptimizationSupport(info())) { | 371 if (!Compiler::EnsureDeoptimizationSupport(info())) { |
| 372 return SetLastStatus(FAILED); | 372 return SetLastStatus(FAILED); |
| 373 } | 373 } |
| 374 if (FLAG_hydrogen_stats) { | 374 if (FLAG_hydrogen_stats) { |
| 375 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); | 375 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 | 378 |
| 379 DCHECK(info()->shared_info()->has_deoptimization_support()); | 379 DCHECK(info()->shared_info()->has_deoptimization_support()); |
| 380 | 380 |
| 381 // Check the whitelist for TurboFan. | 381 // Check the enabling conditions for TurboFan. |
| 382 if ((FLAG_turbo_asm && info()->shared_info()->asm_function()) || | 382 if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || |
| 383 info()->closure()->PassesFilter(FLAG_turbo_filter)) { | 383 info()->closure()->PassesFilter(FLAG_turbo_filter)) && |
| 384 (FLAG_turbo_osr || !info()->is_osr())) { |
| 384 if (FLAG_trace_opt) { | 385 if (FLAG_trace_opt) { |
| 385 OFStream os(stdout); | 386 OFStream os(stdout); |
| 386 os << "[compiling method " << Brief(*info()->closure()) | 387 os << "[compiling method " << Brief(*info()->closure()) |
| 387 << " using TurboFan"; | 388 << " using TurboFan"; |
| 388 if (info()->is_osr()) os << " OSR"; | 389 if (info()->is_osr()) os << " OSR"; |
| 389 os << "]" << std::endl; | 390 os << "]" << std::endl; |
| 390 } | 391 } |
| 391 | 392 |
| 392 if (info()->shared_info()->asm_function()) { | 393 if (info()->shared_info()->asm_function()) { |
| 393 info()->MarkAsContextSpecializing(); | 394 info()->MarkAsContextSpecializing(); |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 } | 1543 } |
| 1543 | 1544 |
| 1544 | 1545 |
| 1545 #if DEBUG | 1546 #if DEBUG |
| 1546 void CompilationInfo::PrintAstForTesting() { | 1547 void CompilationInfo::PrintAstForTesting() { |
| 1547 PrintF("--- Source from AST ---\n%s\n", | 1548 PrintF("--- Source from AST ---\n%s\n", |
| 1548 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1549 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1549 } | 1550 } |
| 1550 #endif | 1551 #endif |
| 1551 } } // namespace v8::internal | 1552 } } // namespace v8::internal |
| OLD | NEW |