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

Unified Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10809004: Attach source map positions to returns, sends, and some operators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « no previous file | tests/compiler/dart2js/source_mapping_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/builder.dart
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index 920ae1ac647bf1f1873ac8dad8590a30408fd8b5..ad6ece14120e6e5ebb869afaf763d286260be500 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -1165,11 +1165,19 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
current.add(instruction);
}
+ void addWithPosition(HInstruction instruction, Node node) {
+ add(attachPosition(instruction, node));
+ }
+
void push(HInstruction instruction) {
add(instruction);
stack.add(instruction);
}
+ void pushWithPosition(HInstruction instruction, Node node) {
+ push(attachPosition(instruction, node));
+ }
+
HInstruction pop() {
return stack.removeLast();
}
@@ -1590,7 +1598,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
assert(node.argumentsNode is Prefix);
visit(node.receiver);
HNot not = new HNot(popBoolified());
- push(not);
+ pushWithPosition(not, node);
}
void visitUnary(Send node, Operator op) {
@@ -1599,8 +1607,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
assert(op.token.kind !== PLUS_TOKEN);
HInstruction operand = pop();
- HInstruction target = attachPosition(
- new HStatic(interceptors.getPrefixOperatorInterceptor(op)), node);
+ HInstruction target =
+ new HStatic(interceptors.getPrefixOperatorInterceptor(op));
add(target);
HInvokeUnary result;
String value = op.source.stringValue;
@@ -1620,7 +1628,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
return;
}
}
- push(result);
+ pushWithPosition(result, node);
}
void visitBinary(HInstruction left, Operator op, HInstruction right) {
@@ -1632,78 +1640,78 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
case "+":
case "++":
case "+=":
- push(new HAdd(target, left, right));
+ pushWithPosition(new HAdd(target, left, right), op);
break;
case "-":
case "--":
case "-=":
- push(new HSubtract(target, left, right));
+ pushWithPosition(new HSubtract(target, left, right), op);
break;
case "*":
case "*=":
- push(new HMultiply(target, left, right));
+ pushWithPosition(new HMultiply(target, left, right), op);
break;
case "/":
case "/=":
- push(new HDivide(target, left, right));
+ pushWithPosition(new HDivide(target, left, right), op);
break;
case "~/":
case "~/=":
- push(new HTruncatingDivide(target, left, right));
+ pushWithPosition(new HTruncatingDivide(target, left, right), op);
break;
case "%":
case "%=":
- push(new HModulo(target, left, right));
+ pushWithPosition(new HModulo(target, left, right), op);
break;
case "<<":
case "<<=":
- push(new HShiftLeft(target, left, right));
+ pushWithPosition(new HShiftLeft(target, left, right), op);
break;
case ">>":
case ">>=":
- push(new HShiftRight(target, left, right));
+ pushWithPosition(new HShiftRight(target, left, right), op);
break;
case "|":
case "|=":
- push(new HBitOr(target, left, right));
+ pushWithPosition(new HBitOr(target, left, right), op);
break;
case "&":
case "&=":
- push(new HBitAnd(target, left, right));
+ pushWithPosition(new HBitAnd(target, left, right), op);
break;
case "^":
case "^=":
- push(new HBitXor(target, left, right));
+ pushWithPosition(new HBitXor(target, left, right), op);
break;
case "==":
- push(new HEquals(target, left, right));
+ pushWithPosition(new HEquals(target, left, right), op);
break;
case "===":
- push(new HIdentity(target, left, right));
+ pushWithPosition(new HIdentity(target, left, right), op);
break;
case "!==":
HIdentity eq = new HIdentity(target, left, right);
add(eq);
- push(new HNot(eq));
+ pushWithPosition(new HNot(eq), op);
break;
case "<":
- push(new HLess(target, left, right));
+ pushWithPosition(new HLess(target, left, right), op);
break;
case "<=":
- push(new HLessEqual(target, left, right));
+ pushWithPosition(new HLessEqual(target, left, right), op);
break;
case ">":
- push(new HGreater(target, left, right));
+ pushWithPosition(new HGreater(target, left, right), op);
break;
case ">=":
- push(new HGreaterEqual(target, left, right));
+ pushWithPosition(new HGreaterEqual(target, left, right), op);
break;
case "!=":
HEquals eq = new HEquals(target, left, right);
add(eq);
HBoolify bl = new HBoolify(eq);
add(bl);
- push(new HNot(bl));
+ pushWithPosition(new HNot(bl), op);
break;
default: compiler.unimplemented("SsaBuilder.visitBinary");
}
@@ -2012,7 +2020,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
addDynamicSendArgumentsToList(node, inputs);
// The first entry in the inputs list is the receiver.
- push(new HInvokeDynamicMethod(selector, dartMethodName, inputs));
+ pushWithPosition(new HInvokeDynamicMethod(selector, dartMethodName, inputs),
+ node);
if (isNotEquals) {
HNot not = new HNot(popBoolified());
@@ -2035,7 +2044,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
var inputs = <HInstruction>[];
inputs.add(closureTarget);
addDynamicSendArgumentsToList(node, inputs);
- push(new HInvokeClosure(selector, inputs));
+ pushWithPosition(new HInvokeClosure(selector, inputs), node);
}
void handleForeignJs(Send node) {
@@ -2283,7 +2292,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
HType elementType = computeType(element);
HInstruction newInstance = new HInvokeStatic(selector, inputs, elementType);
- push(newInstance);
+ pushWithPosition(newInstance, node);
TypeAnnotation annotation = getTypeAnnotationFromSend(node);
Type type = elements.getType(annotation);
@@ -2326,7 +2335,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
// exception at runtime.
compiler.cancel('Unimplemented non-matching static call', node: node);
}
- push(new HInvokeStatic(selector, inputs));
+ pushWithPosition(new HInvokeStatic(selector, inputs), node);
} else {
if (element.kind == ElementKind.GETTER) {
target = new HInvokeStatic(Selector.GETTER, inputs);
@@ -2334,7 +2343,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
inputs = <HInstruction>[target];
}
addDynamicSendArgumentsToList(node, inputs);
- push(new HInvokeClosure(selector, inputs));
+ pushWithPosition(new HInvokeClosure(selector, inputs), node);
}
}
@@ -2554,7 +2563,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
visit(node.expression);
value = pop();
}
- close(new HReturn(value)).addSuccessor(graph.exit);
+ close(attachPosition(new HReturn(value), node)).addSuccessor(graph.exit);
}
visitThrow(Throw node) {
« no previous file with comments | « no previous file | tests/compiler/dart2js/source_mapping_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698