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

Unified Diff: pkg/compiler/lib/src/ssa/interceptor_simplifier.dart

Issue 2215133003: Avoid modifying the set returned by getInterceptorsOn() (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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/interceptor_simplifier.dart
diff --git a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
index 3249c313357fdb6f353367c70c68989ffc902d1f..6a5c82d2ed01dd4300f5259e859fdbec90c5a97f 100644
--- a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
+++ b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
@@ -232,17 +232,24 @@ class SsaSimplifyInterceptors extends HBaseVisitor
if (interceptedClasses.contains(helpers.jsNumberClass) &&
!(interceptedClasses.contains(helpers.jsDoubleClass) ||
interceptedClasses.contains(helpers.jsIntClass))) {
+ Set<ClassElement> required;
for (HInstruction user in node.usedBy) {
if (user is! HInvoke) continue;
Set<ClassElement> intercepted =
backend.getInterceptedClassesOn(user.selector.name);
if (intercepted.contains(helpers.jsIntClass)) {
- interceptedClasses.add(helpers.jsIntClass);
+ required ??= new Set<ClassElement>();
+ required.add(helpers.jsIntClass);
}
if (intercepted.contains(helpers.jsDoubleClass)) {
- interceptedClasses.add(helpers.jsDoubleClass);
+ required ??= new Set<ClassElement>();
+ required.add(helpers.jsDoubleClass);
}
}
+ // Don't modify the result of [backend.getInterceptedClassesOn].
+ if (required != null) {
+ interceptedClasses = interceptedClasses.union(required);
+ }
}
} else {
interceptedClasses = new Set<ClassElement>();
« 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