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

Side by Side Diff: vm/hash_set.h

Issue 10797021: - Start using the collected store buffer entries to find (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « vm/code_generator.cc ('k') | vm/heap.cc » ('j') | vm/scavenger.cc » ('J')
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 #ifndef VM_HASH_SET_H_ 5 #ifndef VM_HASH_SET_H_
6 #define VM_HASH_SET_H_ 6 #define VM_HASH_SET_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 10
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 intptr_t Size() const { 30 intptr_t Size() const {
31 return size_mask_ + 1; 31 return size_mask_ + 1;
32 } 32 }
33 33
34 intptr_t Count() const { 34 intptr_t Count() const {
35 return count_; 35 return count_;
36 } 36 }
37 37
38 uword At(intptr_t i) const {
39 ASSERT(i >= 0);
40 ASSERT(i < Size());
41 return keys_[i];
42 }
43
38 // Returns false if the caller should stop adding entries to this HashSet. 44 // Returns false if the caller should stop adding entries to this HashSet.
39 bool Add(uword value) { 45 bool Add(uword value) {
40 ASSERT(value != 0); 46 ASSERT(value != 0);
41 ASSERT(count_ < growth_limit_); 47 ASSERT(count_ < growth_limit_);
42 intptr_t hash = Hash(value); 48 intptr_t hash = Hash(value);
43 while (true) { 49 while (true) {
44 if (keys_[hash] == value) { 50 if (keys_[hash] == value) {
45 return true; 51 return true;
46 } else if (SlotIsEmpty(hash)) { 52 } else if (SlotIsEmpty(hash)) {
47 keys_[hash] = value; 53 keys_[hash] = value;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 intptr_t growth_limit_; 94 intptr_t growth_limit_;
89 intptr_t count_; 95 intptr_t count_;
90 intptr_t fill_ratio_; 96 intptr_t fill_ratio_;
91 97
92 DISALLOW_IMPLICIT_CONSTRUCTORS(HashSet); 98 DISALLOW_IMPLICIT_CONSTRUCTORS(HashSet);
93 }; 99 };
94 100
95 } // namespace dart 101 } // namespace dart
96 102
97 #endif // VM_HASH_SET_H_ 103 #endif // VM_HASH_SET_H_
OLDNEW
« no previous file with comments | « vm/code_generator.cc ('k') | vm/heap.cc » ('j') | vm/scavenger.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698