| 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 2594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2605 void killAffectedBy(HInstruction instruction) { | 2605 void killAffectedBy(HInstruction instruction) { |
| 2606 // Even if [instruction] does not have side effects, it may use non-escaping | 2606 // Even if [instruction] does not have side effects, it may use non-escaping |
| 2607 // objects and store them in a new object, which make these objects | 2607 // objects and store them in a new object, which make these objects |
| 2608 // escaping. | 2608 // escaping. |
| 2609 instruction.inputs.forEach((input) { | 2609 instruction.inputs.forEach((input) { |
| 2610 nonEscapingReceivers.remove(input.nonCheck()); | 2610 nonEscapingReceivers.remove(input.nonCheck()); |
| 2611 }); | 2611 }); |
| 2612 | 2612 |
| 2613 if (instruction.sideEffects.changesInstanceProperty() || | 2613 if (instruction.sideEffects.changesInstanceProperty() || |
| 2614 instruction.sideEffects.changesStaticProperty()) { | 2614 instruction.sideEffects.changesStaticProperty()) { |
| 2615 List<MemberEntity> fieldsToRemove; |
| 2616 List<HInstruction> receiversToRemove = <HInstruction>[]; |
| 2615 fieldValues.forEach((MemberEntity element, map) { | 2617 fieldValues.forEach((MemberEntity element, map) { |
| 2616 if (isFinal(element)) return; | 2618 if (isFinal(element)) return; |
| 2617 map.forEach((receiver, value) { | 2619 map.forEach((receiver, value) { |
| 2618 if (escapes(receiver)) { | 2620 if (escapes(receiver)) { |
| 2619 map[receiver] = null; | 2621 receiversToRemove.add(receiver); |
| 2620 } | 2622 } |
| 2621 }); | 2623 }); |
| 2624 if (receiversToRemove.length == map.length) { |
| 2625 // Remove them all by removing the entire map. |
| 2626 (fieldsToRemove ??= <MemberEntity>[]).add(element); |
| 2627 } else { |
| 2628 receiversToRemove.forEach(map.remove); |
| 2629 } |
| 2630 receiversToRemove.clear(); |
| 2622 }); | 2631 }); |
| 2632 fieldsToRemove?.forEach(fieldValues.remove); |
| 2623 } | 2633 } |
| 2624 | 2634 |
| 2625 if (instruction.sideEffects.changesIndex()) { | 2635 if (instruction.sideEffects.changesIndex()) { |
| 2626 keyedValues.forEach((receiver, map) { | 2636 keyedValues.forEach((receiver, map) { |
| 2627 if (escapes(receiver)) { | 2637 if (escapes(receiver)) { |
| 2628 map.forEach((index, value) { | 2638 map.forEach((index, value) { |
| 2629 map[index] = null; | 2639 map[index] = null; |
| 2630 }); | 2640 }); |
| 2631 } | 2641 } |
| 2632 }); | 2642 }); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2788 | 2798 |
| 2789 keyedValues.forEach((receiver, values) { | 2799 keyedValues.forEach((receiver, values) { |
| 2790 result.keyedValues[receiver] = | 2800 result.keyedValues[receiver] = |
| 2791 new Map<HInstruction, HInstruction>.from(values); | 2801 new Map<HInstruction, HInstruction>.from(values); |
| 2792 }); | 2802 }); |
| 2793 | 2803 |
| 2794 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2804 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2795 return result; | 2805 return result; |
| 2796 } | 2806 } |
| 2797 } | 2807 } |
| OLD | NEW |