Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
| index 638b0b52bfeabf82458b4288955b5d65f7d5a5d0..45130660145f090e15bf44bb5f3a0270be26f1ee 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
| @@ -31,15 +31,14 @@ class SsaCodeGeneratorTask extends CompilerTask { |
| } |
| // TODO(podivilov): find the right sourceFile here and remove offset |
| // checks below. |
| + var sourcePosition, endSourcePosition; |
| if (beginToken.charOffset < sourceFile.length) { |
| - node.sourcePosition = |
| - new TokenSourceFileLocation(sourceFile, beginToken); |
| + sourcePosition = new TokenSourceFileLocation(sourceFile, beginToken); |
| } |
| if (endToken.charOffset < sourceFile.length) { |
| - node.endSourcePosition = |
| - new TokenSourceFileLocation(sourceFile, endToken); |
| + endSourcePosition = new TokenSourceFileLocation(sourceFile, endToken); |
| } |
| - return node; |
| + return node.withPosition(sourcePosition, endSourcePosition); |
| } |
| SourceFile sourceFileOfElement(Element element) { |
| @@ -204,7 +203,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| void pushStatement(js.Statement statement, [HInstruction instruction]) { |
| assert(expressionStack.isEmpty); |
| if (instruction != null) { |
| - attachLocation(statement, instruction); |
| + statement = attachLocation(statement, instruction); |
| } |
| currentContainer.statements.add(statement); |
| } |
| @@ -228,7 +227,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| */ |
| push(js.Expression expression, [HInstruction instruction]) { |
| if (instruction != null) { |
| - attachLocation(expression, instruction); |
| + expression = attachLocation(expression, instruction); |
| } |
| expressionStack.add(expression); |
| } |
| @@ -238,20 +237,19 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| } |
| attachLocationToLast(HInstruction instruction) { |
| - attachLocation(expressionStack.last, instruction); |
| + int index = expressionStack.length - 1; |
| + expressionStack[index] = |
| + attachLocation(expressionStack[index], instruction); |
| } |
| js.Node attachLocation(js.Node jsNode, HInstruction instruction) { |
| - jsNode.sourcePosition = instruction.sourcePosition; |
| - return jsNode; |
| + return jsNode.withLocation(instruction.sourcePosition); |
| } |
| js.Node attachLocationRange(js.Node jsNode, |
| SourceFileLocation sourcePosition, |
| SourceFileLocation endSourcePosition) { |
| - jsNode.sourcePosition = sourcePosition; |
| - jsNode.endSourcePosition = endSourcePosition; |
| - return jsNode; |
| + return jsNode.withPosition(sourcePosition, endSourcePosition); |
| } |
| void preGenerateMethod(HGraph graph) { |
| @@ -920,7 +918,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| compiler.internalError(condition.conditionExpression, |
| 'Unexpected loop kind: ${info.kind}.'); |
| } |
| - attachLocationRange(loop, info.sourcePosition, info.endSourcePosition); |
| + loop = attachLocationRange(loop, info.sourcePosition, info.endSourcePosition); |
|
floitsch
2014/04/28 12:28:11
long line.
sra1
2014/04/28 18:24:09
Done.
|
| js.Statement result = loop; |
| if (info.kind == HLoopBlockInformation.SWITCH_CONTINUE_LOOP) { |
| String continueLabelString = |
| @@ -2001,7 +1999,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| arguments.add(pop()); |
| } |
| js.Call value = new js.Call(jsHelper, arguments); |
| - attachLocation(value, location); |
| + value = attachLocation(value, location); |
| // BUG(4906): Using throw/return here adds to the size of the generated code |
| // but it has the advantage of explicitly telling the JS engine that |
| // this code path will terminate abruptly. Needs more work. |
| @@ -2022,7 +2020,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| js.VariableUse jsHelper = |
| new js.VariableUse(backend.namer.isolateAccess(helper)); |
| js.Call value = new js.Call(jsHelper, [pop()]); |
| - attachLocation(value, argument); |
| + value = attachLocation(value, argument); |
| push(value, node); |
| } |