| OLD | NEW |
| 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_STORE_BUFFER_H_ | 5 #ifndef VM_STORE_BUFFER_H_ |
| 6 #define VM_STORE_BUFFER_H_ | 6 #define VM_STORE_BUFFER_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/hash_set.h" | 10 #include "vm/hash_set.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 DISALLOW_COPY_AND_ASSIGN(DedupSet); | 88 DISALLOW_COPY_AND_ASSIGN(DedupSet); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 StoreBuffer() : dedup_sets_(new DedupSet(NULL)), count_(1) {} | 91 StoreBuffer() : dedup_sets_(new DedupSet(NULL)), count_(1) {} |
| 92 ~StoreBuffer(); | 92 ~StoreBuffer(); |
| 93 | 93 |
| 94 void Reset(); | 94 void Reset(); |
| 95 | 95 |
| 96 void AddPointer(uword address); | 96 void AddPointer(uword address); |
| 97 | 97 |
| 98 // Drain StoreBufferBlock into deduplication sets. |
| 98 void ProcessBlock(StoreBufferBlock* block); | 99 void ProcessBlock(StoreBufferBlock* block); |
| 99 | 100 |
| 100 DedupSet* DedupSets() { | 101 DedupSet* DedupSets() { |
| 101 DedupSet* result = dedup_sets_; | 102 DedupSet* result = dedup_sets_; |
| 102 dedup_sets_ = new DedupSet(NULL); | 103 dedup_sets_ = new DedupSet(NULL); |
| 103 count_ = 1; | 104 count_ = 1; |
| 104 return result; | 105 return result; |
| 105 } | 106 } |
| 106 | 107 |
| 107 private: | 108 private: |
| 109 // Add pointer to deduplication sets. Returns true if the current set is full |
| 110 // and a new set was created. |
| 111 bool AddPointerInternal(uword address); |
| 112 |
| 108 DedupSet* dedup_sets_; | 113 DedupSet* dedup_sets_; |
| 109 intptr_t count_; | 114 intptr_t count_; |
| 110 | 115 |
| 111 DISALLOW_COPY_AND_ASSIGN(StoreBuffer); | 116 DISALLOW_COPY_AND_ASSIGN(StoreBuffer); |
| 112 }; | 117 }; |
| 113 | 118 |
| 114 } // namespace dart | 119 } // namespace dart |
| 115 | 120 |
| 116 #endif // VM_STORE_BUFFER_H_ | 121 #endif // VM_STORE_BUFFER_H_ |
| OLD | NEW |