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

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

Issue 2691753002: Add deferred loading to Kernel. (Closed)
Patch Set: . Created 3 years, 10 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
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 974f5616b6b3d1fc00013fa34400c5585e43d9cb..330dcbac373cd9501672ecf08110cbf920ee2689 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -593,6 +593,36 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
}
@override
+ void visitCheckLibraryIsLoaded(ir.CheckLibraryIsLoaded checkLoad) {
+ HInstruction prefixConstant = graph.addConstantString(
+ new DartString.literal(checkLoad.import.name), closedWorld);
+ // TODO(efortuna): Optimization opportunity! Make this constant file name
+ // some sort of global constant (or a constant in the check loaded function)
+ // to look up rather than always passing in. Also note that the URI passed
+ // here is longer that in the original one, which called
+ // compiler.deferredLoadTask.getImportDeferName and then also needed the
+ // previsit function to hold the prefix element.
sra1 2017/02/14 03:14:06 How are we going to fix this (getting the shorter
Emily Fortuna 2017/02/14 20:56:28 This is what I was talking about last week. We can
sra1 2017/02/14 21:55:27 I'm concerned that two builds will generate differ
Emily Fortuna 2017/02/15 01:02:31 Fixed it properly.
+ HInstruction uriConstant = graph.addConstantString(
+ new DartString.literal(checkLoad.import.importedLibrary.importUri),
+ closedWorld);
+ _pushStaticInvocation(astAdapter.checkDeferredIsLoaded,
+ [prefixConstant, uriConstant], astAdapter.checkDeferredIsLoadedType);
+ }
+
+ @override
+ void visitLoadLibrary(ir.LoadLibrary loadLibrary) {
+ // TODO(efortuna): Source information!
+ push(new HInvokeStatic(
+ backend.helpers.loadLibraryWrapper,
+ [
+ graph.addConstantString(
+ new DartString.literal(loadLibrary.import.name), closedWorld)
+ ],
+ commonMasks.nonNullType,
+ targetCanThrow: false));
+ }
+
+ @override
void visitBlock(ir.Block block) {
assert(!isAborted());
for (ir.Statement statement in block.statements) {
@@ -1830,8 +1860,9 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
// Invoke the getter
_pushStaticInvocation(staticTarget, const <HInstruction>[],
astAdapter.returnTypeOf(staticTarget));
- } else if (staticTarget is ir.Field && staticTarget.isConst) {
- assert(staticTarget.initializer != null);
+ } else if (staticTarget is ir.Field &&
+ (staticTarget.isConst ||
+ staticTarget.isFinal && !_isLazyStatic(staticTarget))) {
stack.add(graph.addConstant(
astAdapter.getConstantFor(staticTarget.initializer), closedWorld));
} else {

Powered by Google App Engine
This is Rietveld 408576698