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

Side by Side Diff: runtime/vm/store_buffer.h

Issue 10702067: - Separate store buffer data in the isolate into the StoreBufferBlock and (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/store_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11
11 namespace dart { 12 namespace dart {
12 13
13 class StoreBufferBlock { 14 class StoreBufferBlock {
14 public: 15 public:
15 // Each block contains kSize pointers. 16 // Each block contains kSize pointers.
16 static const int32_t kSize = 1024; 17 static const int32_t kSize = 1024;
17 18
18 StoreBufferBlock() : top_(0) {} 19 StoreBufferBlock() : top_(0) {}
19 20
(...skipping 13 matching lines...) Expand all
33 } 34 }
34 35
35 // Process this store buffer and remember its contents in the heap. 36 // Process this store buffer and remember its contents in the heap.
36 void ProcessBuffer(); 37 void ProcessBuffer();
37 38
38 bool Contains(uword pointer); 39 bool Contains(uword pointer);
39 40
40 private: 41 private:
41 int32_t top_; 42 int32_t top_;
42 uword pointers_[kSize]; 43 uword pointers_[kSize];
44
45 friend class StoreBuffer;
46 };
47
48
49 class StoreBuffer {
50 public:
51 StoreBuffer() : dedup_sets_(new DedupSet()) {}
52 ~StoreBuffer();
53
54 void AddPointer(uword address);
55
56 void ProcessBlock(StoreBufferBlock* block);
57
58 private:
59 // Simple linked list element containing a HashSet of old->new pointers.
60 class DedupSet {
61 public:
62 enum {
63 kSetSize = 1024,
64 kFillRatio = 80
65 };
66
67 DedupSet() : set_(new HashSet(kSetSize, kFillRatio)), next_(NULL) {}
68 ~DedupSet() {
69 delete set_;
70 }
71
72 DedupSet* next_;
73 HashSet* set_;
74
75 private:
76 DISALLOW_COPY_AND_ASSIGN(DedupSet);
77 };
78
79 DedupSet* dedup_sets_;
43 }; 80 };
44 81
45 } // namespace dart 82 } // namespace dart
46 83
47 #endif // VM_STORE_BUFFER_H_ 84 #endif // VM_STORE_BUFFER_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/store_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698