| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 DEFINE_FLAG(bool, trace_optimizing_compiler, false, | 63 DEFINE_FLAG(bool, trace_optimizing_compiler, false, |
| 64 "Trace only optimizing compiler operations."); | 64 "Trace only optimizing compiler operations."); |
| 65 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 65 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
| 66 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 66 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
| 67 DEFINE_FLAG(bool, verify_compiler, false, | 67 DEFINE_FLAG(bool, verify_compiler, false, |
| 68 "Enable compiler verification assertions"); | 68 "Enable compiler verification assertions"); |
| 69 DEFINE_FLAG(int, max_speculative_inlining_attempts, 1, | 69 DEFINE_FLAG(int, max_speculative_inlining_attempts, 1, |
| 70 "Max number of attempts with speculative inlining (precompilation only)"); | 70 "Max number of attempts with speculative inlining (precompilation only)"); |
| 71 | 71 |
| 72 DECLARE_FLAG(bool, background_compilation); | 72 DECLARE_FLAG(bool, background_compilation); |
| 73 DECLARE_FLAG(bool, huge_method_cutoff_in_code_size); |
| 73 DECLARE_FLAG(bool, load_deferred_eagerly); | 74 DECLARE_FLAG(bool, load_deferred_eagerly); |
| 74 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 75 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
| 75 DECLARE_FLAG(bool, trace_inlining_intervals); | 76 DECLARE_FLAG(bool, trace_inlining_intervals); |
| 76 DECLARE_FLAG(bool, trace_irregexp); | 77 DECLARE_FLAG(bool, trace_irregexp); |
| 77 | 78 |
| 78 | 79 |
| 79 bool Compiler::always_optimize_ = false; | 80 bool Compiler::always_optimize_ = false; |
| 80 bool Compiler::allow_recompilation_ = true; | 81 bool Compiler::allow_recompilation_ = true; |
| 81 | 82 |
| 82 #ifndef DART_PRECOMPILED | 83 #ifndef DART_PRECOMPILED |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 const Array& deopt_info_array = | 460 const Array& deopt_info_array = |
| 460 Array::Handle(zone, graph_compiler->CreateDeoptInfo(assembler)); | 461 Array::Handle(zone, graph_compiler->CreateDeoptInfo(assembler)); |
| 461 INC_STAT(thread(), total_code_size, | 462 INC_STAT(thread(), total_code_size, |
| 462 deopt_info_array.Length() * sizeof(uword)); | 463 deopt_info_array.Length() * sizeof(uword)); |
| 463 // Allocates instruction object. Since this occurs only at safepoint, | 464 // Allocates instruction object. Since this occurs only at safepoint, |
| 464 // there can be no concurrent access to the instruction page. | 465 // there can be no concurrent access to the instruction page. |
| 465 const Code& code = Code::Handle( | 466 const Code& code = Code::Handle( |
| 466 Code::FinalizeCode(function, assembler, optimized())); | 467 Code::FinalizeCode(function, assembler, optimized())); |
| 467 code.set_is_optimized(optimized()); | 468 code.set_is_optimized(optimized()); |
| 468 code.set_owner(function); | 469 code.set_owner(function); |
| 470 if (!function.IsOptimizable()) { |
| 471 // A function with huge unoptimized code can become non-optimizable |
| 472 // after generating unoptimized code. |
| 473 function.set_usage_counter(INT_MIN); |
| 474 } |
| 469 | 475 |
| 470 const Array& intervals = graph_compiler->inlined_code_intervals(); | 476 const Array& intervals = graph_compiler->inlined_code_intervals(); |
| 471 INC_STAT(thread(), total_code_size, | 477 INC_STAT(thread(), total_code_size, |
| 472 intervals.Length() * sizeof(uword)); | 478 intervals.Length() * sizeof(uword)); |
| 473 code.SetInlinedIntervals(intervals); | 479 code.SetInlinedIntervals(intervals); |
| 474 | 480 |
| 475 const Array& inlined_id_array = | 481 const Array& inlined_id_array = |
| 476 Array::Handle(zone, graph_compiler->InliningIdToFunction()); | 482 Array::Handle(zone, graph_compiler->InliningIdToFunction()); |
| 477 INC_STAT(thread(), total_code_size, | 483 INC_STAT(thread(), total_code_size, |
| 478 inlined_id_array.Length() * sizeof(uword)); | 484 inlined_id_array.Length() * sizeof(uword)); |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 } | 2037 } |
| 2032 | 2038 |
| 2033 | 2039 |
| 2034 void BackgroundCompiler::EnsureInit(Thread* thread) { | 2040 void BackgroundCompiler::EnsureInit(Thread* thread) { |
| 2035 UNREACHABLE(); | 2041 UNREACHABLE(); |
| 2036 } | 2042 } |
| 2037 | 2043 |
| 2038 #endif // DART_PRECOMPILED | 2044 #endif // DART_PRECOMPILED |
| 2039 | 2045 |
| 2040 } // namespace dart | 2046 } // namespace dart |
| OLD | NEW |