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

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

Issue 10386161: Start compiler refactoring to support more than a single backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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/native_handler.dart ('k') | lib/compiler/implementation/ssa/closure.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 2c7427e5874025143ccf951936a1377ac1bf729a..1845fc829118c700e6c6dffc799de3ec29d7784b 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -138,19 +138,21 @@ class Interceptors {
class SsaBuilderTask extends CompilerTask {
final Interceptors interceptors;
final Map<Node, ClosureData> closureDataCache;
+ final CodeEmitterTask emitter;
String get name() => 'SSA builder';
- SsaBuilderTask(Compiler compiler)
- : interceptors = new Interceptors(compiler),
+ SsaBuilderTask(JavaScriptBackend backend)
+ : interceptors = new Interceptors(backend.compiler),
closureDataCache = new HashMap<Node, ClosureData>(),
- super(compiler);
+ emitter = backend.emitter,
+ super(backend.compiler);
HGraph build(WorkItem work) {
return measure(() {
FunctionElement element = work.element;
HInstruction.idCounter = 0;
- SsaBuilder builder = new SsaBuilder(compiler, work);
+ SsaBuilder builder = new SsaBuilder(this, work);
HGraph graph;
switch (element.kind) {
case ElementKind.GENERATIVE_CONSTRUCTOR:
@@ -299,8 +301,7 @@ class LocalsHandler {
void startFunction(FunctionElement function,
FunctionExpression node) {
- ClosureTranslator translator =
- new ClosureTranslator(builder.compiler, builder.elements);
+ ClosureTranslator translator = new ClosureTranslator(builder);
closureData = translator.translate(node);
FunctionSignature params = function.computeSignature(builder.compiler);
@@ -767,7 +768,7 @@ class JumpHandlerImpl implements JumpHandler {
}
class SsaBuilder implements Visitor {
- final Compiler compiler;
+ final SsaBuilderTask builder;
TreeElements elements;
final Interceptors interceptors;
final WorkItem work;
@@ -790,11 +791,13 @@ class SsaBuilder implements Visitor {
HBasicBlock lastOpenedBlock;
LibraryElement get currentLibrary() => work.element.getLibrary();
+ Compiler get compiler() => builder.compiler;
+ CodeEmitterTask get emitter() => builder.emitter;
- SsaBuilder(Compiler compiler, WorkItem work)
- : this.compiler = compiler,
+ SsaBuilder(SsaBuilderTask builder, WorkItem work)
+ : this.builder = builder,
this.work = work,
- interceptors = compiler.builder.interceptors,
+ interceptors = builder.interceptors,
methodInterceptionEnabled = true,
elements = work.resolutionTree,
graph = new HGraph(),
@@ -1473,7 +1476,7 @@ class SsaBuilder implements Visitor {
}
visitFunctionExpression(FunctionExpression node) {
- ClosureData nestedClosureData = compiler.builder.closureDataCache[node];
+ ClosureData nestedClosureData = builder.closureDataCache[node];
if (nestedClosureData === null) {
// TODO(floitsch): we can only assume that the reason for not having a
// closure data here is, because the function is inside an initializer.
« no previous file with comments | « lib/compiler/implementation/native_handler.dart ('k') | lib/compiler/implementation/ssa/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698