| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/precompiler.h" | 5 #include "vm/precompiler.h" |
| 6 | 6 |
| 7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/branch_optimizer.h" | 10 #include "vm/branch_optimizer.h" |
| (...skipping 3102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3113 const Code& code = | 3113 const Code& code = |
| 3114 Code::Handle(Code::FinalizeCode(function, assembler, optimized())); | 3114 Code::Handle(Code::FinalizeCode(function, assembler, optimized())); |
| 3115 code.set_is_optimized(optimized()); | 3115 code.set_is_optimized(optimized()); |
| 3116 code.set_owner(function); | 3116 code.set_owner(function); |
| 3117 if (!function.IsOptimizable()) { | 3117 if (!function.IsOptimizable()) { |
| 3118 // A function with huge unoptimized code can become non-optimizable | 3118 // A function with huge unoptimized code can become non-optimizable |
| 3119 // after generating unoptimized code. | 3119 // after generating unoptimized code. |
| 3120 function.set_usage_counter(INT_MIN); | 3120 function.set_usage_counter(INT_MIN); |
| 3121 } | 3121 } |
| 3122 | 3122 |
| 3123 const Array& intervals = graph_compiler->inlined_code_intervals(); | |
| 3124 INC_STAT(thread(), total_code_size, intervals.Length() * sizeof(uword)); | |
| 3125 code.SetInlinedIntervals(intervals); | |
| 3126 | |
| 3127 const Array& inlined_id_array = | |
| 3128 Array::Handle(zone, graph_compiler->InliningIdToFunction()); | |
| 3129 INC_STAT(thread(), total_code_size, | |
| 3130 inlined_id_array.Length() * sizeof(uword)); | |
| 3131 code.SetInlinedIdToFunction(inlined_id_array); | |
| 3132 | |
| 3133 const Array& caller_inlining_id_map_array = | |
| 3134 Array::Handle(zone, graph_compiler->CallerInliningIdMap()); | |
| 3135 INC_STAT(thread(), total_code_size, | |
| 3136 caller_inlining_id_map_array.Length() * sizeof(uword)); | |
| 3137 code.SetInlinedCallerIdMap(caller_inlining_id_map_array); | |
| 3138 | |
| 3139 graph_compiler->FinalizePcDescriptors(code); | 3123 graph_compiler->FinalizePcDescriptors(code); |
| 3140 code.set_deopt_info_array(deopt_info_array); | 3124 code.set_deopt_info_array(deopt_info_array); |
| 3141 | 3125 |
| 3142 graph_compiler->FinalizeStackMaps(code); | 3126 graph_compiler->FinalizeStackMaps(code); |
| 3143 graph_compiler->FinalizeVarDescriptors(code); | 3127 graph_compiler->FinalizeVarDescriptors(code); |
| 3144 graph_compiler->FinalizeExceptionHandlers(code); | 3128 graph_compiler->FinalizeExceptionHandlers(code); |
| 3145 graph_compiler->FinalizeStaticCallTargetsTable(code); | 3129 graph_compiler->FinalizeStaticCallTargetsTable(code); |
| 3130 graph_compiler->FinalizeCodeSourceMap(code); |
| 3146 | 3131 |
| 3147 if (optimized()) { | 3132 if (optimized()) { |
| 3148 // Installs code while at safepoint. | 3133 // Installs code while at safepoint. |
| 3149 ASSERT(thread()->IsMutatorThread()); | 3134 ASSERT(thread()->IsMutatorThread()); |
| 3150 function.InstallOptimizedCode(code, /* is_osr = */ false); | 3135 function.InstallOptimizedCode(code, /* is_osr = */ false); |
| 3151 } else { // not optimized. | 3136 } else { // not optimized. |
| 3152 function.set_unoptimized_code(code); | 3137 function.set_unoptimized_code(code); |
| 3153 function.AttachCode(code); | 3138 function.AttachCode(code); |
| 3154 } | 3139 } |
| 3155 ASSERT(!parsed_function()->HasDeferredPrefixes()); | 3140 ASSERT(!parsed_function()->HasDeferredPrefixes()); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3763 | 3748 |
| 3764 ASSERT(FLAG_precompiled_mode); | 3749 ASSERT(FLAG_precompiled_mode); |
| 3765 const bool optimized = function.IsOptimizable(); // False for natives. | 3750 const bool optimized = function.IsOptimizable(); // False for natives. |
| 3766 DartPrecompilationPipeline pipeline(zone, field_type_map); | 3751 DartPrecompilationPipeline pipeline(zone, field_type_map); |
| 3767 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); | 3752 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); |
| 3768 } | 3753 } |
| 3769 | 3754 |
| 3770 #endif // DART_PRECOMPILER | 3755 #endif // DART_PRECOMPILER |
| 3771 | 3756 |
| 3772 } // namespace dart | 3757 } // namespace dart |
| OLD | NEW |