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/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 FLAG_deoptimize_filter != NULL && | 218 FLAG_deoptimize_filter != NULL && |
219 strstr(parsed_function().function().ToFullyQualifiedCString(), | 219 strstr(parsed_function().function().ToFullyQualifiedCString(), |
220 FLAG_deoptimize_filter) != NULL) { | 220 FLAG_deoptimize_filter) != NULL) { |
221 return true; | 221 return true; |
222 } | 222 } |
223 return false; | 223 return false; |
224 } | 224 } |
225 | 225 |
226 | 226 |
227 static bool IsEmptyBlock(BlockEntryInstr* block) { | 227 static bool IsEmptyBlock(BlockEntryInstr* block) { |
228 return !block->HasNonRedundantParallelMove() && | 228 return !block->IsCatchBlockEntry() && |
| 229 !block->HasNonRedundantParallelMove() && |
229 block->next()->IsGoto() && | 230 block->next()->IsGoto() && |
230 !block->next()->AsGoto()->HasNonRedundantParallelMove(); | 231 !block->next()->AsGoto()->HasNonRedundantParallelMove(); |
231 } | 232 } |
232 | 233 |
233 | 234 |
234 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { | 235 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { |
235 BlockInfo* block_info = block_info_[block->postorder_number()]; | 236 BlockInfo* block_info = block_info_[block->postorder_number()]; |
236 | 237 |
237 // Break out of cycles in the control flow graph. | 238 // Break out of cycles in the control flow graph. |
238 if (block_info->is_marked()) { | 239 if (block_info->is_marked()) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 281 |
281 | 282 |
282 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { | 283 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { |
283 if (!is_optimizing()) { | 284 if (!is_optimizing()) { |
284 if (instr->CanBecomeDeoptimizationTarget() && !instr->IsGoto()) { | 285 if (instr->CanBecomeDeoptimizationTarget() && !instr->IsGoto()) { |
285 // Instructions that can be deoptimization targets need to record kDeopt | 286 // Instructions that can be deoptimization targets need to record kDeopt |
286 // PcDescriptor corresponding to their deopt id. GotoInstr records its | 287 // PcDescriptor corresponding to their deopt id. GotoInstr records its |
287 // own so that it can control the placement. | 288 // own so that it can control the placement. |
288 AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 289 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
289 instr->deopt_id(), | 290 instr->deopt_id(), |
290 Scanner::kNoSourcePos); | 291 instr->token_pos()); |
291 } | 292 } |
292 AllocateRegistersLocally(instr); | 293 AllocateRegistersLocally(instr); |
293 } else if (instr->MayThrow() && | 294 } else if (instr->MayThrow() && |
294 (CurrentTryIndex() != CatchClauseNode::kInvalidTryIndex)) { | 295 (CurrentTryIndex() != CatchClauseNode::kInvalidTryIndex)) { |
295 // Optimized try-block: Sync locals to fixed stack locations. | 296 // Optimized try-block: Sync locals to fixed stack locations. |
296 EmitTrySync(instr, CurrentTryIndex()); | 297 EmitTrySync(instr, CurrentTryIndex()); |
297 } | 298 } |
298 } | 299 } |
299 | 300 |
300 | 301 |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 } | 1102 } |
1102 } | 1103 } |
1103 | 1104 |
1104 if (locs->out(0).IsRegister()) { | 1105 if (locs->out(0).IsRegister()) { |
1105 // Fixed output registers are allowed to overlap with | 1106 // Fixed output registers are allowed to overlap with |
1106 // temps and inputs. | 1107 // temps and inputs. |
1107 blocked_registers[locs->out(0).reg()] = true; | 1108 blocked_registers[locs->out(0).reg()] = true; |
1108 } | 1109 } |
1109 | 1110 |
1110 // Do not allocate known registers. | 1111 // Do not allocate known registers. |
1111 blocked_registers[CTX] = true; | |
1112 blocked_registers[SPREG] = true; | 1112 blocked_registers[SPREG] = true; |
1113 blocked_registers[FPREG] = true; | 1113 blocked_registers[FPREG] = true; |
1114 if (TMP != kNoRegister) { | 1114 if (TMP != kNoRegister) { |
1115 blocked_registers[TMP] = true; | 1115 blocked_registers[TMP] = true; |
1116 } | 1116 } |
1117 if (TMP2 != kNoRegister) { | 1117 if (TMP2 != kNoRegister) { |
1118 blocked_registers[TMP2] = true; | 1118 blocked_registers[TMP2] = true; |
1119 } | 1119 } |
1120 if (PP != kNoRegister) { | 1120 if (PP != kNoRegister) { |
1121 blocked_registers[PP] = true; | 1121 blocked_registers[PP] = true; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 return (reg != kNoRegister) ? (1 << reg) : 0; | 1378 return (reg != kNoRegister) ? (1 << reg) : 0; |
1379 } | 1379 } |
1380 | 1380 |
1381 | 1381 |
1382 ParallelMoveResolver::ScratchRegisterScope::ScratchRegisterScope( | 1382 ParallelMoveResolver::ScratchRegisterScope::ScratchRegisterScope( |
1383 ParallelMoveResolver* resolver, Register blocked) | 1383 ParallelMoveResolver* resolver, Register blocked) |
1384 : resolver_(resolver), | 1384 : resolver_(resolver), |
1385 reg_(kNoRegister), | 1385 reg_(kNoRegister), |
1386 spilled_(false) { | 1386 spilled_(false) { |
1387 uword blocked_mask = MaskBit(blocked) | 1387 uword blocked_mask = MaskBit(blocked) |
1388 | MaskBit(CTX) | |
1389 | MaskBit(SPREG) | 1388 | MaskBit(SPREG) |
1390 | MaskBit(FPREG) | 1389 | MaskBit(FPREG) |
1391 | MaskBit(TMP) | 1390 | MaskBit(TMP) |
1392 | MaskBit(TMP2) | 1391 | MaskBit(TMP2) |
1393 | MaskBit(PP); | 1392 | MaskBit(PP); |
1394 if (resolver->compiler_->intrinsic_mode()) { | 1393 if (resolver->compiler_->intrinsic_mode()) { |
1395 // Block additional registers that must be preserved for intrinsics. | 1394 // Block additional registers that must be preserved for intrinsics. |
1396 blocked_mask |= MaskBit(ARGS_DESC_REG); | 1395 blocked_mask |= MaskBit(ARGS_DESC_REG); |
1397 } | 1396 } |
1398 reg_ = static_cast<Register>( | 1397 reg_ = static_cast<Register>( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 threshold = FLAG_optimization_counter_scale * basic_blocks + | 1490 threshold = FLAG_optimization_counter_scale * basic_blocks + |
1492 FLAG_min_optimization_counter_threshold; | 1491 FLAG_min_optimization_counter_threshold; |
1493 if (threshold > FLAG_optimization_counter_threshold) { | 1492 if (threshold > FLAG_optimization_counter_threshold) { |
1494 threshold = FLAG_optimization_counter_threshold; | 1493 threshold = FLAG_optimization_counter_threshold; |
1495 } | 1494 } |
1496 } | 1495 } |
1497 return threshold; | 1496 return threshold; |
1498 } | 1497 } |
1499 | 1498 |
1500 } // namespace dart | 1499 } // namespace dart |
OLD | NEW |