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

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

Issue 10695174: [RFC] Associate AST nodes with HIstructions when building HGraph. (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 | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index d0cadc72110bf1a9198a0b34bddf55c541fb787d..431f501127b9dfe4d4509a17ab91a172d0b9a162 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -13,7 +13,7 @@ class SsaCodeGeneratorTask extends CompilerTask {
CodeBuffer buildJavaScriptFunction(FunctionElement element,
String parameters,
- String body) {
+ CodeBuffer body) {
String extraSpace = "";
// Members are emitted inside a JavaScript object literal. To line up the
// indentation we want the closing curly brace to be indented by one space.
@@ -57,7 +57,7 @@ class SsaCodeGeneratorTask extends CompilerTask {
codegen.visitGraph(graph);
FunctionElement element = work.element;
- String code;
+ CodeBuffer code;
if (element.isInstanceMember()
&& element.enclosingElement.isClass()
&& element.enclosingElement.isNative()
@@ -70,9 +70,10 @@ class SsaCodeGeneratorTask extends CompilerTask {
StringBuffer buffer = new StringBuffer();
native.generateMethodWithPrototypeCheckForElement(
compiler, buffer, element, '${codegen.buffer}', parameters);
- code = buffer.toString();
+ code = new CodeBuffer();
+ code.add(buffer);
} else {
- code = codegen.buffer.toString();
+ code = codegen.buffer;
}
return buildJavaScriptFunction(element, parameters, code);
});
@@ -88,9 +89,11 @@ class SsaCodeGeneratorTask extends CompilerTask {
backend, work, parameters, parameterNames);
codegen.visitGraph(graph);
- String body = '${codegen.setup}${codegen.buffer}';
+ CodeBuffer code = new CodeBuffer();
+ code.add(codegen.setup);
+ code.add(codegen.buffer);
return buildJavaScriptFunction(
- work.element, codegen.newParameters.toString(), body);
+ work.element, codegen.newParameters.toString(), code);
});
}
@@ -655,6 +658,9 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
visit(HInstruction node, int expectedPrecedenceForNode) {
int oldPrecedence = this.expectedPrecedence;
this.expectedPrecedence = expectedPrecedenceForNode;
+ if (node.sourcePosition !== null) {
+ buffer.setSourceLocation(work.element, node.sourcePosition);
+ }
node.accept(this);
this.expectedPrecedence = oldPrecedence;
}
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698