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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/universe/function_set.dart

Issue 14173003: Remove Collection, Collections and clean up List/Set/Queue implementations of retain/remove. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
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 part of universe; 5 part of universe;
6 6
7 // TODO(kasperl): This actually holds getters and setters just fine 7 // TODO(kasperl): This actually holds getters and setters just fine
8 // too and stricly they aren't functions. Maybe this needs a better 8 // too and stricly they aren't functions. Maybe this needs a better
9 // name -- something like ElementSet seems a bit too generic. 9 // name -- something like ElementSet seems a bit too generic.
10 class FunctionSet { 10 class FunctionSet {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 class FunctionSetNode { 67 class FunctionSetNode {
68 final SourceString name; 68 final SourceString name;
69 final Map<Selector, FunctionSetQuery> cache = 69 final Map<Selector, FunctionSetQuery> cache =
70 new Map<Selector, FunctionSetQuery>(); 70 new Map<Selector, FunctionSetQuery>();
71 71
72 // Initially, we keep the elements in a list because it is more 72 // Initially, we keep the elements in a list because it is more
73 // compact than a hash set. Once we get enough elements, we change 73 // compact than a hash set. Once we get enough elements, we change
74 // the representation to be a set to get faster contains checks. 74 // the representation to be a set to get faster contains checks.
75 static const int MAX_ELEMENTS_IN_LIST = 8; 75 static const int MAX_ELEMENTS_IN_LIST = 8;
76 Collection<Element> elements = <Element>[]; 76 var elements = <Element>[];
77 bool isList = true; 77 bool isList = true;
78 78
79 FunctionSetNode(this.name); 79 FunctionSetNode(this.name);
80 80
81 void add(Element element) { 81 void add(Element element) {
82 assert(element.name == name); 82 assert(element.name == name);
83 // We try to avoid clearing the cache unless we have to. For that 83 // We try to avoid clearing the cache unless we have to. For that
84 // reason we keep the explicit contains check even though the add 84 // reason we keep the explicit contains check even though the add
85 // method ends up doing the work again (for sets). 85 // method ends up doing the work again (for sets).
86 if (!elements.contains(element)) { 86 if (!elements.contains(element)) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 Selector selector, 150 Selector selector,
151 Compiler compiler) { 151 Compiler compiler) {
152 return new FunctionSetQuery(functions); 152 return new FunctionSetQuery(functions);
153 } 153 }
154 } 154 }
155 155
156 class FunctionSetQuery { 156 class FunctionSetQuery {
157 final List<Element> functions; 157 final List<Element> functions;
158 const FunctionSetQuery(this.functions); 158 const FunctionSetQuery(this.functions);
159 } 159 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/mirrors/util.dart ('k') | sdk/lib/collection/collections.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698