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

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

Issue 1435853002: Register closures using StaticUse. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment 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/resolution/registry.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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 fieldGetters.add(element); 361 fieldGetters.add(element);
362 break; 362 break;
363 case StaticUseKind.FIELD_SET: 363 case StaticUseKind.FIELD_SET:
364 fieldSetters.add(element); 364 fieldSetters.add(element);
365 break; 365 break;
366 case StaticUseKind.SUPER_TEAR_OFF: 366 case StaticUseKind.SUPER_TEAR_OFF:
367 methodsNeedingSuperGetter.add(element); 367 methodsNeedingSuperGetter.add(element);
368 break; 368 break;
369 case StaticUseKind.GENERAL: 369 case StaticUseKind.GENERAL:
370 break; 370 break;
371 case StaticUseKind.CLOSURE:
372 allClosures.add(element);
373 break;
371 } 374 }
372 } 375 }
373 376
374 void forgetElement(Element element, Compiler compiler) { 377 void forgetElement(Element element, Compiler compiler) {
375 allClosures.remove(element); 378 allClosures.remove(element);
376 slowDirectlyNestedClosures(element).forEach(compiler.forgetElement); 379 slowDirectlyNestedClosures(element).forEach(compiler.forgetElement);
377 closurizedMembers.remove(element); 380 closurizedMembers.remove(element);
378 fieldSetters.remove(element); 381 fieldSetters.remove(element);
379 fieldGetters.remove(element); 382 fieldGetters.remove(element);
380 _directlyInstantiatedClasses.remove(element); 383 _directlyInstantiatedClasses.remove(element);
(...skipping 10 matching lines...) Expand all
391 // TODO(ahe): Replace this method with something that is O(1), for example, 394 // TODO(ahe): Replace this method with something that is O(1), for example,
392 // by using a map. 395 // by using a map.
393 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { 396 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) {
394 // Return new list to guard against concurrent modifications. 397 // Return new list to guard against concurrent modifications.
395 return new List<LocalFunctionElement>.from( 398 return new List<LocalFunctionElement>.from(
396 allClosures.where((LocalFunctionElement closure) { 399 allClosures.where((LocalFunctionElement closure) {
397 return closure.executableContext == element; 400 return closure.executableContext == element;
398 })); 401 }));
399 } 402 }
400 } 403 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | pkg/compiler/lib/src/universe/use.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698