| 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. |
| 99 // Returns true if new sets were created. |
| 100 bool DrainBlock(StoreBufferBlock* block); |
| 101 |
| 102 // Drain StoreBufferBlock into deduplication sets. |
| 103 // Schedule an interrupt if we run over the max number of deduplication sets. |
| 98 void ProcessBlock(StoreBufferBlock* block); | 104 void ProcessBlock(StoreBufferBlock* block); |
| 99 | 105 |
| 100 DedupSet* DedupSets() { | 106 DedupSet* DedupSets() { |
| 101 DedupSet* result = dedup_sets_; | 107 DedupSet* result = dedup_sets_; |
| 102 dedup_sets_ = new DedupSet(NULL); | 108 dedup_sets_ = new DedupSet(NULL); |
| 103 count_ = 1; | 109 count_ = 1; |
| 104 return result; | 110 return result; |
| 105 } | 111 } |
| 106 | 112 |
| 107 private: | 113 private: |
| 114 // Add pointer to deduplication sets. Returns true if the current set is full |
| 115 // and a new set was created. |
| 116 bool AddPointerInternal(uword address); |
| 117 |
| 118 // Check if we run over the max number of deduplication sets. |
| 119 // If we did schedule an interrupt. |
| 120 void CheckThreshold(); |
| 121 |
| 108 DedupSet* dedup_sets_; | 122 DedupSet* dedup_sets_; |
| 109 intptr_t count_; | 123 intptr_t count_; |
| 110 | 124 |
| 111 DISALLOW_COPY_AND_ASSIGN(StoreBuffer); | 125 DISALLOW_COPY_AND_ASSIGN(StoreBuffer); |
| 112 }; | 126 }; |
| 113 | 127 |
| 114 } // namespace dart | 128 } // namespace dart |
| 115 | 129 |
| 116 #endif // VM_STORE_BUFFER_H_ | 130 #endif // VM_STORE_BUFFER_H_ |
| OLD | NEW |