| 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 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 friend class StoreBuffer; | 46 friend class StoreBuffer; |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(StoreBufferBlock); | 48 DISALLOW_COPY_AND_ASSIGN(StoreBufferBlock); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 | 51 |
| 52 class StoreBuffer { | 52 class StoreBuffer { |
| 53 public: | 53 public: |
| 54 StoreBuffer() : blocks_(new StoreBufferBlock(NULL)), full_count_(0) {} | 54 StoreBuffer() : blocks_(new StoreBufferBlock(NULL)), full_count_(0) {} |
| 55 explicit StoreBuffer(bool shallow_copy) : blocks_(NULL), full_count_(0) { |
| 56 // The value shallow_copy is only used to select this non-allocating |
| 57 // constructor. It is always expected to be true. |
| 58 ASSERT(shallow_copy); |
| 59 } |
| 55 ~StoreBuffer(); | 60 ~StoreBuffer(); |
| 56 | 61 |
| 57 intptr_t Count() const { | 62 intptr_t Count() const { |
| 58 return blocks_->Count() + (full_count_ * StoreBufferBlock::kSize); | 63 return blocks_->Count() + (full_count_ * StoreBufferBlock::kSize); |
| 59 } | 64 } |
| 60 | 65 |
| 61 void Reset(); | 66 void Reset(); |
| 62 | 67 |
| 63 void AddObject(RawObject* obj) { | 68 void AddObject(RawObject* obj) { |
| 64 StoreBufferBlock* block = blocks_; | 69 StoreBufferBlock* block = blocks_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 104 |
| 100 StoreBufferBlock* blocks_; | 105 StoreBufferBlock* blocks_; |
| 101 intptr_t full_count_; | 106 intptr_t full_count_; |
| 102 | 107 |
| 103 DISALLOW_COPY_AND_ASSIGN(StoreBuffer); | 108 DISALLOW_COPY_AND_ASSIGN(StoreBuffer); |
| 104 }; | 109 }; |
| 105 | 110 |
| 106 } // namespace dart | 111 } // namespace dart |
| 107 | 112 |
| 108 #endif // VM_STORE_BUFFER_H_ | 113 #endif // VM_STORE_BUFFER_H_ |
| OLD | NEW |