Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 2770563002: Remove dead elements from the MemorySet in load elimination. (Closed)
Patch Set: reuse list Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698