| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_WEAK_TABLE_H_ | 5 #ifndef VM_WEAK_TABLE_H_ |
| 6 #define VM_WEAK_TABLE_H_ | 6 #define VM_WEAK_TABLE_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (obj == key) { | 85 if (obj == key) { |
| 86 return ValueAt(idx); | 86 return ValueAt(idx); |
| 87 } | 87 } |
| 88 idx = (idx + 1) & mask; | 88 idx = (idx + 1) & mask; |
| 89 obj = ObjectAt(idx); | 89 obj = ObjectAt(idx); |
| 90 } | 90 } |
| 91 ASSERT(ValueAt(idx) == 0); | 91 ASSERT(ValueAt(idx) == 0); |
| 92 return 0; | 92 return 0; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void Reset(); |
| 96 |
| 95 private: | 97 private: |
| 96 enum { | 98 enum { |
| 97 kObjectOffset = 0, | 99 kObjectOffset = 0, |
| 98 kValueOffset, | 100 kValueOffset, |
| 99 kEntrySize, | 101 kEntrySize, |
| 100 }; | 102 }; |
| 101 | 103 |
| 102 static const intptr_t kDeletedEntry = 1; // Equivalent to a tagged NULL. | 104 static const intptr_t kDeletedEntry = 1; // Equivalent to a tagged NULL. |
| 103 static const intptr_t kMinSize = 8; | 105 static const intptr_t kMinSize = 8; |
| 104 | 106 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 intptr_t size_; | 165 intptr_t size_; |
| 164 intptr_t used_; | 166 intptr_t used_; |
| 165 intptr_t count_; | 167 intptr_t count_; |
| 166 | 168 |
| 167 DISALLOW_COPY_AND_ASSIGN(WeakTable); | 169 DISALLOW_COPY_AND_ASSIGN(WeakTable); |
| 168 }; | 170 }; |
| 169 | 171 |
| 170 } // namespace dart | 172 } // namespace dart |
| 171 | 173 |
| 172 #endif // VM_WEAK_TABLE_H_ | 174 #endif // VM_WEAK_TABLE_H_ |
| OLD | NEW |