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

Unified Diff: pkg/compiler/lib/src/ssa/codegen.dart

Issue 2575083002: Pass ClosedWorld directly to codegen tasks (Closed)
Patch Set: Updated cf. comment. Created 4 years 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 | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/codegen.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 98ccfb11b00fd9eefcb69be58f2d7e124da6d3d9..95fa2568e9cd073d0ae786314ed2370aa38bcb2f 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -59,36 +59,41 @@ class SsaCodeGeneratorTask extends CompilerTask {
.buildDeclaration(resolvedAst));
}
- js.Expression generateCode(CodegenWorkItem work, HGraph graph) {
+ js.Expression generateCode(
+ CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
if (work.element.isField) {
- return generateLazyInitializer(work, graph);
+ return generateLazyInitializer(work, graph, closedWorld);
} else {
- return generateMethod(work, graph);
+ return generateMethod(work, graph, closedWorld);
}
}
- js.Expression generateLazyInitializer(CodegenWorkItem work, HGraph graph) {
+ js.Expression generateLazyInitializer(
+ CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
return measure(() {
- compiler.tracer.traceGraph("codegen", graph);
+ backend.tracer.traceGraph("codegen", graph);
SourceInformation sourceInformation = sourceInformationFactory
.createBuilderForContext(work.resolvedAst)
.buildDeclaration(work.resolvedAst);
- SsaCodeGenerator codegen = new SsaCodeGenerator(backend, work);
+ SsaCodeGenerator codegen =
+ new SsaCodeGenerator(backend, closedWorld, work);
codegen.visitGraph(graph);
return new js.Fun(codegen.parameters, codegen.body)
.withSourceInformation(sourceInformation);
});
}
- js.Expression generateMethod(CodegenWorkItem work, HGraph graph) {
+ js.Expression generateMethod(
+ CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
return measure(() {
FunctionElement element = work.element;
if (element.asyncMarker != AsyncMarker.SYNC) {
work.registry.registerAsyncMarker(element);
}
- SsaCodeGenerator codegen = new SsaCodeGenerator(backend, work);
+ SsaCodeGenerator codegen =
+ new SsaCodeGenerator(backend, closedWorld, work);
codegen.visitGraph(graph);
- compiler.tracer.traceGraph("codegen", graph);
+ backend.tracer.traceGraph("codegen", graph);
return buildJavaScriptFunction(
work.resolvedAst, codegen.parameters, codegen.body);
});
@@ -121,6 +126,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
bool isGeneratingExpression = false;
final JavaScriptBackend backend;
+ final ClosedWorld closedWorld;
final CodegenWorkItem work;
final Set<HInstruction> generateAtUseSite;
@@ -163,7 +169,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
// if branches.
SubGraph subGraph;
- SsaCodeGenerator(this.backend, CodegenWorkItem work,
+ SsaCodeGenerator(this.backend, this.closedWorld, CodegenWorkItem work,
{SourceInformation sourceInformation})
: this.work = work,
declaredLocals = new Set<String>(),
@@ -179,8 +185,6 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
Compiler get compiler => backend.compiler;
- ClosedWorld get closedWorld => compiler.closedWorld;
-
NativeEmitter get nativeEmitter => backend.emitter.nativeEmitter;
CodegenRegistry get registry => work.registry;
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698