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

Unified Diff: vm/store_buffer.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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698