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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.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.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 4c0808cc5eb4e6ad4a237db273f586986441e559..6b6f1232106c4026bf7a5b9802b8da0db52361f3 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -53,15 +53,21 @@ class SsaKernelBuilderTask extends CompilerTask {
: backend = backend,
super(backend.compiler.measurer);
- HGraph build(CodegenWorkItem work) {
+ HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) {
return measure(() {
AstElement element = work.element.implementation;
Kernel kernel = backend.kernelTask.kernel;
- KernelSsaBuilder builder = new KernelSsaBuilder(element, work.resolvedAst,
- backend.compiler, work.registry, sourceInformationFactory, kernel);
+ KernelSsaBuilder builder = new KernelSsaBuilder(
+ element,
+ work.resolvedAst,
+ backend.compiler,
+ closedWorld,
+ work.registry,
+ sourceInformationFactory,
+ kernel);
HGraph graph = builder.build();
- if (backend.compiler.tracer.isEnabled) {
+ if (backend.tracer.isEnabled) {
String name;
if (element.isClassMember) {
String className = element.enclosingClass.name;
@@ -73,8 +79,8 @@ class SsaKernelBuilderTask extends CompilerTask {
} else {
name = "${element.name}";
}
- backend.compiler.tracer.traceCompilation(name);
- backend.compiler.tracer.traceGraph('builder', graph);
+ backend.tracer.traceCompilation(name);
+ backend.tracer.traceGraph('builder', graph);
}
return graph;
@@ -86,6 +92,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
ir.Node target;
final AstElement targetElement;
final ResolvedAst resolvedAst;
+ final ClosedWorld closedWorld;
final CodegenRegistry registry;
/// Helper accessor for all kernel function-like targets (Procedure,
@@ -124,6 +131,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
this.targetElement,
this.resolvedAst,
Compiler compiler,
+ this.closedWorld,
this.registry,
SourceInformationStrategy sourceInformationFactory,
Kernel kernel) {
@@ -562,7 +570,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
}
// If the expression being iterated over is a JS indexable type, we can
// generate an optimized version of for-in that uses indexing.
- if (astAdapter.isJsIndexableIterator(forInStatement)) {
+ if (astAdapter.isJsIndexableIterator(forInStatement, closedWorld)) {
_buildForInIndexable(forInStatement);
} else {
_buildForInIterator(forInStatement);
@@ -615,7 +623,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
void buildInitializer() {
forInStatement.iterable.accept(this);
array = pop();
- isFixed = astAdapter.isFixedLength(array.instructionType);
+ isFixed = astAdapter.isFixedLength(array.instructionType, closedWorld);
localsHandler.updateLocal(
indexVariable, graph.addConstantInt(0, compiler));
originalLength = buildGetLength();
@@ -903,7 +911,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral);
}
- TypeMask type = astAdapter.typeOfListLiteral(targetElement, listLiteral);
+ TypeMask type =
+ astAdapter.typeOfListLiteral(targetElement, listLiteral, closedWorld);
if (!type.containsAll(closedWorld)) {
listInstruction.instructionType = type;
}
@@ -1096,7 +1105,9 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
propertySet.value.accept(this);
HInstruction value = pop();
- _pushDynamicInvocation(propertySet, astAdapter.typeOfSet(propertySet),
+ _pushDynamicInvocation(
+ propertySet,
+ astAdapter.typeOfSet(propertySet, closedWorld),
<HInstruction>[receiver, value]);
pop();
@@ -1527,7 +1538,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
message: "No NativeBehavior for $invocation"));
- TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior);
+ TypeMask ssaType =
+ astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld);
push(new HForeignCode(expr, ssaType, const <HInstruction>[],
nativeBehavior: nativeBehavior));
}
@@ -1568,7 +1580,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
message: "No NativeBehavior for $invocation"));
- TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior);
+ TypeMask ssaType =
+ astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld);
push(new HForeignCode(template, ssaType, inputs,
nativeBehavior: nativeBehavior));
}
@@ -1656,7 +1669,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
astAdapter.getNode(invocation), MessageKind.JS_PLACEHOLDER_CAPTURE);
}
- TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior);
+ TypeMask ssaType =
+ astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld);
SourceInformation sourceInformation = null;
push(new HForeignCode(nativeBehavior.codeTemplate, ssaType, inputs,
@@ -1678,12 +1692,12 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
ir.Node target, List<HInstruction> arguments, TypeMask typeMask) {
HInvokeStatic instruction = new HInvokeStatic(
astAdapter.getMember(target), arguments, typeMask,
- targetCanThrow: astAdapter.getCanThrow(target));
+ targetCanThrow: astAdapter.getCanThrow(target, closedWorld));
if (currentImplicitInstantiations.isNotEmpty) {
instruction.instantiatedTypes =
new List<DartType>.from(currentImplicitInstantiations);
}
- instruction.sideEffects = astAdapter.getSideEffects(target);
+ instruction.sideEffects = astAdapter.getSideEffects(target, closedWorld);
push(instruction);
}
@@ -1769,7 +1783,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
Selector selector = astAdapter.getSelector(invocation);
_pushDynamicInvocation(
invocation,
- astAdapter.typeOfInvocation(invocation),
+ astAdapter.typeOfInvocation(invocation, closedWorld),
<HInstruction>[receiver]
..addAll(
_visitArgumentsForDynamicTarget(selector, invocation.arguments)));
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698