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

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

Issue 2246623002: Delete CPS IR (Closed) Base URL: git@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 | « pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart ('k') | pkg/compiler/lib/src/cps_ir/effects.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index b936885cbe2258635e2e479776d41033a44bb1dc..0000000000000000000000000000000000000000
--- a/pkg/compiler/lib/src/cps_ir/eagerly_load_statics.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart2js.cps_ir.eagerly_load_statics;
-
-import '../elements/elements.dart';
-import 'cps_fragment.dart';
-import 'cps_ir_nodes.dart';
-import 'optimizers.dart' show Pass;
-
-/// Replaces [GetLazyStatic] with [GetStatic] when the static field is known
-/// to have been initialized.
-///
-/// Apart from [GetStatic] generating better code, this improves the side-effect
-/// analysis in the [GVN] pass, since [GetStatic] has no effects.
-class EagerlyLoadStatics extends TrampolineRecursiveVisitor implements Pass {
- String get passName => 'Eagerly load statics';
-
- Map<FieldElement, Primitive> initializerFor = <FieldElement, Primitive>{};
-
- final Map<Continuation, Map<FieldElement, Primitive>> initializersAt =
- <Continuation, Map<FieldElement, Primitive>>{};
-
- static Map<FieldElement, Primitive> cloneFieldMap(
- Map<FieldElement, Primitive> map) {
- return new Map<FieldElement, Primitive>.from(map);
- }
-
- void rewrite(FunctionDefinition node) {
- visit(node.body);
- }
-
- Expression traverseLetPrim(LetPrim node) {
- Expression next = node.body;
- visit(node.primitive);
- return next;
- }
-
- Expression traverseLetCont(LetCont node) {
- for (Continuation cont in node.continuations) {
- initializersAt[cont] = cloneFieldMap(initializerFor);
- push(cont);
- }
- return node.body;
- }
-
- Expression traverseLetHandler(LetHandler node) {
- initializersAt[node.handler] = cloneFieldMap(initializerFor);
- push(node.handler);
- return node.body;
- }
-
- Expression traverseContinuation(Continuation cont) {
- initializerFor = initializersAt[cont];
- return cont.body;
- }
-
- void visitGetLazyStatic(GetLazyStatic node) {
- Primitive initializer = initializerFor[node.element];
- 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,
- sourceInformation: node.sourceInformation)..type = node.type;
- node.replaceWith(newNode);
- } else {
- initializerFor[node.element] = node;
- }
- }
-
- void visitSetStatic(SetStatic node) {
- initializerFor.putIfAbsent(node.element, () => node);
- }
-}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart ('k') | pkg/compiler/lib/src/cps_ir/effects.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698