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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart2js.cps_ir.gvn; 5 library dart2js.cps_ir.gvn;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import '../universe/side_effects.dart'; 8 import '../universe/side_effects.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import 'optimizers.dart' show Pass; 10 import 'optimizers.dart' show Pass;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 loopHeaderFor[prim] = currentLoopHeader; 103 loopHeaderFor[prim] = currentLoopHeader;
104 104
105 if (prim is Refinement) { 105 if (prim is Refinement) {
106 // Do not share refinements (they have no runtime or code size cost), and 106 // Do not share refinements (they have no runtime or code size cost), and
107 // do not put them in the GVN table because GvnVectorBuilder unfolds 107 // do not put them in the GVN table because GvnVectorBuilder unfolds
108 // refinements by itself. 108 // refinements by itself.
109 return next; 109 return next;
110 } 110 }
111 111
112 // Update effect numbers due to side effects from a static initializer.
113 // GetLazyStatic is GVN'ed like a GetStatic, but the effects of the static
114 // initializer occur before reading the field.
115 if (prim is GetLazyStatic) {
116 visit(prim);
117 }
118
112 // Compute the GVN vector for this computation. 119 // Compute the GVN vector for this computation.
113 List vector = gvnVectorBuilder.make(prim, effectNumbers); 120 List vector = gvnVectorBuilder.make(prim, effectNumbers);
114 121
115 // Update effect numbers due to side effects. 122 // Update effect numbers due to side effects.
116 // Do this after computing the GVN vector so the primitive's GVN is not 123 // Do this after computing the GVN vector so the primitive's GVN is not
117 // influenced by its own side effects. 124 // influenced by its own side effects, except in the case of GetLazyStatic.
118 visit(prim); 125 if (prim is! GetLazyStatic) {
126 visit(prim);
127 }
119 128
120 if (vector == null) { 129 if (vector == null) {
121 // The primitive is not GVN'able. Move on. 130 // The primitive is not GVN'able. Move on.
122 return next; 131 return next;
123 } 132 }
124 133
125 // Compute the GVN for this primitive. 134 // Compute the GVN for this primitive.
126 int gvn = gvnTable.insert(vector); 135 int gvn = gvnTable.insert(vector);
127 gvnFor[prim] = gvn; 136 gvnFor[prim] = gvn;
128 137
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 706
698 @override 707 @override
699 processReference(Reference ref) { 708 processReference(Reference ref) {
700 callback(ref); 709 callback(ref);
701 } 710 }
702 711
703 static void forEach(Primitive node, ReferenceCallback callback) { 712 static void forEach(Primitive node, ReferenceCallback callback) {
704 new InputVisitor(callback).visit(node); 713 new InputVisitor(callback).visit(node);
705 } 714 }
706 } 715 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698