[CFE] Don't serialize platform in suite
This takes running the weak suite - on my machine - from
```
[ 07:14 | 100.0% | + 2268 | - 0 ]: weak/variance/unconstrained_inference
check errors: 0:00:00.517818 ms
stress constant evaluator: 0:00:00.748959 ms
print: 0:00:01.357741 ms
typeCheck: 0:00:09.610927 ms
verify: 0:00:17.063594 ms
match expectations: 0:00:17.186629 ms
compile: 0:00:56.952218 ms
transform component: 0:01:23.143726 ms
run: 0:02:24.114175 ms
write .dill: 0:04:07.470467 ms
real 7m19.983s
user 10m43.053s
sys 1m29.653s
```
to
```
[ 03:07 | 100.0% | + 2268 | - 0 ]: weak/variance/unconstrained_inference
check errors: 0:00:00.521563 ms
stress constant evaluator: 0:00:00.760032 ms
print: 0:00:01.358365 ms
write .dill: 0:00:02.451508 ms
typeCheck: 0:00:09.750399 ms
verify: 0:00:17.081690 ms
match expectations: 0:00:17.723327 ms
compile: 0:00:55.593688 ms
run: 0:01:11.893074 ms
transform component: 0:01:21.368430 ms
real 3m12.619s
user 4m20.531s
sys 0m41.589s
```
Change-Id: I9d235e84d10df06737789e8765f3b55521697e21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246961
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/test/utils/kernel_chain.dart b/pkg/front_end/test/utils/kernel_chain.dart
index 93beea1..b0941a1 100644
--- a/pkg/front_end/test/utils/kernel_chain.dart
+++ b/pkg/front_end/test/utils/kernel_chain.dart
@@ -455,8 +455,28 @@
ByteSink sink = new ByteSink();
bool good = false;
try {
- // TODO(johnniwinther,jensj): Avoid serializing the sdk.
- new BinaryPrinter(sink).writeComponentFile(component);
+ // Avoid serializing the sdk.
+ component.computeCanonicalNames();
+ Component userCode = new Component(
+ nameRoot: component.root,
+ uriToSource: new Map<Uri, Source>.from(component.uriToSource));
+ userCode.setMainMethodAndMode(
+ component.mainMethodName, true, component.mode);
+ for (Library library in component.libraries) {
+ if (library.importUri.isScheme("dart")) {
+ if (result.isUserLibrary(library)) {
+ // dart:test, test:extra etc as used will say yes to being a user
+ // library.
+ } else if (library.isSynthetic) {
+ // OK --- serialize that.
+ } else {
+ // Skip serialization of "real" platform libraries.
+ continue;
+ }
+ }
+ userCode.libraries.add(library);
+ }
+ new BinaryPrinter(sink).writeComponentFile(userCode);
good = true;
} catch (e, s) {
return fail(result, e, s);