| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 bool FlowGraphCompiler::CanOptimizeFunction() const { | 163 bool FlowGraphCompiler::CanOptimizeFunction() const { |
| 164 return CanOptimize() && !parsed_function().function().HasBreakpoint(); | 164 return CanOptimize() && !parsed_function().function().HasBreakpoint(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 | 167 |
| 168 bool FlowGraphCompiler::CanOSRFunction() const { | 168 bool FlowGraphCompiler::CanOSRFunction() const { |
| 169 return FLAG_use_osr & CanOptimizeFunction() && !is_optimizing(); | 169 return FLAG_use_osr & CanOptimizeFunction() && !is_optimizing(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 | 172 |
| 173 static bool IsEmptyBlock(BlockEntryInstr* block) { |
| 174 return !block->HasParallelMove() && |
| 175 block->next()->IsGoto() && |
| 176 !block->next()->AsGoto()->HasParallelMove(); |
| 177 } |
| 178 |
| 179 |
| 173 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { | 180 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { |
| 174 BlockInfo* block_info = block_info_[block->postorder_number()]; | 181 BlockInfo* block_info = block_info_[block->postorder_number()]; |
| 175 | 182 |
| 176 // Break out of cycles in the control flow graph. | 183 // Break out of cycles in the control flow graph. |
| 177 if (block_info->is_marked()) { | 184 if (block_info->is_marked()) { |
| 178 return; | 185 return; |
| 179 } | 186 } |
| 180 block_info->mark(); | 187 block_info->mark(); |
| 181 | 188 |
| 182 if (block->IsEmptyBlock()) { | 189 if (IsEmptyBlock(block)) { |
| 183 // For empty blocks, record a corresponding nonempty target as their | 190 // For empty blocks, record a corresponding nonempty target as their |
| 184 // jump label. | 191 // jump label. |
| 185 BlockEntryInstr* target = block->next()->AsGoto()->successor(); | 192 BlockEntryInstr* target = block->next()->AsGoto()->successor(); |
| 186 CompactBlock(target); | 193 CompactBlock(target); |
| 187 block_info->set_jump_label(GetJumpLabel(target)); | 194 block_info->set_jump_label(GetJumpLabel(target)); |
| 188 } | 195 } |
| 189 } | 196 } |
| 190 | 197 |
| 191 | 198 |
| 192 void FlowGraphCompiler::CompactBlocks() { | 199 void FlowGraphCompiler::CompactBlocks() { |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 | 1109 |
| 1103 for (int i = 0; i < len; i++) { | 1110 for (int i = 0; i < len; i++) { |
| 1104 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1111 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
| 1105 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1112 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
| 1106 ic_data.GetCountAt(i))); | 1113 ic_data.GetCountAt(i))); |
| 1107 } | 1114 } |
| 1108 sorted->Sort(HighestCountFirst); | 1115 sorted->Sort(HighestCountFirst); |
| 1109 } | 1116 } |
| 1110 | 1117 |
| 1111 } // namespace dart | 1118 } // namespace dart |
| OLD | NEW |