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

Side by Side Diff: pkg/compiler/lib/src/universe/universe.dart

Issue 1462333002: Revert "Register super field set explicitly in the universe." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/universe/use.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 universe; 5 library universe;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart' show 10 import '../compiler.dart' show
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 bool hasInvocation(Element member, World world) { 275 bool hasInvocation(Element member, World world) {
276 return _hasMatchingSelector(_invokedNames[member.name], member, world); 276 return _hasMatchingSelector(_invokedNames[member.name], member, world);
277 } 277 }
278 278
279 bool hasInvokedGetter(Element member, World world) { 279 bool hasInvokedGetter(Element member, World world) {
280 return _hasMatchingSelector(_invokedGetters[member.name], member, world) || 280 return _hasMatchingSelector(_invokedGetters[member.name], member, world) ||
281 member.isFunction && methodsNeedingSuperGetter.contains(member); 281 member.isFunction && methodsNeedingSuperGetter.contains(member);
282 } 282 }
283 283
284 bool hasInvokedSetter(Element member, World world) { 284 bool hasInvokedSetter(Element member, World world) {
285 return _hasMatchingSelector(_invokedSetters[member.name], member, world) || 285 return _hasMatchingSelector(_invokedSetters[member.name], member, world);
286 fieldSetters.contains(member);
287 } 286 }
288 287
289 bool registerDynamicUse(DynamicUse dynamicUse) { 288 bool registerDynamicUse(DynamicUse dynamicUse) {
290 switch (dynamicUse.kind) { 289 switch (dynamicUse.kind) {
291 case DynamicUseKind.INVOKE: 290 case DynamicUseKind.INVOKE:
292 return _registerNewSelector(dynamicUse, _invokedNames); 291 return _registerNewSelector(dynamicUse, _invokedNames);
293 case DynamicUseKind.GET: 292 case DynamicUseKind.GET:
294 return _registerNewSelector(dynamicUse, _invokedGetters); 293 return _registerNewSelector(dynamicUse, _invokedGetters);
295 case DynamicUseKind.SET: 294 case DynamicUseKind.SET:
296 return _registerNewSelector(dynamicUse, _invokedSetters); 295 return _registerNewSelector(dynamicUse, _invokedSetters);
297 } 296 }
298 } 297 }
299 298
300 bool _registerNewSelector( 299 bool _registerNewSelector(
301 DynamicUse dynamicUse, 300 DynamicUse dynamicUse,
302 Map<String, Map<Selector, SelectorConstraints>> selectorMap) { 301 Map<String, Map<Selector, SelectorConstraints>> selectorMap) {
303 Selector selector = dynamicUse.selector; 302 Selector selector = dynamicUse.selector;
304 String name = selector.name; 303 String name = selector.name;
305 ReceiverConstraint mask = dynamicUse.mask; 304 ReceiverConstraint mask = dynamicUse.mask;
306 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent( 305 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent(
307 name, () => new Maplet<Selector, SelectorConstraints>()); 306 name, () => new Maplet<Selector, SelectorConstraints>());
308 UniverseSelectorConstraints constraints = selectors.putIfAbsent( 307 UniverseSelectorConstraints constraints = selectors.putIfAbsent(
309 selector, () { 308 selector, () => selectorConstraintsStrategy.createSelectorConstraints(se lector));
310 return selectorConstraintsStrategy.createSelectorConstraints(selector);
311 });
312 return constraints.addReceiverConstraint(mask); 309 return constraints.addReceiverConstraint(mask);
313 } 310 }
314 311
315 Map<Selector, SelectorConstraints> _asUnmodifiable( 312 Map<Selector, SelectorConstraints> _asUnmodifiable(
316 Map<Selector, SelectorConstraints> map) { 313 Map<Selector, SelectorConstraints> map) {
317 if (map == null) return null; 314 if (map == null) return null;
318 return new UnmodifiableMapView(map); 315 return new UnmodifiableMapView(map);
319 } 316 }
320 317
321 Map<Selector, SelectorConstraints> invocationsByName(String name) { 318 Map<Selector, SelectorConstraints> invocationsByName(String name) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 if (Elements.isStaticOrTopLevel(element) && element.isField) { 357 if (Elements.isStaticOrTopLevel(element) && element.isField) {
361 allReferencedStaticFields.add(element); 358 allReferencedStaticFields.add(element);
362 } 359 }
363 switch (staticUse.kind) { 360 switch (staticUse.kind) {
364 case StaticUseKind.STATIC_TEAR_OFF: 361 case StaticUseKind.STATIC_TEAR_OFF:
365 staticFunctionsNeedingGetter.add(element); 362 staticFunctionsNeedingGetter.add(element);
366 break; 363 break;
367 case StaticUseKind.FIELD_GET: 364 case StaticUseKind.FIELD_GET:
368 fieldGetters.add(element); 365 fieldGetters.add(element);
369 break; 366 break;
370 case StaticUseKind.SUPER_FIELD_SET:
371 case StaticUseKind.FIELD_SET: 367 case StaticUseKind.FIELD_SET:
372 fieldSetters.add(element); 368 fieldSetters.add(element);
373 break; 369 break;
374 case StaticUseKind.SUPER_TEAR_OFF: 370 case StaticUseKind.SUPER_TEAR_OFF:
375 methodsNeedingSuperGetter.add(element); 371 methodsNeedingSuperGetter.add(element);
376 break; 372 break;
377 case StaticUseKind.GENERAL: 373 case StaticUseKind.GENERAL:
378 break; 374 break;
379 case StaticUseKind.CLOSURE: 375 case StaticUseKind.CLOSURE:
380 allClosures.add(element); 376 allClosures.add(element);
(...skipping 21 matching lines...) Expand all
402 // TODO(ahe): Replace this method with something that is O(1), for example, 398 // TODO(ahe): Replace this method with something that is O(1), for example,
403 // by using a map. 399 // by using a map.
404 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { 400 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) {
405 // Return new list to guard against concurrent modifications. 401 // Return new list to guard against concurrent modifications.
406 return new List<LocalFunctionElement>.from( 402 return new List<LocalFunctionElement>.from(
407 allClosures.where((LocalFunctionElement closure) { 403 allClosures.where((LocalFunctionElement closure) {
408 return closure.executableContext == element; 404 return closure.executableContext == element;
409 })); 405 }));
410 } 406 }
411 } 407 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/universe/use.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698