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

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

Issue 2776383002: Use InterceptorDataBuilderImpl and BackendUsageBuilderImpl for kernel/closed_world_test (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.interceptor_data; 5 library js_backend.interceptor_data;
6 6
7 import '../common/names.dart' show Identifiers; 7 import '../common/names.dart' show Identifiers;
8 import '../common/resolution.dart' show Resolution; 8 import '../common/resolution.dart' show Resolution;
9 import '../common_elements.dart' show CommonElements, ElementEnvironment; 9 import '../common_elements.dart' show CommonElements, ElementEnvironment;
10 import '../elements/elements.dart' show MemberElement; 10 import '../elements/elements.dart' show MemberElement;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if (isInterceptedClass(classElement)) return false; 213 if (isInterceptedClass(classElement)) return false;
214 return _closedWorld.hasOnlySubclasses(classElement); 214 return _closedWorld.hasOnlySubclasses(classElement);
215 } 215 }
216 } 216 }
217 217
218 class InterceptorDataBuilderImpl implements InterceptorDataBuilder { 218 class InterceptorDataBuilderImpl implements InterceptorDataBuilder {
219 final NativeBasicData _nativeData; 219 final NativeBasicData _nativeData;
220 final BackendHelpers _helpers; 220 final BackendHelpers _helpers;
221 final ElementEnvironment _elementEnvironment; 221 final ElementEnvironment _elementEnvironment;
222 final CommonElements _commonElements; 222 final CommonElements _commonElements;
223 final Resolution _resolution;
224 223
225 /// The members of instantiated interceptor classes: maps a member name to the 224 /// The members of instantiated interceptor classes: maps a member name to the
226 /// list of members that have that name. This map is used by the codegen to 225 /// list of members that have that name. This map is used by the codegen to
227 /// know whether a send must be intercepted or not. 226 /// know whether a send must be intercepted or not.
228 final Map<String, Set<MemberEntity>> _interceptedElements = 227 final Map<String, Set<MemberEntity>> _interceptedElements =
229 <String, Set<MemberEntity>>{}; 228 <String, Set<MemberEntity>>{};
230 229
231 /// Set of classes whose methods are intercepted. 230 /// Set of classes whose methods are intercepted.
232 final Set<ClassEntity> _interceptedClasses = new Set<ClassEntity>(); 231 final Set<ClassEntity> _interceptedClasses = new Set<ClassEntity>();
233 232
234 /// Set of classes used as mixins on intercepted (native and primitive) 233 /// Set of classes used as mixins on intercepted (native and primitive)
235 /// classes. Methods on these classes might also be mixed in to regular Dart 234 /// classes. Methods on these classes might also be mixed in to regular Dart
236 /// (unintercepted) classes. 235 /// (unintercepted) classes.
237 final Set<ClassEntity> _classesMixedIntoInterceptedClasses = 236 final Set<ClassEntity> _classesMixedIntoInterceptedClasses =
238 new Set<ClassEntity>(); 237 new Set<ClassEntity>();
239 238
240 InterceptorDataBuilderImpl(this._nativeData, this._helpers, 239 InterceptorDataBuilderImpl(this._nativeData, this._helpers,
241 this._elementEnvironment, this._commonElements, this._resolution); 240 this._elementEnvironment, this._commonElements);
242 241
243 InterceptorData onResolutionComplete(ClosedWorld closedWorld) { 242 InterceptorData onResolutionComplete(ClosedWorld closedWorld) {
244 return new InterceptorDataImpl( 243 return new InterceptorDataImpl(
245 _nativeData, 244 _nativeData,
246 _helpers, 245 _helpers,
247 closedWorld, 246 closedWorld,
248 _interceptedElements, 247 _interceptedElements,
249 _interceptedClasses, 248 _interceptedClasses,
250 _classesMixedIntoInterceptedClasses); 249 _classesMixedIntoInterceptedClasses);
251 } 250 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 jsAst.Name name = namer.nameForGetInterceptor(classes); 328 jsAst.Name name = namer.nameForGetInterceptor(classes);
330 if (classes.contains(_helpers.jsInterceptorClass)) { 329 if (classes.contains(_helpers.jsInterceptorClass)) {
331 // We can't use a specialized [getInterceptorMethod], so we make 330 // We can't use a specialized [getInterceptorMethod], so we make
332 // sure we emit the one with all checks. 331 // sure we emit the one with all checks.
333 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses; 332 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses;
334 } else { 333 } else {
335 _specializedGetInterceptors[name] = classes; 334 _specializedGetInterceptors[name] = classes;
336 } 335 }
337 } 336 }
338 } 337 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend_usage.dart ('k') | tests/compiler/dart2js/kernel/closed_world_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698