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

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

Issue 1250633002: Add operators test to source_mapping_test. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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_nodes.dart ('k') | pkg/compiler/lib/src/io/position_information.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/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 50b77b13a4ba51caee691132083c9b9e2a321e2d..acd9d89488b238d88230babafc5e7b98f537d6b3 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -599,7 +599,7 @@ class TransformingVisitor extends RecursiveVisitor {
}
/// Inserts [insertedCode] before [node].
- ///
+ ///
/// [node] will end up in the hole of [insertedCode], and [insertedCode]
/// will become rooted where [node] was.
void insertBefore(Expression node, CpsFragment insertedCode) {
@@ -614,7 +614,7 @@ class TransformingVisitor extends RecursiveVisitor {
// We want to recompute the types for [insertedCode] without
// traversing the entire subtree of [node]. Temporarily close the
// term with a dummy node while recomputing types.
- context.body = new Unreachable();
+ context.body = new Unreachable();
new ParentVisitor().visit(insertedCode.root);
reanalyze(insertedCode.root);
@@ -692,13 +692,13 @@ class TransformingVisitor extends RecursiveVisitor {
return;
}
- if (condition is ApplyBuiltinOperator &&
+ if (condition is ApplyBuiltinOperator &&
condition.operator == BuiltinOperator.LooseEq) {
Primitive leftArg = condition.arguments[0].definition;
Primitive rightArg = condition.arguments[1].definition;
AbstractValue left = getValue(leftArg);
AbstractValue right = getValue(rightArg);
- if (right.isNullConstant &&
+ if (right.isNullConstant &&
lattice.isDefinitelyNotNumStringBool(left)) {
// Rewrite:
// if (x == null) S1 else S2
@@ -707,7 +707,7 @@ class TransformingVisitor extends RecursiveVisitor {
Branch branch = new Branch(new IsTrue(leftArg), falseCont, trueCont);
replaceSubtree(node, branch);
return;
- } else if (left.isNullConstant &&
+ } else if (left.isNullConstant &&
lattice.isDefinitelyNotNumStringBool(right)) {
Branch branch = new Branch(new IsTrue(rightArg), falseCont, trueCont);
replaceSubtree(node, branch);
@@ -725,7 +725,8 @@ class TransformingVisitor extends RecursiveVisitor {
Primitive left,
Primitive right) {
Primitive prim =
- new ApplyBuiltinOperator(operator, <Primitive>[left, right]);
+ new ApplyBuiltinOperator(operator, <Primitive>[left, right],
+ node.sourceInformation);
LetPrim let = makeLetPrimInvoke(prim, cont);
replaceSubtree(node, let);
visitLetPrim(let);
@@ -843,7 +844,7 @@ class TransformingVisitor extends RecursiveVisitor {
}
/// Create a check that throws if [index] is not a valid index on [list].
- ///
+ ///
/// This function assumes that [index] is an integer.
///
/// Returns a CPS fragment whose context is the branch where no error
@@ -894,7 +895,7 @@ class TransformingVisitor extends RecursiveVisitor {
int count = 0;
for (Reference ref = list.firstRef; ref != null; ref = ref.next) {
Node use = ref.parent;
- if (use is InvokeMethod &&
+ if (use is InvokeMethod &&
(use.selector.isIndex || use.selector.isIndexSet) &&
getDartReceiver(use) == list) {
++count;
@@ -918,7 +919,7 @@ class TransformingVisitor extends RecursiveVisitor {
if (!lattice.isDefinitelyNativeList(listValue, allowNull: true)) {
return false;
}
- bool isFixedLength =
+ bool isFixedLength =
lattice.isDefinitelyFixedNativeList(listValue, allowNull: true);
bool isMutable =
lattice.isDefinitelyMutableNativeList(listValue, allowNull: true);
@@ -1041,23 +1042,23 @@ class TransformingVisitor extends RecursiveVisitor {
MutableVariable current = new MutableVariable(new LoopItemEntity());
// Rewrite all uses of the iterator.
- while (iterator.firstRef != null) {
+ while (iterator.firstRef != null) {
InvokeMethod use = iterator.firstRef.parent;
Continuation useCont = use.continuation.definition;
- if (use.selector == currentSelector) {
+ if (use.selector == currentSelector) {
// Rewrite iterator.current to a use of the 'current' variable.
Parameter result = useCont.parameters.single;
if (result.hint != null) {
// If 'current' was originally moved into a named variable, use
// that variable name for the mutable variable.
- current.hint = result.hint;
+ current.hint = result.hint;
}
- LetPrim let =
+ LetPrim let =
makeLetPrimInvoke(new GetMutableVariable(current), useCont);
replaceSubtree(use, let);
} else {
assert (use.selector == moveNextSelector);
- // Rewrite iterator.moveNext() to:
+ // Rewrite iterator.moveNext() to:
//
// if (index < list.length) {
// current = null;
@@ -1075,16 +1076,16 @@ class TransformingVisitor extends RecursiveVisitor {
// We must check for concurrent modification when calling moveNext.
// When moveNext is used as a loop condition, the check prevents
- // `index < list.length` from becoming the loop condition, and we
+ // `index < list.length` from becoming the loop condition, and we
// get code like this:
//
// while (true) {
// if (originalLength !== list.length) throw;
- // if (index < list.length) {
+ // if (index < list.length) {
// ...
- // } else {
- // ...
- // break;
+ // } else {
+ // ...
+ // break;
// }
// }
//
@@ -1097,17 +1098,17 @@ class TransformingVisitor extends RecursiveVisitor {
// if (originalLength !== list.length) throw;
// }
//
- // The check before the loop can often be eliminated because it
+ // The check before the loop can often be eliminated because it
// follows immediately after the 'iterator' call.
InteriorNode parent = getEffectiveParent(use);
if (!isFixedLength) {
if (parent is Continuation && parent.isRecursive) {
// Check for concurrent modification before every invocation
// of the continuation.
- // TODO(asgerf): Do this in a continuation so multiple
+ // TODO(asgerf): Do this in a continuation so multiple
// continues can share the same code.
- for (Reference ref = parent.firstRef;
- ref != null;
+ for (Reference ref = parent.firstRef;
+ ref != null;
ref = ref.next) {
Expression invocationCaller = ref.parent;
if (getEffectiveParent(invocationCaller) == iteratorCont) {
@@ -1137,7 +1138,7 @@ class TransformingVisitor extends RecursiveVisitor {
..invokeContinuation(useCont, [falseBranch.makeFalse()]);
// Return true if there are more element.
- cps.setMutable(current,
+ cps.setMutable(current,
cps.letPrim(new GetIndex(list, cps.getMutable(index))));
cps.setMutable(index, cps.applyBuiltin(
BuiltinOperator.NumAdd,
@@ -1459,18 +1460,21 @@ class TransformingVisitor extends RecursiveVisitor {
// If value is null or a number, we can skip the typeof test.
return new ApplyBuiltinOperator(
BuiltinOperator.IsFloor,
- <Primitive>[prim, prim]);
+ <Primitive>[prim, prim],
+ node.sourceInformation);
}
if (lattice.isDefinitelyNotNonIntegerDouble(value)) {
// If the value cannot be a non-integer double, but might not be a
// number at all, we can skip the Math.floor test.
return new ApplyBuiltinOperator(
BuiltinOperator.IsNumber,
- <Primitive>[prim]);
+ <Primitive>[prim],
+ node.sourceInformation);
}
return new ApplyBuiltinOperator(
BuiltinOperator.IsNumberAndFloor,
- <Primitive>[prim, prim, prim]);
+ <Primitive>[prim, prim, prim],
+ node.sourceInformation);
}
return null;
}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/io/position_information.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698