Skip to content

Commit

Permalink
dart2js: Remove lookup map support
Browse files Browse the repository at this point in the history
Change-Id: Id435dc0f54165285c0d291d2e1c984da92bfd22a
Reviewed-on: https://dart-review.googlesource.com/5284
Reviewed-by: Stephen Adams <[email protected]>
Reviewed-by: Sigmund Cherem <[email protected]>
Commit-Queue: Harry Terkelsen <[email protected]>
  • Loading branch information
harryterkelsen authored and [email protected] committed Sep 12, 2017
1 parent 6fbab08 commit b7666dd
Show file tree
Hide file tree
Showing 39 changed files with 13 additions and 1,719 deletions.
1 change: 0 additions & 1 deletion .packages
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ json_rpc_2:third_party/pkg/json_rpc_2/lib
kernel:pkg/kernel/lib
linter:third_party/pkg/linter/lib
logging:third_party/pkg/logging/lib
lookup_map:pkg/lookup_map/lib
markdown:third_party/pkg/markdown/lib
matcher:third_party/pkg/matcher/lib
meta:pkg/meta/lib
Expand Down
1 change: 0 additions & 1 deletion pkg/compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,6 @@ _TODO: complete the documentation for the following files_.
`lib/src/js_backend/js_interop_analysis.dart`
`lib/src/js_backend/backend_impact.dart`
`lib/src/js_backend/constant_emitter.dart`
`lib/src/js_backend/lookup_map_analysis.dart`
`lib/src/js_backend/namer_names.dart`
`lib/src/js_backend/runtime_types.dart`
`lib/src/js_backend/no_such_method_registry.dart`
Expand Down
6 changes: 0 additions & 6 deletions pkg/compiler/lib/src/diagnostics/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ enum MessageKind {
UNIMPLEMENTED_SETTER,
UNIMPLEMENTED_SETTER_ONE,
UNMATCHED_TOKEN,
UNRECOGNIZED_VERSION_OF_LOOKUP_MAP,
UNSUPPORTED_BANG_EQ_EQ,
UNSUPPORTED_EQ_EQ_EQ,
UNSUPPORTED_LITERAL_SYMBOL,
Expand Down Expand Up @@ -3715,11 +3714,6 @@ $MIRRORS_NOT_SUPPORTED_BY_BACKEND_PADDING#{importChain}"""),
"more code and prevents the compiler from doing some optimizations.",
howToFix: "Consider removing this 'noSuchMethod' implementation."),

MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP: const MessageTemplate(
MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP,
"Unsupported version of package:lookup_map.",
howToFix: DONT_KNOW_HOW_TO_FIX),

MessageKind.DUPLICATE_SERIALIZED_LIBRARY: const MessageTemplate(
MessageKind.DUPLICATE_SERIALIZED_LIBRARY,
"Library '#{libraryUri}' found in both '#{sourceUri1}' and "
Expand Down
31 changes: 0 additions & 31 deletions pkg/compiler/lib/src/js_backend/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ import 'enqueuer.dart';
import 'impact_transformer.dart';
import 'interceptor_data.dart';
import 'js_interop_analysis.dart' show JsInteropAnalysis;
import 'lookup_map_analysis.dart'
show LookupMapResolutionAnalysis, LookupMapAnalysis;
import 'mirrors_analysis.dart';
import 'mirrors_data.dart';
import 'namer.dart';
Expand Down Expand Up @@ -383,12 +381,6 @@ class JavaScriptBackend {
/// constructors for custom elements.
CustomElementsCodegenAnalysis _customElementsCodegenAnalysis;

/// Resolution support for tree-shaking entries of `LookupMap`.
LookupMapResolutionAnalysis lookupMapResolutionAnalysis;

/// Codegen support for tree-shaking entries of `LookupMap`.
LookupMapAnalysis _lookupMapAnalysis;

/// Codegen support for typed JavaScript interop.
JsInteropAnalysis jsInteropAnalysis;

Expand Down Expand Up @@ -461,8 +453,6 @@ class JavaScriptBackend {
jsInteropAnalysis = new JsInteropAnalysis(this);
_mirrorsResolutionAnalysis =
compiler.frontendStrategy.createMirrorsResolutionAnalysis(this);
lookupMapResolutionAnalysis = new LookupMapResolutionAnalysis(
reporter, compiler.frontendStrategy.elementEnvironment);

noSuchMethodRegistry = new NoSuchMethodRegistry(
commonElements, compiler.frontendStrategy.createNoSuchMethodResolver());
Expand Down Expand Up @@ -529,15 +519,6 @@ class JavaScriptBackend {
return _mirrorsCodegenAnalysis;
}

/// Codegen support for tree-shaking entries of `LookupMap`.
LookupMapAnalysis get lookupMapAnalysis {
assert(
_lookupMapAnalysis != null,
failedAt(NO_LOCATION_SPANNABLE,
"LookupMapAnalysis has not been created yet."));
return _lookupMapAnalysis;
}

OneShotInterceptorData get oneShotInterceptorData {
assert(
_oneShotInterceptorData != null,
Expand Down Expand Up @@ -771,7 +752,6 @@ class JavaScriptBackend {
mirrorsDataBuilder,
noSuchMethodRegistry,
customElementsResolutionAnalysis,
lookupMapResolutionAnalysis,
mirrorsResolutionAnalysis,
typeVariableResolutionAnalysis,
_nativeResolutionEnqueuer,
Expand All @@ -798,13 +778,6 @@ class JavaScriptBackend {
new BackendImpacts(compiler.options, commonElements);
_typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis(
closedWorld.elementEnvironment, this, commonElements, mirrorsData);
_lookupMapAnalysis = new LookupMapAnalysis(
reporter,
constantSystem,
constants,
elementEnvironment,
commonElements,
lookupMapResolutionAnalysis);
_mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close();
_customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis(
constantSystem,
Expand Down Expand Up @@ -834,7 +807,6 @@ class JavaScriptBackend {
closedWorld.rtiNeed,
customElementsCodegenAnalysis,
typeVariableCodegenAnalysis,
lookupMapAnalysis,
mirrorsCodegenAnalysis,
nativeCodegenEnqueuer));
}
Expand Down Expand Up @@ -964,8 +936,6 @@ class JavaScriptBackend {
Uri uri = library.canonicalUri;
if (uri == Uris.dart_html) {
htmlLibraryIsLoaded = true;
} else if (uri == LookupMapResolutionAnalysis.PACKAGE_LOOKUP_MAP) {
lookupMapResolutionAnalysis.init(library);
}
}

Expand Down Expand Up @@ -1015,7 +985,6 @@ class JavaScriptBackend {
nativeCodegenEnqueuer,
namer,
oneShotInterceptorData,
lookupMapAnalysis,
rtiChecksBuilder);
return const WorldImpact();
}
Expand Down
19 changes: 1 addition & 18 deletions pkg/compiler/lib/src/js_backend/codegen_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import '../universe/world_impact.dart'
import 'backend_impact.dart';
import 'backend_usage.dart';
import 'custom_elements_analysis.dart';
import 'lookup_map_analysis.dart' show LookupMapAnalysis;
import 'mirrors_analysis.dart';
import 'runtime_types.dart';
import 'type_variable_handler.dart';
Expand All @@ -33,7 +32,6 @@ class CodegenEnqueuerListener extends EnqueuerListener {

final CustomElementsCodegenAnalysis _customElementsAnalysis;
final TypeVariableCodegenAnalysis _typeVariableCodegenAnalysis;
final LookupMapAnalysis _lookupMapAnalysis;
final MirrorsCodegenAnalysis _mirrorsAnalysis;

final NativeCodegenEnqueuer _nativeEnqueuer;
Expand All @@ -48,7 +46,6 @@ class CodegenEnqueuerListener extends EnqueuerListener {
this._rtiNeed,
this._customElementsAnalysis,
this._typeVariableCodegenAnalysis,
this._lookupMapAnalysis,
this._mirrorsAnalysis,
this._nativeEnqueuer);

Expand Down Expand Up @@ -79,7 +76,6 @@ class CodegenEnqueuerListener extends EnqueuerListener {
if (nativeUsage) {
_nativeEnqueuer.onInstantiatedType(type);
}
_lookupMapAnalysis.registerInstantiatedType(type);
}

/// Called to enable support for isolates. Any backend specific [WorldImpact]
Expand Down Expand Up @@ -142,7 +138,6 @@ class CodegenEnqueuerListener extends EnqueuerListener {
// Return early if any elements are added to avoid counting the elements as
// due to mirrors.
enqueuer.applyImpact(_customElementsAnalysis.flush());
enqueuer.applyImpact(_lookupMapAnalysis.flush());
enqueuer.applyImpact(_typeVariableCodegenAnalysis.flush());

if (_backendUsage.isNoSuchMethodUsed && !_isNoSuchMethodUsed) {
Expand All @@ -158,21 +153,13 @@ class CodegenEnqueuerListener extends EnqueuerListener {
}

@override
void onQueueClosed() {
_lookupMapAnalysis.onQueueClosed();
}
void onQueueClosed() {}

/// Adds the impact of [constant] to [impactBuilder].
void _computeImpactForCompileTimeConstant(
ConstantValue constant, WorldImpactBuilder impactBuilder) {
_computeImpactForCompileTimeConstantInternal(constant, impactBuilder);

if (_lookupMapAnalysis.isLookupMap(constant)) {
// Note: internally, this registration will temporarily remove the
// constant dependencies and add them later on-demand.
_lookupMapAnalysis.registerLookupMapReference(constant);
}

for (ConstantValue dependency in constant.getDependencies()) {
_computeImpactForCompileTimeConstant(dependency, impactBuilder);
}
Expand Down Expand Up @@ -202,10 +189,8 @@ class CodegenEnqueuerListener extends EnqueuerListener {
if (type.representedType.isInterfaceType) {
InterfaceType representedType = type.representedType;
_customElementsAnalysis.registerTypeConstant(representedType.element);
_lookupMapAnalysis.registerTypeConstant(representedType.element);
}
}
_lookupMapAnalysis.registerConstantKey(constant);
}

void _computeImpactForInstantiatedConstantType(
Expand Down Expand Up @@ -320,7 +305,6 @@ class CodegenEnqueuerListener extends EnqueuerListener {
}

_customElementsAnalysis.registerInstantiatedClass(cls);
_lookupMapAnalysis.registerInstantiatedClass(cls);
return impactBuilder;
}

Expand All @@ -336,7 +320,6 @@ class CodegenEnqueuerListener extends EnqueuerListener {

@override
void logSummary(void log(String message)) {
_lookupMapAnalysis.logSummary(log);
_nativeEnqueuer.logSummary(log);
}
}
40 changes: 12 additions & 28 deletions pkg/compiler/lib/src/js_backend/impact_transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import 'backend_usage.dart';
import 'checked_mode_helpers.dart';
import 'custom_elements_analysis.dart';
import 'interceptor_data.dart';
import 'lookup_map_analysis.dart';
import 'mirrors_data.dart';
import 'namer.dart';
import 'native_data.dart';
Expand Down Expand Up @@ -347,7 +346,6 @@ class CodegenImpactTransformer {
final NativeCodegenEnqueuer _nativeCodegenEnqueuer;
final Namer _namer;
final OneShotInterceptorData _oneShotInterceptorData;
final LookupMapAnalysis _lookupMapAnalysis;
final RuntimeTypesChecksBuilder _rtiChecksBuilder;

CodegenImpactTransformer(
Expand All @@ -362,7 +360,6 @@ class CodegenImpactTransformer {
this._nativeCodegenEnqueuer,
this._namer,
this._oneShotInterceptorData,
this._lookupMapAnalysis,
this._rtiChecksBuilder);

void onIsCheckForCodegen(DartType type, TransformedWorldImpact transformed) {
Expand Down Expand Up @@ -409,14 +406,8 @@ class CodegenImpactTransformer {

for (TypeUse typeUse in impact.typeUses) {
DartType type = typeUse.type;
switch (typeUse.kind) {
case TypeUseKind.INSTANTIATION:
_lookupMapAnalysis.registerInstantiatedType(type);
break;
case TypeUseKind.IS_CHECK:
onIsCheckForCodegen(type, transformed);
break;
default:
if (typeUse.kind == TypeUseKind.IS_CHECK) {
onIsCheckForCodegen(type, transformed);
}
}

Expand All @@ -427,26 +418,19 @@ class CodegenImpactTransformer {
}

for (StaticUse staticUse in impact.staticUses) {
switch (staticUse.kind) {
case StaticUseKind.CALL_METHOD:
FunctionEntity callMethod = staticUse.element;
// TODO(johnniwinther): Remove [localFunctionNeedsRti] and use
// the call method instead.
if (_rtiNeed.methodNeedsRti(callMethod)) {
if (staticUse.kind == StaticUseKind.CALL_METHOD) {
FunctionEntity callMethod = staticUse.element;
// TODO(johnniwinther): Remove [localFunctionNeedsRti] and use
// the call method instead.
if (_rtiNeed.methodNeedsRti(callMethod)) {
_impacts.computeSignature
.registerImpact(transformed, _elementEnvironment);
} else if (callMethod is SynthesizedCallMethodElementX) {
if (_rtiNeed.localFunctionNeedsRti(callMethod.expression)) {
_impacts.computeSignature
.registerImpact(transformed, _elementEnvironment);
} else if (callMethod is SynthesizedCallMethodElementX) {
if (_rtiNeed.localFunctionNeedsRti(callMethod.expression)) {
_impacts.computeSignature
.registerImpact(transformed, _elementEnvironment);
}
}
break;
case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
case StaticUseKind.CONSTRUCTOR_INVOKE:
_lookupMapAnalysis.registerInstantiatedType(staticUse.type);
break;
default:
}
}
}

Expand Down
Loading

0 comments on commit b7666dd

Please sign in to comment.