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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/redundant_join.dart

Issue 1311353008: dart2js cps: Use a strictness flag on Branch instead of rewriting. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 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.redundant_join_elimination; 5 library dart2js.cps_ir.redundant_join_elimination;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import 'optimizers.dart'; 8 import 'optimizers.dart';
9 9
10 /// Eliminates redundant join points. 10 /// Eliminates redundant join points.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (!branchCont.hasMultipleUses) return; 87 if (!branchCont.hasMultipleUses) return;
88 88
89 // It might be beneficial to rewrite calls to recursive continuations, 89 // It might be beneficial to rewrite calls to recursive continuations,
90 // but we currently do not support this. 90 // but we currently do not support this.
91 if (branchCont.isRecursive) return; 91 if (branchCont.isRecursive) return;
92 92
93 // Check that the branching condition is a parameter on the 93 // Check that the branching condition is a parameter on the
94 // enclosing continuation. 94 // enclosing continuation.
95 // Note: Do not use the parent pointer for this check, because parameters 95 // Note: Do not use the parent pointer for this check, because parameters
96 // are temporarily shared between different continuations during this pass. 96 // are temporarily shared between different continuations during this pass.
97 IsTrue isTrue = branch.condition; 97 Primitive condition = branch.condition.definition;
98 Primitive condition = isTrue.value.definition;
99 int parameterIndex = branchCont.parameters.indexOf(condition); 98 int parameterIndex = branchCont.parameters.indexOf(condition);
100 if (parameterIndex == -1) return; 99 if (parameterIndex == -1) return;
101 100
102 // Check that all callers hit a fixed branch, and count the number 101 // Check that all callers hit a fixed branch, and count the number
103 // of times each branch is hit. 102 // of times each branch is hit.
104 // We know all callers are InvokeContinuations because they are the only 103 // We know all callers are InvokeContinuations because they are the only
105 // valid uses of a multi-use continuation. 104 // valid uses of a multi-use continuation.
106 int trueHits = 0, falseHits = 0; 105 int trueHits = 0, falseHits = 0;
107 InvokeContinuation trueCall, falseCall; 106 InvokeContinuation trueCall, falseCall;
108 for (Reference ref = branchCont.firstRef; ref != null; ref = ref.next) { 107 for (Reference ref = branchCont.firstRef; ref != null; ref = ref.next) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 }); 265 });
267 } 266 }
268 267
269 processReference(Reference ref) { 268 processReference(Reference ref) {
270 Parameter target = renaming[ref.definition]; 269 Parameter target = renaming[ref.definition];
271 if (target != null) { 270 if (target != null) {
272 ref.changeTo(target); 271 ref.changeTo(target);
273 } 272 }
274 } 273 }
275 } 274 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart ('k') | pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698