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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/optimize.dart
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 4c207eae876470b17bf1d2fd405481959244a981..95207b804a022af21a9c99f4ad77b5d591b53961 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -2612,14 +2612,24 @@ class MemorySet {
if (instruction.sideEffects.changesInstanceProperty() ||
instruction.sideEffects.changesStaticProperty()) {
+ List<MemberEntity> fieldsToRemove;
+ List<HInstruction> receiversToRemove = <HInstruction>[];
fieldValues.forEach((MemberEntity element, map) {
if (isFinal(element)) return;
map.forEach((receiver, value) {
if (escapes(receiver)) {
- map[receiver] = null;
+ receiversToRemove.add(receiver);
}
});
+ if (receiversToRemove.length == map.length) {
+ // Remove them all by removing the entire map.
+ (fieldsToRemove ??= <MemberEntity>[]).add(element);
+ } else {
+ receiversToRemove.forEach(map.remove);
+ }
+ receiversToRemove.clear();
});
+ fieldsToRemove?.forEach(fieldValues.remove);
}
if (instruction.sideEffects.changesIndex()) {
« 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