| Index: vm/store_buffer.h
|
| ===================================================================
|
| --- vm/store_buffer.h (revision 9751)
|
| +++ vm/store_buffer.h (working copy)
|
| @@ -26,6 +26,14 @@
|
| return OFFSET_OF(StoreBufferBlock, pointers_);
|
| }
|
|
|
| + intptr_t Count() const { return top_; }
|
| +
|
| + uword At(intptr_t i) const {
|
| + ASSERT(i >= 0);
|
| + ASSERT(i < top_);
|
| + return pointers_[i];
|
| + }
|
| +
|
| // Add a pointer to the block of pointers. The buffer will be processed if it
|
| // has been filled by this operation.
|
| void AddPointer(uword pointer) {
|
| @@ -47,40 +55,56 @@
|
| uword pointers_[kSize];
|
|
|
| friend class StoreBuffer;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(StoreBufferBlock);
|
| };
|
|
|
|
|
| class StoreBuffer {
|
| public:
|
| - StoreBuffer() : dedup_sets_(new DedupSet()) {}
|
| - ~StoreBuffer();
|
| -
|
| - void AddPointer(uword address);
|
| -
|
| - void ProcessBlock(StoreBufferBlock* block);
|
| -
|
| - private:
|
| // Simple linked list element containing a HashSet of old->new pointers.
|
| class DedupSet {
|
| - public:
|
| + public:
|
| enum {
|
| kSetSize = 1024,
|
| - kFillRatio = 80
|
| + kFillRatio = 75
|
| };
|
|
|
| - DedupSet() : next_(NULL), set_(new HashSet(kSetSize, kFillRatio)) {}
|
| + explicit DedupSet(DedupSet* next)
|
| + : next_(next), set_(new HashSet(kSetSize, kFillRatio)) {}
|
| ~DedupSet() {
|
| delete set_;
|
| }
|
|
|
| + DedupSet* next() const { return next_; }
|
| + HashSet* set() const { return set_; }
|
| +
|
| + private:
|
| DedupSet* next_;
|
| HashSet* set_;
|
|
|
| - private:
|
| DISALLOW_COPY_AND_ASSIGN(DedupSet);
|
| };
|
|
|
| + StoreBuffer() : dedup_sets_(new DedupSet(NULL)), count_(1) {}
|
| + ~StoreBuffer();
|
| +
|
| + void AddPointer(uword address);
|
| +
|
| + void ProcessBlock(StoreBufferBlock* block);
|
| +
|
| + DedupSet* DedupSets() {
|
| + DedupSet* result = dedup_sets_;
|
| + dedup_sets_ = new DedupSet(NULL);
|
| + count_ = 1;
|
| + return result;
|
| + }
|
| +
|
| + private:
|
| DedupSet* dedup_sets_;
|
| + intptr_t count_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(StoreBuffer);
|
| };
|
|
|
| } // namespace dart
|
|
|