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

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

Issue 2873113004: Add equivalence check of NativeData and InterceptorData (Closed)
Patch Set: Created 3 years, 7 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_elements.dart' show CommonElements, ElementEnvironment; 8 import '../common_elements.dart' show CommonElements, ElementEnvironment;
9 import '../elements/elements.dart' show MemberElement; 9 import '../elements/elements.dart' show MemberElement;
10 import '../elements/entities.dart'; 10 import '../elements/entities.dart';
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (interceptedClasses.contains(element)) return true; 197 if (interceptedClasses.contains(element)) return true;
198 if (_classesMixedIntoInterceptedClasses.contains(element)) return true; 198 if (_classesMixedIntoInterceptedClasses.contains(element)) return true;
199 return false; 199 return false;
200 } 200 }
201 201
202 bool isMixedIntoInterceptedClass(ClassEntity element) => 202 bool isMixedIntoInterceptedClass(ClassEntity element) =>
203 _classesMixedIntoInterceptedClasses.contains(element); 203 _classesMixedIntoInterceptedClasses.contains(element);
204 204
205 Iterable<ClassEntity> get interceptedClasses => _interceptedClasses; 205 Iterable<ClassEntity> get interceptedClasses => _interceptedClasses;
206 206
207 Map<String, Set<MemberEntity>> get interceptedElementsForTesting =>
208 _interceptedElements;
209
210 Set<ClassEntity> get classesMixedIntoInterceptedClassesForTesting =>
211 _classesMixedIntoInterceptedClasses;
212
207 bool mayGenerateInstanceofCheck(DartType type, ClosedWorld closedWorld) { 213 bool mayGenerateInstanceofCheck(DartType type, ClosedWorld closedWorld) {
208 // We can use an instanceof check for raw types that have no subclass that 214 // We can use an instanceof check for raw types that have no subclass that
209 // is mixed-in or in an implements clause. 215 // is mixed-in or in an implements clause.
210 216
211 if (!type.treatAsRaw) return false; 217 if (!type.treatAsRaw) return false;
212 InterfaceType interfaceType = type; 218 InterfaceType interfaceType = type;
213 ClassEntity classElement = interfaceType.element; 219 ClassEntity classElement = interfaceType.element;
214 if (isInterceptedClass(classElement)) return false; 220 if (isInterceptedClass(classElement)) return false;
215 return closedWorld.hasOnlySubclasses(classElement); 221 return closedWorld.hasOnlySubclasses(classElement);
216 } 222 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 jsAst.Name name = namer.nameForGetInterceptor(classes); 334 jsAst.Name name = namer.nameForGetInterceptor(classes);
329 if (classes.contains(_commonElements.jsInterceptorClass)) { 335 if (classes.contains(_commonElements.jsInterceptorClass)) {
330 // We can't use a specialized [getInterceptorMethod], so we make 336 // We can't use a specialized [getInterceptorMethod], so we make
331 // sure we emit the one with all checks. 337 // sure we emit the one with all checks.
332 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses; 338 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses;
333 } else { 339 } else {
334 _specializedGetInterceptors[name] = classes; 340 _specializedGetInterceptors[name] = classes;
335 } 341 }
336 } 342 }
337 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698