Skip to content

Commit b597b75

Browse files
srujzsCommit Queue
authored andcommitted
Revert "[dart2js] Run static interop erasure regardless if from dill or src"
This reverts commit 5d7029e. Reason for revert: Increases memory usage in dart2js benchmarks Original change's description: > [dart2js] Run static interop erasure regardless if from dill or src > > Removes modular transformation as well. > > Change-Id: Ib3aafcaf35b72fdb6a93db682dcf8df84842578f > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266803 > Reviewed-by: Joshua Litt <joshualitt@google.com> > Commit-Queue: Srujan Gaddam <srujzs@google.com> # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I8c40f16983a3f7e2383dcf3b47c2134c9ecd6746 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267762 Reviewed-by: Srujan Gaddam <srujzs@google.com> Commit-Queue: Srujan Gaddam <srujzs@google.com> Reviewed-by: Joshua Litt <joshualitt@google.com>
1 parent 1686e88 commit b597b75

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

pkg/compiler/lib/src/kernel/dart2js_target.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:_fe_analyzer_shared/src/messages/codes.dart'
1313
import 'package:_js_interop_checks/js_interop_checks.dart';
1414
import 'package:_js_interop_checks/src/transformations/export_creator.dart';
1515
import 'package:_js_interop_checks/src/transformations/js_util_optimizer.dart';
16+
import 'package:_js_interop_checks/src/transformations/static_interop_class_eraser.dart';
1617
import 'package:kernel/ast.dart' as ir;
1718
import 'package:kernel/class_hierarchy.dart';
1819
import 'package:kernel/core_types.dart';
@@ -168,10 +169,17 @@ class Dart2jsTarget extends Target {
168169
// in the single pass in `transformations/lowering.dart`.
169170
jsUtilOptimizer.visitLibrary(library);
170171
}
172+
var staticInteropClassEraser =
173+
StaticInteropClassEraser(coreTypes, referenceFromIndex);
171174
lowering.transformLibraries(libraries, coreTypes, hierarchy, options);
172175
logger?.call("Lowering transformations performed");
173176
if (canPerformGlobalTransforms) {
174177
transformMixins.transformLibraries(libraries);
178+
// Do the erasure after any possible mock creation to avoid erasing types
179+
// that need to be used during mock conformance checking.
180+
for (var library in libraries) {
181+
staticInteropClassEraser.visitLibrary(library);
182+
}
175183
logger?.call("Mixin transformations performed");
176184
}
177185
}

pkg/compiler/lib/src/phase/load_kernel.dart

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,10 @@ class _LoadFromKernelResult {
133133

134134
void _doGlobalTransforms(Component component) {
135135
transformMixins.transformLibraries(component.libraries);
136-
}
137-
138-
// Perform any backend-specific transforms here that can be done on both
139-
// serialized components and components from source.
140-
// TODO(srujzs): Can we combine this with the above?
141-
void _doTransformsOnKernelLoad(Component component) {
142-
// referenceFromIndex is only necessary in the case where a module
143-
// containing a stub definition is invalidated, and then reloaded, because
144-
// we need to keep existing references to that stub valid. Here, we have the
145-
// whole program, and therefore do not need it.
136+
// referenceFromIndex is only necessary in the case where a module containing
137+
// a stub definition is invalidated, and then reloaded, because we need to
138+
// keep existing references to that stub valid. Here, we have the whole
139+
// program, and therefore do not need it.
146140
StaticInteropClassEraser(ir.CoreTypes(component), null)
147141
.visitComponent(component);
148142
}
@@ -403,9 +397,6 @@ Future<Output?> run(Input input) async {
403397
moduleLibraries = result.moduleLibraries;
404398
}
405399
if (component == null) return null;
406-
// TODO(srujzs): These transforms can occur multiple times on the same
407-
// component. Currently, it isn't an issue.
408-
_doTransformsOnKernelLoad(component);
409400
if (input.forceSerialization) {
410401
// TODO(johnniwinther): Remove this when #34942 is fixed.
411402
List<int> data = serializeComponent(component);

0 commit comments

Comments
 (0)