Chromium Code Reviews| 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" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
|
siva
2012/07/09 22:51:07
// Forward declarations.
Ivan Posva
2012/07/09 22:59:35
Done.
| |
| 14 class Isolate; | |
| 15 | |
| 14 class StoreBufferBlock { | 16 class StoreBufferBlock { |
| 15 public: | 17 public: |
| 16 // Each block contains kSize pointers. | 18 // Each block contains kSize pointers. |
| 17 static const int32_t kSize = 1024; | 19 static const int32_t kSize = 1024; |
| 18 | 20 |
| 19 StoreBufferBlock() : top_(0) {} | 21 StoreBufferBlock() : top_(0) {} |
| 20 | 22 |
| 21 static int top_offset() { return OFFSET_OF(StoreBufferBlock, top_); } | 23 static int top_offset() { return OFFSET_OF(StoreBufferBlock, top_); } |
| 22 static int pointers_offset() { | 24 static int pointers_offset() { |
| 23 return OFFSET_OF(StoreBufferBlock, pointers_); | 25 return OFFSET_OF(StoreBufferBlock, pointers_); |
| 24 } | 26 } |
| 25 | 27 |
| 26 // Add a pointer to the block of pointers. The buffer will be processed if it | 28 // Add a pointer to the block of pointers. The buffer will be processed if it |
| 27 // has been filled by this operation. | 29 // has been filled by this operation. |
| 28 void AddPointer(uword pointer) { | 30 void AddPointer(uword pointer) { |
| 29 ASSERT(top_ < kSize); | 31 ASSERT(top_ < kSize); |
| 30 pointers_[top_++] = pointer; | 32 pointers_[top_++] = pointer; |
| 31 if (top_ == kSize) { | 33 if (top_ == kSize) { |
| 32 ProcessBuffer(); | 34 ProcessBuffer(); |
| 33 } | 35 } |
| 34 } | 36 } |
| 35 | 37 |
| 36 // Process this store buffer and remember its contents in the heap. | 38 // Process this store buffer and remember its contents in the heap. |
| 37 void ProcessBuffer(); | 39 void ProcessBuffer(); |
| 40 void ProcessBuffer(Isolate* isolate); | |
| 38 | 41 |
| 39 bool Contains(uword pointer); | 42 bool Contains(uword pointer); |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 int32_t top_; | 45 int32_t top_; |
| 43 uword pointers_[kSize]; | 46 uword pointers_[kSize]; |
| 44 | 47 |
| 45 friend class StoreBuffer; | 48 friend class StoreBuffer; |
| 46 }; | 49 }; |
| 47 | 50 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 75 private: | 78 private: |
| 76 DISALLOW_COPY_AND_ASSIGN(DedupSet); | 79 DISALLOW_COPY_AND_ASSIGN(DedupSet); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 DedupSet* dedup_sets_; | 82 DedupSet* dedup_sets_; |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace dart | 85 } // namespace dart |
| 83 | 86 |
| 84 #endif // VM_STORE_BUFFER_H_ | 87 #endif // VM_STORE_BUFFER_H_ |
| OLD | NEW |