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

Side by Side Diff: pkg/compiler/lib/src/js_backend/impact_transformer.dart

Issue 2807593002: Use entities in impact transformers. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library js_backend.backend.impact_transformer; 5 library js_backend.backend.impact_transformer;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common_elements.dart'; 8 import '../common_elements.dart';
9 import '../common/backend_api.dart' show ImpactTransformer; 9 import '../common/backend_api.dart' show ImpactTransformer;
10 import '../common/codegen.dart' show CodegenImpact; 10 import '../common/codegen.dart' show CodegenImpact;
11 import '../common/resolution.dart' show Resolution, ResolutionImpact; 11 import '../common/resolution.dart' show ResolutionImpact;
12 import '../constants/expressions.dart'; 12 import '../constants/expressions.dart';
13 import '../common_elements.dart' show ElementEnvironment; 13 import '../common_elements.dart' show ElementEnvironment;
14 import '../elements/elements.dart'; 14 import '../elements/elements.dart' show AsyncMarker;
15 import '../elements/entities.dart'; 15 import '../elements/entities.dart';
16 import '../elements/resolution_types.dart'; 16 import '../elements/resolution_types.dart' show Types;
17 import '../elements/types.dart';
17 import '../enqueue.dart' show ResolutionEnqueuer; 18 import '../enqueue.dart' show ResolutionEnqueuer;
18 import '../native/enqueue.dart'; 19 import '../native/enqueue.dart';
19 import '../native/native.dart' as native; 20 import '../native/native.dart' as native;
20 import '../options.dart'; 21 import '../options.dart';
21 import '../universe/feature.dart'; 22 import '../universe/feature.dart';
22 import '../universe/use.dart' 23 import '../universe/use.dart'
23 show StaticUse, StaticUseKind, TypeUse, TypeUseKind; 24 show StaticUse, StaticUseKind, TypeUse, TypeUseKind;
24 import '../universe/world_impact.dart' show TransformedWorldImpact, WorldImpact; 25 import '../universe/world_impact.dart' show TransformedWorldImpact, WorldImpact;
25 import '../util/util.dart'; 26 import '../util/util.dart';
26 import 'backend.dart'; 27 import 'backend.dart';
27 import 'backend_helpers.dart'; 28 import 'backend_helpers.dart';
28 import 'backend_impact.dart'; 29 import 'backend_impact.dart';
29 import 'backend_usage.dart'; 30 import 'backend_usage.dart';
30 import 'checked_mode_helpers.dart'; 31 import 'checked_mode_helpers.dart';
31 import 'custom_elements_analysis.dart'; 32 import 'custom_elements_analysis.dart';
32 import 'interceptor_data.dart'; 33 import 'interceptor_data.dart';
33 import 'lookup_map_analysis.dart'; 34 import 'lookup_map_analysis.dart';
34 import 'mirrors_data.dart'; 35 import 'mirrors_data.dart';
35 import 'namer.dart'; 36 import 'namer.dart';
36 import 'native_data.dart'; 37 import 'native_data.dart';
37 38
38 class JavaScriptImpactTransformer extends ImpactTransformer { 39 class JavaScriptImpactTransformer extends ImpactTransformer {
39 final CompilerOptions _options; 40 final CompilerOptions _options;
40 final Resolution _resolution;
41 final ElementEnvironment _elementEnvironment; 41 final ElementEnvironment _elementEnvironment;
42 final CommonElements _commonElements; 42 final CommonElements _commonElements;
43 final BackendImpacts _impacts; 43 final BackendImpacts _impacts;
44 final NativeBasicData _nativeBasicData; 44 final NativeBasicData _nativeBasicData;
45 final NativeResolutionEnqueuer _nativeResolutionEnqueuer; 45 final NativeResolutionEnqueuer _nativeResolutionEnqueuer;
46 final BackendUsageBuilder _backendUsageBuider; 46 final BackendUsageBuilder _backendUsageBuider;
47 final MirrorsDataBuilder _mirrorsDataBuilder; 47 final MirrorsDataBuilder _mirrorsDataBuilder;
48 final CustomElementsResolutionAnalysis _customElementsResolutionAnalysis; 48 final CustomElementsResolutionAnalysis _customElementsResolutionAnalysis;
49 final RuntimeTypesNeedBuilder _rtiNeedBuilder; 49 final RuntimeTypesNeedBuilder _rtiNeedBuilder;
50 50
51 JavaScriptImpactTransformer( 51 JavaScriptImpactTransformer(
52 this._options, 52 this._options,
53 this._resolution,
54 this._elementEnvironment, 53 this._elementEnvironment,
55 this._commonElements, 54 this._commonElements,
56 this._impacts, 55 this._impacts,
57 this._nativeBasicData, 56 this._nativeBasicData,
58 this._nativeResolutionEnqueuer, 57 this._nativeResolutionEnqueuer,
59 this._backendUsageBuider, 58 this._backendUsageBuider,
60 this._mirrorsDataBuilder, 59 this._mirrorsDataBuilder,
61 this._customElementsResolutionAnalysis, 60 this._customElementsResolutionAnalysis,
62 this._rtiNeedBuilder); 61 this._rtiNeedBuilder);
63 62
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 break; 144 break;
146 case Feature.TYPE_VARIABLE_BOUNDS_CHECK: 145 case Feature.TYPE_VARIABLE_BOUNDS_CHECK:
147 registerImpact(_impacts.typeVariableBoundCheck); 146 registerImpact(_impacts.typeVariableBoundCheck);
148 break; 147 break;
149 } 148 }
150 } 149 }
151 150
152 bool hasAsCast = false; 151 bool hasAsCast = false;
153 bool hasTypeLiteral = false; 152 bool hasTypeLiteral = false;
154 for (TypeUse typeUse in worldImpact.typeUses) { 153 for (TypeUse typeUse in worldImpact.typeUses) {
155 ResolutionDartType type = typeUse.type; 154 DartType type = typeUse.type;
156 switch (typeUse.kind) { 155 switch (typeUse.kind) {
157 case TypeUseKind.INSTANTIATION: 156 case TypeUseKind.INSTANTIATION:
158 case TypeUseKind.MIRROR_INSTANTIATION: 157 case TypeUseKind.MIRROR_INSTANTIATION:
159 case TypeUseKind.NATIVE_INSTANTIATION: 158 case TypeUseKind.NATIVE_INSTANTIATION:
160 registerRequiredType(type); 159 registerRequiredType(type);
161 break; 160 break;
162 case TypeUseKind.IS_CHECK: 161 case TypeUseKind.IS_CHECK:
163 onIsCheck(type, transformed); 162 onIsCheck(type, transformed);
164 break; 163 break;
165 case TypeUseKind.AS_CAST: 164 case TypeUseKind.AS_CAST:
166 onIsCheck(type, transformed); 165 onIsCheck(type, transformed);
167 hasAsCast = true; 166 hasAsCast = true;
168 break; 167 break;
169 case TypeUseKind.CHECKED_MODE_CHECK: 168 case TypeUseKind.CHECKED_MODE_CHECK:
170 if (_options.enableTypeAssertions) { 169 if (_options.enableTypeAssertions) {
171 onIsCheck(type, transformed); 170 onIsCheck(type, transformed);
172 } 171 }
173 break; 172 break;
174 case TypeUseKind.CATCH_TYPE: 173 case TypeUseKind.CATCH_TYPE:
175 onIsCheck(type, transformed); 174 onIsCheck(type, transformed);
176 break; 175 break;
177 case TypeUseKind.TYPE_LITERAL: 176 case TypeUseKind.TYPE_LITERAL:
178 _customElementsResolutionAnalysis.registerTypeLiteral(type); 177 _customElementsResolutionAnalysis.registerTypeLiteral(type);
179 if (type.isTypeVariable && type is! MethodTypeVariableType) { 178 if (type.isTypeVariable) {
180 // GENERIC_METHODS: The `is!` test above filters away method type 179 TypeVariableType typeVariable = type;
181 // variables, because they have the value `dynamic` with the 180 if (typeVariable.element.typeDeclaration is ClassEntity) {
182 // incomplete support for generic methods offered with 181 // GENERIC_METHODS: The `is!` test above filters away method type
183 // '--generic-method-syntax'. This must be revised in order to 182 // variables, because they have the value `dynamic` with the
184 // support generic methods fully. 183 // incomplete support for generic methods offered with
185 ClassElement cls = type.element.enclosingClass; 184 // '--generic-method-syntax'. This must be revised in order to
186 _rtiNeedBuilder.registerClassUsingTypeVariableExpression(cls); 185 // support generic methods fully.
187 registerImpact(_impacts.typeVariableExpression); 186 ClassEntity cls = typeVariable.element.typeDeclaration;
187 _rtiNeedBuilder.registerClassUsingTypeVariableExpression(cls);
188 registerImpact(_impacts.typeVariableExpression);
189 }
188 } 190 }
189 hasTypeLiteral = true; 191 hasTypeLiteral = true;
190 break; 192 break;
191 } 193 }
192 } 194 }
193 195
194 if (hasAsCast) { 196 if (hasAsCast) {
195 registerImpact(_impacts.asCheck); 197 registerImpact(_impacts.asCheck);
196 } 198 }
197 199
198 if (hasTypeLiteral) { 200 if (hasTypeLiteral) {
199 transformed 201 transformed
200 .registerTypeUse(new TypeUse.instantiation(_commonElements.typeType)); 202 .registerTypeUse(new TypeUse.instantiation(_commonElements.typeType));
201 registerImpact(_impacts.typeLiteral); 203 registerImpact(_impacts.typeLiteral);
202 } 204 }
203 205
204 for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) { 206 for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) {
205 // TODO(johnniwinther): Use the [isEmpty] property when factory 207 // TODO(johnniwinther): Use the [isEmpty] property when factory
206 // constructors are registered directly. 208 // constructors are registered directly.
207 if (mapLiteralUse.isConstant) { 209 if (mapLiteralUse.isConstant) {
208 registerImpact(_impacts.constantMapLiteral); 210 registerImpact(_impacts.constantMapLiteral);
209 } else { 211 } else {
210 transformed 212 transformed
211 .registerTypeUse(new TypeUse.instantiation(mapLiteralUse.type)); 213 .registerTypeUse(new TypeUse.instantiation(mapLiteralUse.type));
212 } 214 }
213 ResolutionInterfaceType type = mapLiteralUse.type; 215 registerRequiredType(mapLiteralUse.type);
214 registerRequiredType(type);
215 } 216 }
216 217
217 for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) { 218 for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) {
218 // TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when 219 // TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when
219 // factory constructors are registered directly. 220 // factory constructors are registered directly.
220 transformed 221 transformed
221 .registerTypeUse(new TypeUse.instantiation(listLiteralUse.type)); 222 .registerTypeUse(new TypeUse.instantiation(listLiteralUse.type));
222 ResolutionInterfaceType type = listLiteralUse.type; 223 registerRequiredType(listLiteralUse.type);
223 registerRequiredType(type);
224 } 224 }
225 225
226 if (worldImpact.constSymbolNames.isNotEmpty) { 226 if (worldImpact.constSymbolNames.isNotEmpty) {
227 registerImpact(_impacts.constSymbol); 227 registerImpact(_impacts.constSymbol);
228 for (String constSymbolName in worldImpact.constSymbolNames) { 228 for (String constSymbolName in worldImpact.constSymbolNames) {
229 _mirrorsDataBuilder.registerConstSymbol(constSymbolName); 229 _mirrorsDataBuilder.registerConstSymbol(constSymbolName);
230 } 230 }
231 } 231 }
232 232
233 for (StaticUse staticUse in worldImpact.staticUses) { 233 for (StaticUse staticUse in worldImpact.staticUses) {
234 switch (staticUse.kind) { 234 switch (staticUse.kind) {
235 case StaticUseKind.CLOSURE: 235 case StaticUseKind.CLOSURE:
236 registerImpact(_impacts.closure); 236 registerImpact(_impacts.closure);
237 LocalFunctionElement closure = staticUse.element; 237 Local closure = staticUse.element;
238 if (closure.type.containsTypeVariables) { 238 FunctionType type = _elementEnvironment.getLocalFunctionType(closure);
239 if (type.containsTypeVariables) {
239 registerImpact(_impacts.computeSignature); 240 registerImpact(_impacts.computeSignature);
240 } 241 }
241 break; 242 break;
242 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: 243 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
243 case StaticUseKind.CONSTRUCTOR_INVOKE: 244 case StaticUseKind.CONSTRUCTOR_INVOKE:
244 registerRequiredType(staticUse.type); 245 registerRequiredType(staticUse.type);
245 break; 246 break;
246 default: 247 default:
247 } 248 }
248 } 249 }
(...skipping 23 matching lines...) Expand all
272 273
273 for (native.NativeBehavior behavior in worldImpact.nativeData) { 274 for (native.NativeBehavior behavior in worldImpact.nativeData) {
274 _nativeResolutionEnqueuer.registerNativeBehavior( 275 _nativeResolutionEnqueuer.registerNativeBehavior(
275 transformed, behavior, worldImpact); 276 transformed, behavior, worldImpact);
276 } 277 }
277 278
278 return transformed; 279 return transformed;
279 } 280 }
280 281
281 /// Register [type] as required for the runtime type information system. 282 /// Register [type] as required for the runtime type information system.
282 void registerRequiredType(ResolutionDartType type) { 283 void registerRequiredType(DartType type) {
283 if (!type.isInterfaceType) return; 284 if (!type.isInterfaceType) return;
285 InterfaceType interfaceType = type;
284 // If [argument] has type variables or is a type variable, this method 286 // If [argument] has type variables or is a type variable, this method
285 // registers a RTI dependency between the class where the type variable is 287 // registers a RTI dependency between the class where the type variable is
286 // defined (that is the enclosing class of the current element being 288 // defined (that is the enclosing class of the current element being
287 // resolved) and the class of [type]. If the class of [type] requires RTI, 289 // resolved) and the class of [type]. If the class of [type] requires RTI,
288 // then the class of the type variable does too. 290 // then the class of the type variable does too.
289 ClassElement contextClass = Types.getClassContext(type); 291 ClassEntity contextClass = Types.getClassContext(interfaceType);
290 if (contextClass != null) { 292 if (contextClass != null) {
291 _rtiNeedBuilder.registerRtiDependency(type.element, contextClass); 293 _rtiNeedBuilder.registerRtiDependency(
294 interfaceType.element, contextClass);
292 } 295 }
293 } 296 }
294 297
295 // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType]. 298 // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType].
296 void onIsCheck(ResolutionDartType type, TransformedWorldImpact transformed) { 299 void onIsCheck(DartType type, TransformedWorldImpact transformed) {
297 void registerImpact(BackendImpact impact) { 300 void registerImpact(BackendImpact impact) {
298 impact.registerImpact(transformed, _elementEnvironment); 301 impact.registerImpact(transformed, _elementEnvironment);
299 _backendUsageBuider.processBackendImpact(impact); 302 _backendUsageBuider.processBackendImpact(impact);
300 } 303 }
301 304
302 registerRequiredType(type); 305 registerRequiredType(type);
303 type.computeUnaliased(_resolution); 306 type = _elementEnvironment.getUnaliasedType(type);
304 type = type.unaliased;
305 registerImpact(_impacts.typeCheck); 307 registerImpact(_impacts.typeCheck);
306 308
307 bool inCheckedMode = _options.enableTypeAssertions; 309 bool inCheckedMode = _options.enableTypeAssertions;
308 if (inCheckedMode) { 310 if (inCheckedMode) {
309 registerImpact(_impacts.checkedModeTypeCheck); 311 registerImpact(_impacts.checkedModeTypeCheck);
310 } 312 }
311 if (type.isMalformed) { 313 if (type.isMalformed) {
312 registerImpact(_impacts.malformedTypeCheck); 314 registerImpact(_impacts.malformedTypeCheck);
313 } 315 }
314 if (!type.treatAsRaw || type.containsTypeVariables || type.isFunctionType) { 316 if (!type.treatAsRaw || type.containsTypeVariables || type.isFunctionType) {
315 registerImpact(_impacts.genericTypeCheck); 317 registerImpact(_impacts.genericTypeCheck);
316 if (inCheckedMode) { 318 if (inCheckedMode) {
317 registerImpact(_impacts.genericCheckedModeTypeCheck); 319 registerImpact(_impacts.genericCheckedModeTypeCheck);
318 } 320 }
319 if (type.isTypeVariable) { 321 if (type.isTypeVariable) {
320 registerImpact(_impacts.typeVariableTypeCheck); 322 registerImpact(_impacts.typeVariableTypeCheck);
321 if (inCheckedMode) { 323 if (inCheckedMode) {
322 registerImpact(_impacts.typeVariableCheckedModeTypeCheck); 324 registerImpact(_impacts.typeVariableCheckedModeTypeCheck);
323 } 325 }
324 } 326 }
325 } 327 }
326 if (type is ResolutionFunctionType) { 328 if (type is FunctionType) {
327 registerImpact(_impacts.functionTypeCheck); 329 registerImpact(_impacts.functionTypeCheck);
328 } 330 }
329 if (type is ResolutionInterfaceType && 331 if (type is InterfaceType && _nativeBasicData.isNativeClass(type.element)) {
330 _nativeBasicData.isNativeClass(type.element)) {
331 registerImpact(_impacts.nativeTypeCheck); 332 registerImpact(_impacts.nativeTypeCheck);
332 } 333 }
333 } 334 }
334 } 335 }
335 336
336 class CodegenImpactTransformer { 337 class CodegenImpactTransformer {
337 final CompilerOptions _options; 338 final CompilerOptions _options;
338 final ElementEnvironment _elementEnvironment; 339 final ElementEnvironment _elementEnvironment;
339 final BackendHelpers _helpers; 340 final BackendHelpers _helpers;
340 final BackendImpacts _impacts; 341 final BackendImpacts _impacts;
(...skipping 15 matching lines...) Expand all
356 this._checkedModeHelpers, 357 this._checkedModeHelpers,
357 this._nativeData, 358 this._nativeData,
358 this._backendUsage, 359 this._backendUsage,
359 this._rtiNeed, 360 this._rtiNeed,
360 this._nativeCodegenEnqueuer, 361 this._nativeCodegenEnqueuer,
361 this._namer, 362 this._namer,
362 this._oneShotInterceptorData, 363 this._oneShotInterceptorData,
363 this._lookupMapAnalysis, 364 this._lookupMapAnalysis,
364 this._rtiChecksBuilder); 365 this._rtiChecksBuilder);
365 366
366 void onIsCheckForCodegen( 367 void onIsCheckForCodegen(DartType type, TransformedWorldImpact transformed) {
367 ResolutionDartType type, TransformedWorldImpact transformed) {
368 if (type.isDynamic) return; 368 if (type.isDynamic) return;
369 type = type.unaliased; 369 type = type.unaliased;
370 _impacts.typeCheck.registerImpact(transformed, _elementEnvironment); 370 _impacts.typeCheck.registerImpact(transformed, _elementEnvironment);
371 371
372 bool inCheckedMode = _options.enableTypeAssertions; 372 bool inCheckedMode = _options.enableTypeAssertions;
373 // [registerIsCheck] is also called for checked mode checks, so we 373 // [registerIsCheck] is also called for checked mode checks, so we
374 // need to register checked mode helpers. 374 // need to register checked mode helpers.
375 if (inCheckedMode) { 375 if (inCheckedMode) {
376 // All helpers are added to resolution queue in enqueueHelpers. These 376 // All helpers are added to resolution queue in enqueueHelpers. These
377 // calls to [enqueue] with the resolution enqueuer serve as assertions 377 // calls to [enqueue] with the resolution enqueuer serve as assertions
378 // that the helper was in fact added. 378 // that the helper was in fact added.
379 // TODO(13155): Find a way to enqueue helpers lazily. 379 // TODO(13155): Find a way to enqueue helpers lazily.
380 CheckedModeHelper helper = 380 CheckedModeHelper helper =
381 _checkedModeHelpers.getCheckedModeHelper(type, typeCast: false); 381 _checkedModeHelpers.getCheckedModeHelper(type, typeCast: false);
382 if (helper != null) { 382 if (helper != null) {
383 StaticUse staticUse = helper.getStaticUse(_helpers); 383 StaticUse staticUse = helper.getStaticUse(_helpers);
384 transformed.registerStaticUse(staticUse); 384 transformed.registerStaticUse(staticUse);
385 } 385 }
386 // We also need the native variant of the check (for DOM types). 386 // We also need the native variant of the check (for DOM types).
387 helper = 387 helper =
388 _checkedModeHelpers.getNativeCheckedModeHelper(type, typeCast: false); 388 _checkedModeHelpers.getNativeCheckedModeHelper(type, typeCast: false);
389 if (helper != null) { 389 if (helper != null) {
390 StaticUse staticUse = helper.getStaticUse(_helpers); 390 StaticUse staticUse = helper.getStaticUse(_helpers);
391 transformed.registerStaticUse(staticUse); 391 transformed.registerStaticUse(staticUse);
392 } 392 }
393 } 393 }
394 if (!type.treatAsRaw || type.containsTypeVariables) { 394 if (!type.treatAsRaw || type.containsTypeVariables) {
395 _impacts.genericIsCheck.registerImpact(transformed, _elementEnvironment); 395 _impacts.genericIsCheck.registerImpact(transformed, _elementEnvironment);
396 } 396 }
397 if (type is ResolutionInterfaceType && 397 if (type is InterfaceType && _nativeData.isNativeClass(type.element)) {
398 _nativeData.isNativeClass(type.element)) {
399 // We will neeed to add the "$is" and "$as" properties on the 398 // We will neeed to add the "$is" and "$as" properties on the
400 // JavaScript object prototype, so we make sure 399 // JavaScript object prototype, so we make sure
401 // [:defineProperty:] is compiled. 400 // [:defineProperty:] is compiled.
402 _impacts.nativeTypeCheck.registerImpact(transformed, _elementEnvironment); 401 _impacts.nativeTypeCheck.registerImpact(transformed, _elementEnvironment);
403 } 402 }
404 } 403 }
405 404
406 WorldImpact transformCodegenImpact(CodegenImpact impact) { 405 WorldImpact transformCodegenImpact(CodegenImpact impact) {
407 TransformedWorldImpact transformed = new TransformedWorldImpact(impact); 406 TransformedWorldImpact transformed = new TransformedWorldImpact(impact);
408 407
409 for (TypeUse typeUse in impact.typeUses) { 408 for (TypeUse typeUse in impact.typeUses) {
410 ResolutionDartType type = typeUse.type; 409 DartType type = typeUse.type;
411 switch (typeUse.kind) { 410 switch (typeUse.kind) {
412 case TypeUseKind.INSTANTIATION: 411 case TypeUseKind.INSTANTIATION:
413 _lookupMapAnalysis.registerInstantiatedType(type); 412 _lookupMapAnalysis.registerInstantiatedType(type);
414 break; 413 break;
415 case TypeUseKind.IS_CHECK: 414 case TypeUseKind.IS_CHECK:
416 onIsCheckForCodegen(type, transformed); 415 onIsCheckForCodegen(type, transformed);
417 break; 416 break;
418 default: 417 default:
419 } 418 }
420 } 419 }
421 420
422 for (Pair<ResolutionDartType, ResolutionDartType> check 421 for (Pair<DartType, DartType> check
423 in impact.typeVariableBoundsSubtypeChecks) { 422 in impact.typeVariableBoundsSubtypeChecks) {
424 _rtiChecksBuilder.registerTypeVariableBoundsSubtypeCheck( 423 _rtiChecksBuilder.registerTypeVariableBoundsSubtypeCheck(
425 check.a, check.b); 424 check.a, check.b);
426 } 425 }
427 426
428 for (StaticUse staticUse in impact.staticUses) { 427 for (StaticUse staticUse in impact.staticUses) {
429 switch (staticUse.kind) { 428 switch (staticUse.kind) {
430 case StaticUseKind.CLOSURE: 429 case StaticUseKind.CLOSURE:
431 LocalFunctionElement closure = staticUse.element; 430 Local closure = staticUse.element;
432 if (_rtiNeed.localFunctionNeedsRti(closure)) { 431 if (_rtiNeed.localFunctionNeedsRti(closure)) {
433 _impacts.computeSignature 432 _impacts.computeSignature
434 .registerImpact(transformed, _elementEnvironment); 433 .registerImpact(transformed, _elementEnvironment);
435 } 434 }
436 break; 435 break;
437 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: 436 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
438 case StaticUseKind.CONSTRUCTOR_INVOKE: 437 case StaticUseKind.CONSTRUCTOR_INVOKE:
439 _lookupMapAnalysis.registerInstantiatedType(staticUse.type); 438 _lookupMapAnalysis.registerInstantiatedType(staticUse.type);
440 break; 439 break;
441 default: 440 default:
442 } 441 }
443 } 442 }
444 443
445 for (Set<ClassEntity> classes in impact.specializedGetInterceptors) { 444 for (Set<ClassEntity> classes in impact.specializedGetInterceptors) {
446 _oneShotInterceptorData.registerSpecializedGetInterceptor( 445 _oneShotInterceptorData.registerSpecializedGetInterceptor(
447 classes, _namer); 446 classes, _namer);
448 } 447 }
449 448
450 if (impact.usesInterceptor) { 449 if (impact.usesInterceptor) {
451 if (_nativeCodegenEnqueuer.hasInstantiatedNativeClasses) { 450 if (_nativeCodegenEnqueuer.hasInstantiatedNativeClasses) {
452 _impacts.interceptorUse 451 _impacts.interceptorUse
453 .registerImpact(transformed, _elementEnvironment); 452 .registerImpact(transformed, _elementEnvironment);
454 // TODO(johnniwinther): Avoid these workarounds. 453 // TODO(johnniwinther): Avoid these workarounds.
455 _backendUsage.needToInitializeIsolateAffinityTag = true; 454 _backendUsage.needToInitializeIsolateAffinityTag = true;
456 _backendUsage.needToInitializeDispatchProperty = true; 455 _backendUsage.needToInitializeDispatchProperty = true;
457 } 456 }
458 } 457 }
459 458
460 for (FunctionElement element in impact.asyncMarkers) { 459 for (AsyncMarker asyncMarker in impact.asyncMarkers) {
461 switch (element.asyncMarker) { 460 switch (asyncMarker) {
462 case AsyncMarker.ASYNC: 461 case AsyncMarker.ASYNC:
463 _impacts.asyncBody.registerImpact(transformed, _elementEnvironment); 462 _impacts.asyncBody.registerImpact(transformed, _elementEnvironment);
464 break; 463 break;
465 case AsyncMarker.SYNC_STAR: 464 case AsyncMarker.SYNC_STAR:
466 _impacts.syncStarBody 465 _impacts.syncStarBody
467 .registerImpact(transformed, _elementEnvironment); 466 .registerImpact(transformed, _elementEnvironment);
468 break; 467 break;
469 case AsyncMarker.ASYNC_STAR: 468 case AsyncMarker.ASYNC_STAR:
470 _impacts.asyncStarBody 469 _impacts.asyncStarBody
471 .registerImpact(transformed, _elementEnvironment); 470 .registerImpact(transformed, _elementEnvironment);
472 break; 471 break;
473 } 472 }
474 } 473 }
475 474
476 // TODO(johnniwinther): Remove eager registration. 475 // TODO(johnniwinther): Remove eager registration.
477 return transformed; 476 return transformed;
478 } 477 }
479 } 478 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698