| 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 5a005af20f51bbcc6e053e2913a37c82c3dd0c4f..2c9564370e95597fb548586e81b32b911f3fb435 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/gvn.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/gvn.dart
|
| @@ -127,13 +127,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.
|
| @@ -675,12 +684,13 @@ class GvnVectorBuilder extends DeepRecursiveVisitor {
|
| vector = [GvnCode.GET_INDEX, effectNumbers.indexableContent];
|
| }
|
|
|
| - processGetStatic(GetStatic node) {
|
| + visitGetStatic(GetStatic node) {
|
| if (isImmutable(node.element)) {
|
| vector = [GvnCode.GET_STATIC, node.element];
|
| } else {
|
| vector = [GvnCode.GET_STATIC, node.element, effectNumbers.staticField];
|
| }
|
| + // Suppress visit to witness argument.
|
| }
|
|
|
| processGetLazyStatic(GetLazyStatic node) {
|
|
|