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

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

Issue 1743283002: dart2js cps: Use definitions by default, not references. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix long lines and use helpers that we already have Created 4 years, 10 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/redundant_join.dart
diff --git a/pkg/compiler/lib/src/cps_ir/redundant_join.dart b/pkg/compiler/lib/src/cps_ir/redundant_join.dart
index f1191ff5e17a46cb7ddf4b115bed1f7d99374319..6b2ee85d43a20edce5b929f126c11d0e10caf337 100644
--- a/pkg/compiler/lib/src/cps_ir/redundant_join.dart
+++ b/pkg/compiler/lib/src/cps_ir/redundant_join.dart
@@ -80,7 +80,7 @@ class RedundantJoinEliminator extends TrampolineRecursiveVisitor implements Pass
// enclosing continuation.
// Note: Do not use the parent pointer for this check, because parameters
// are temporarily shared between different continuations during this pass.
- Primitive condition = branch.condition.definition;
+ Primitive condition = branch.condition;
int parameterIndex = branchCont.parameters.indexOf(condition);
if (parameterIndex == -1) return;
@@ -92,7 +92,7 @@ class RedundantJoinEliminator extends TrampolineRecursiveVisitor implements Pass
InvokeContinuation trueCall, falseCall;
for (Reference ref = branchCont.firstRef; ref != null; ref = ref.next) {
InvokeContinuation invoke = ref.parent;
- Primitive argument = invoke.arguments[parameterIndex].definition;
+ Primitive argument = invoke.argument(parameterIndex);
if (argument is! Constant) return; // Branching condition is unknown.
Constant constant = argument;
if (isTruthyConstant(constant.value, strict: branch.isStrictCheck)) {
@@ -139,7 +139,7 @@ class RedundantJoinEliminator extends TrampolineRecursiveVisitor implements Pass
Expression use = ref.parent;
if (use is InvokeContinuation) {
for (Parameter param in branchCont.parameters) {
- use.arguments.add(new Reference<Primitive>(param)..parent = use);
+ use.argumentRefs.add(new Reference<Primitive>(param)..parent = use);
Siggi Cherem (dart-lang) 2016/02/29 18:00:00 80 col
asgerf 2016/03/01 12:06:59 Done.
}
} else {
// The branch will be eliminated, so don't worry about updating it.
@@ -153,8 +153,8 @@ class RedundantJoinEliminator extends TrampolineRecursiveVisitor implements Pass
assert(branchCont.body == branch);
- Continuation trueCont = branch.trueContinuation.definition;
- Continuation falseCont = branch.falseContinuation.definition;
+ Continuation trueCont = branch.trueContinuation;
+ Continuation falseCont = branch.falseContinuation;
assert(branchCont != trueCont);
assert(branchCont != falseCont);
@@ -168,19 +168,19 @@ class RedundantJoinEliminator extends TrampolineRecursiveVisitor implements Pass
while (branchCont.firstRef != null) {
Reference reference = branchCont.firstRef;
InvokeContinuation invoke = branchCont.firstRef.parent;
- Constant condition = invoke.arguments[parameterIndex].definition;
+ Constant condition = invoke.argument(parameterIndex);
if (isTruthyConstant(condition.value, strict: branch.isStrictCheck)) {
- invoke.continuation.changeTo(trueCont);
+ invoke.continuationRef.changeTo(trueCont);
} else {
- invoke.continuation.changeTo(falseCont);
+ invoke.continuationRef.changeTo(falseCont);
}
assert(branchCont.firstRef != reference);
}
// Remove the now-unused branchCont continuation.
assert(branchCont.hasNoUses);
- branch.trueContinuation.unlink();
- branch.falseContinuation.unlink();
+ branch.trueContinuationRef.unlink();
+ branch.falseContinuationRef.unlink();
outerLetCont.continuations.remove(branchCont);
if (outerLetCont.continuations.isEmpty) {
outerLetCont.remove();

Powered by Google App Engine
This is Rietveld 408576698