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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart

Issue 141023007: Emit the type test support code to the right output unit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 6 years, 11 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: sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
index 8733590ed263b5ee00b7ebc00161ac5db0f8e590..87a5036cdf2112d988a24e26cb6ee01d2ecb8fa7 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
@@ -276,13 +276,18 @@ class TypeTestEmitter extends CodeEmitterHelper {
}
}
- void emitRuntimeTypeSupport(CodeBuffer buffer) {
+ void emitRuntimeTypeSupport(CodeBuffer buffer, OutputUnit outputUnit) {
task.addComment('Runtime type support', buffer);
RuntimeTypes rti = backend.rti;
TypeChecks typeChecks = rti.requiredChecks;
// Add checks to the constructors of instantiated classes.
+ // TODO(sigurdm): We should avoid running through this list for each
+ // output unit.
for (ClassElement cls in typeChecks) {
+ OutputUnit destination =
+ compiler.deferredLoadTask.outputUnitForElement(cls);
+ if (destination != outputUnit) continue;
// TODO(9556). The properties added to 'holder' should be generated
// directly as properties of the class object, not added later.
String holder = namer.isolateAccess(backend.getImplementationClass(cls));
@@ -306,12 +311,20 @@ class TypeTestEmitter extends CodeEmitterHelper {
buffer.write(jsAst.prettyPrint(encoding, compiler));
buffer.add('$N');
}
+ if (outputUnit == compiler.deferredLoadTask.mainOutputUnit) {
+ // TODO(sigurdm): These should also be possibly deferred.
+ // They should be handled similarly to constants.
+ // They have 3 dependencies:
+ // 1. The libraries containing the check.
+ // 2. The typedef defining it.
+ // 3. The types involved in the typedef.
+ // TODO(sigurdm): Actually these seems to never be used. Remove them.
+ checkedNonGenericFunctionTypes.forEach(addSignature);
+ checkedGenericFunctionTypes.forEach((_, Set<FunctionType> functionTypes) {
+ functionTypes.forEach(addSignature);
+ });
+ }
- checkedNonGenericFunctionTypes.forEach(addSignature);
-
- checkedGenericFunctionTypes.forEach((_, Set<FunctionType> functionTypes) {
- functionTypes.forEach(addSignature);
- });
}
/**

Powered by Google App Engine
This is Rietveld 408576698