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

Unified Diff: pkg/compiler/lib/src/cps_ir/gvn.dart

Issue 1521553003: dart2js cps: Replace GetLazyStatic with GetStatic. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
Index: pkg/compiler/lib/src/cps_ir/gvn.dart
diff --git a/pkg/compiler/lib/src/cps_ir/gvn.dart b/pkg/compiler/lib/src/cps_ir/gvn.dart
index 02379d85c1a5e3493d6acda9c84e6beb317f30f5..e8df8391e6a4a4fbaac49e59daab96549cd21601 100644
--- a/pkg/compiler/lib/src/cps_ir/gvn.dart
+++ b/pkg/compiler/lib/src/cps_ir/gvn.dart
@@ -109,13 +109,22 @@ class GVN extends TrampolineRecursiveVisitor implements Pass {
return next;
}
+ // Update effect numbers due to side effects from a static initializer.
+ // GetLazyStatic is GVN'ed like a GetStatic, but the effects of the static
+ // initializer occur before reading the field.
+ if (prim is GetLazyStatic) {
+ visit(prim);
+ }
+
// Compute the GVN vector for this computation.
List vector = gvnVectorBuilder.make(prim, effectNumbers);
// Update effect numbers due to side effects.
// Do this after computing the GVN vector so the primitive's GVN is not
- // influenced by its own side effects.
- visit(prim);
+ // influenced by its own side effects, except in the case of GetLazyStatic.
+ if (prim is! GetLazyStatic) {
+ visit(prim);
+ }
if (vector == null) {
// The primitive is not GVN'able. Move on.

Powered by Google App Engine
This is Rietveld 408576698