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

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

Issue 1645053002: dart2js cps: Refactor tracking of side effects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Clarification Created 4 years, 11 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
Index: pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart
diff --git a/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart b/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart
index 6f733e31f02e5df72ad70f907d39342804537361..42a33593e8552491db5ce9c31e9ead8cda5f4e73 100644
--- a/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart
+++ b/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart
@@ -7,6 +7,7 @@ library dart2js.cps_ir.eagerly_load_statics;
import 'cps_ir_nodes.dart';
import 'optimizers.dart' show Pass;
import '../elements/elements.dart';
+import 'cps_fragment.dart';
/// Replaces [GetLazyStatic] with [GetStatic] when the static field is known
/// to have been initialized.
@@ -30,6 +31,12 @@ class EagerlyLoadStatics extends TrampolineRecursiveVisitor implements Pass {
visit(node.body);
}
+ Expression traverseLetPrim(LetPrim node) {
Siggi Cherem (dart-lang) 2016/02/17 20:53:23 seems that this file change is unrelated to the re
asgerf 2016/02/29 12:48:17 It's not unrelated. It is meant to copy over of t
+ Expression next = node.body;
+ visit(node.primitive);
+ return next;
+ }
+
Expression traverseLetCont(LetCont node) {
for (Continuation cont in node.continuations) {
initializersAt[cont] = cloneFieldMap(initializerFor);
@@ -51,10 +58,13 @@ class EagerlyLoadStatics extends TrampolineRecursiveVisitor implements Pass {
void visitGetLazyStatic(GetLazyStatic node) {
Primitive initializer = initializerFor[node.element];
- if (initializer != null) {
- GetStatic newNode = new GetStatic.witnessed(node.element, initializer,
- node.sourceInformation);
- newNode.type = node.type;
+ if (initializer is GetLazyStatic && initializer.isFinal) {
+ // No reason to create a GetStatic when the field is final.
+ node.replaceWithFragment(new CpsFragment(), initializer);
+ } else if (initializer != null) {
+ GetStatic newNode = new GetStatic.witnessed(node.element,
+ initializer, node.sourceInformation)
+ ..type = node.type;
node.replaceWith(newNode);
} else {
initializerFor[node.element] = node;

Powered by Google App Engine
This is Rietveld 408576698