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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 85813002: Revert "Revert "Build new IR for functions returning a constant."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: feedback by kasper Created 7 years, 1 month 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: 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 68646d9c9d8ba5f666e7307140517720efcb158d..44e35ac1ed5fc8017770125eadede7a03e08cc6c 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -19,23 +19,33 @@ class SsaCodeGeneratorTask extends CompilerTask {
// TODO(sra): Attaching positions might be cleaner if the source position
// was on a wrapping node.
SourceFile sourceFile = sourceFileOfElement(element);
- Node expression = element.implementation.parseNode(backend.compiler);
- Token beginToken;
- Token endToken;
- if (expression == null) {
- // Synthesized node. Use the enclosing element for the location.
- beginToken = endToken = element.position();
+ if (compiler.irBuilder.hasIr(element)) {
+ IrFunction function = compiler.irBuilder.getIr(element);
+ node.sourcePosition = new OffsetSourceFileLocation(
+ sourceFile, function.offset, function.sourceName);
+ node.endSourcePosition = new OffsetSourceFileLocation(
+ sourceFile, function.endOffset);
} else {
- beginToken = expression.getBeginToken();
- endToken = expression.getEndToken();
- }
- // TODO(podivilov): find the right sourceFile here and remove offset checks
- // below.
- if (beginToken.charOffset < sourceFile.length) {
- node.sourcePosition = new SourceFileLocation(sourceFile, beginToken);
- }
- if (endToken.charOffset < sourceFile.length) {
- node.endSourcePosition = new SourceFileLocation(sourceFile, endToken);
+ Node expression = element.implementation.parseNode(backend.compiler);
+ Token beginToken;
+ Token endToken;
+ if (expression == null) {
+ // Synthesized node. Use the enclosing element for the location.
+ beginToken = endToken = element.position();
+ } else {
+ beginToken = expression.getBeginToken();
+ endToken = expression.getEndToken();
+ }
+ // TODO(podivilov): find the right sourceFile here and remove offset
+ // checks below.
+ if (beginToken.charOffset < sourceFile.length) {
+ node.sourcePosition =
+ new TokenSourceFileLocation(sourceFile, beginToken);
+ }
+ if (endToken.charOffset < sourceFile.length) {
+ node.endSourcePosition =
+ new TokenSourceFileLocation(sourceFile, endToken);
+ }
}
return node;
}

Powered by Google App Engine
This is Rietveld 408576698