| 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 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 6 import '../common/names.dart' show Selectors; | 6 import '../common/names.dart' show Selectors; |
| 7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2386 // and we don't want "if (x==null) return x;" to convert between JavaScript | 2386 // and we don't want "if (x==null) return x;" to convert between JavaScript |
| 2387 // 'null' and 'undefined'. | 2387 // 'null' and 'undefined'. |
| 2388 } | 2388 } |
| 2389 | 2389 |
| 2390 collectTargets(HInstruction instruction, List<HBasicBlock> trueTargets, | 2390 collectTargets(HInstruction instruction, List<HBasicBlock> trueTargets, |
| 2391 List<HBasicBlock> falseTargets) { | 2391 List<HBasicBlock> falseTargets) { |
| 2392 for (HInstruction user in instruction.usedBy) { | 2392 for (HInstruction user in instruction.usedBy) { |
| 2393 if (user is HIf) { | 2393 if (user is HIf) { |
| 2394 trueTargets?.add(user.thenBlock); | 2394 trueTargets?.add(user.thenBlock); |
| 2395 falseTargets?.add(user.elseBlock); | 2395 falseTargets?.add(user.elseBlock); |
| 2396 } else if (user is HLoopBranch) { |
| 2397 trueTargets?.add(user.block.successors.first); |
| 2398 // Don't insert refinements on else-branch - may be a critical edge |
| 2399 // block which we currently need to keep empty (except for phis). |
| 2396 } else if (user is HNot) { | 2400 } else if (user is HNot) { |
| 2397 collectTargets(user, falseTargets, trueTargets); | 2401 collectTargets(user, falseTargets, trueTargets); |
| 2398 } else if (user is HPhi) { | 2402 } else if (user is HPhi) { |
| 2399 List<HInstruction> inputs = user.inputs; | 2403 List<HInstruction> inputs = user.inputs; |
| 2400 if (inputs.length == 2) { | 2404 if (inputs.length == 2) { |
| 2401 assert(inputs.contains(instruction)); | 2405 assert(inputs.contains(instruction)); |
| 2402 HInstruction other = inputs[(inputs[0] == instruction) ? 1 : 0]; | 2406 HInstruction other = inputs[(inputs[0] == instruction) ? 1 : 0]; |
| 2403 if (other.isConstantTrue()) { | 2407 if (other.isConstantTrue()) { |
| 2404 // The condition flows to a HPhi(true, user), which means that a | 2408 // The condition flows to a HPhi(true, user), which means that a |
| 2405 // downstream HIf has true-branch control flow that does not depend | 2409 // downstream HIf has true-branch control flow that does not depend |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 | 2986 |
| 2983 keyedValues.forEach((receiver, values) { | 2987 keyedValues.forEach((receiver, values) { |
| 2984 result.keyedValues[receiver] = | 2988 result.keyedValues[receiver] = |
| 2985 new Map<HInstruction, HInstruction>.from(values); | 2989 new Map<HInstruction, HInstruction>.from(values); |
| 2986 }); | 2990 }); |
| 2987 | 2991 |
| 2988 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2992 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2989 return result; | 2993 return result; |
| 2990 } | 2994 } |
| 2991 } | 2995 } |
| OLD | NEW |