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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 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
« no previous file with comments | « runtime/vm/stack_trace.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 RUNTIME_VM_STORE_BUFFER_H_ 5 #ifndef RUNTIME_VM_STORE_BUFFER_H_
6 #define RUNTIME_VM_STORE_BUFFER_H_ 6 #define RUNTIME_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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 PointerBlock<Size>* next_; 67 PointerBlock<Size>* next_;
68 int32_t top_; 68 int32_t top_;
69 RawObject* pointers_[kSize]; 69 RawObject* pointers_[kSize];
70 70
71 template <int> 71 template <int>
72 friend class BlockStack; 72 friend class BlockStack;
73 73
74 DISALLOW_COPY_AND_ASSIGN(PointerBlock); 74 DISALLOW_COPY_AND_ASSIGN(PointerBlock);
75 }; 75 };
76 76
77
78 // A synchronized collection of pointer blocks of a particular size. 77 // A synchronized collection of pointer blocks of a particular size.
79 // This class is meant to be used as a base (note PushBlockImpl is protected). 78 // This class is meant to be used as a base (note PushBlockImpl is protected).
80 // The global list of cached empty blocks is currently per-size. 79 // The global list of cached empty blocks is currently per-size.
81 template <int BlockSize> 80 template <int BlockSize>
82 class BlockStack { 81 class BlockStack {
83 public: 82 public:
84 typedef PointerBlock<BlockSize> Block; 83 typedef PointerBlock<BlockSize> Block;
85 84
86 BlockStack(); 85 BlockStack();
87 ~BlockStack(); 86 ~BlockStack();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 131
133 // Note: This is shared on the basis of block size. 132 // Note: This is shared on the basis of block size.
134 static const intptr_t kMaxGlobalEmpty = 100; 133 static const intptr_t kMaxGlobalEmpty = 100;
135 static List* global_empty_; 134 static List* global_empty_;
136 static Mutex* global_mutex_; 135 static Mutex* global_mutex_;
137 136
138 private: 137 private:
139 DISALLOW_COPY_AND_ASSIGN(BlockStack); 138 DISALLOW_COPY_AND_ASSIGN(BlockStack);
140 }; 139 };
141 140
142
143 static const int kStoreBufferBlockSize = 1024; 141 static const int kStoreBufferBlockSize = 1024;
144 class StoreBuffer : public BlockStack<kStoreBufferBlockSize> { 142 class StoreBuffer : public BlockStack<kStoreBufferBlockSize> {
145 public: 143 public:
146 // Interrupt when crossing this threshold of non-empty blocks in the buffer. 144 // Interrupt when crossing this threshold of non-empty blocks in the buffer.
147 static const intptr_t kMaxNonEmpty = 100; 145 static const intptr_t kMaxNonEmpty = 100;
148 146
149 enum ThresholdPolicy { kCheckThreshold, kIgnoreThreshold }; 147 enum ThresholdPolicy { kCheckThreshold, kIgnoreThreshold };
150 148
151 // Adds and transfers ownership of the block to the buffer. Optionally 149 // Adds and transfers ownership of the block to the buffer. Optionally
152 // checks the number of non-empty blocks for overflow, and schedules an 150 // checks the number of non-empty blocks for overflow, and schedules an
153 // interrupt on the current isolate if so. 151 // interrupt on the current isolate if so.
154 void PushBlock(Block* block, ThresholdPolicy policy); 152 void PushBlock(Block* block, ThresholdPolicy policy);
155 153
156 // Check whether non-empty blocks have exceeded kMaxNonEmpty (but takes no 154 // Check whether non-empty blocks have exceeded kMaxNonEmpty (but takes no
157 // action). 155 // action).
158 bool Overflowed(); 156 bool Overflowed();
159 }; 157 };
160 158
161
162 typedef StoreBuffer::Block StoreBufferBlock; 159 typedef StoreBuffer::Block StoreBufferBlock;
163 160
164
165 static const int kMarkingStackBlockSize = 64; 161 static const int kMarkingStackBlockSize = 64;
166 class MarkingStack : public BlockStack<kMarkingStackBlockSize> { 162 class MarkingStack : public BlockStack<kMarkingStackBlockSize> {
167 public: 163 public:
168 // Adds and transfers ownership of the block to the buffer. 164 // Adds and transfers ownership of the block to the buffer.
169 void PushBlock(Block* block) { 165 void PushBlock(Block* block) {
170 BlockStack<Block::kSize>::PushBlockImpl(block); 166 BlockStack<Block::kSize>::PushBlockImpl(block);
171 } 167 }
172 }; 168 };
173 169
174
175 } // namespace dart 170 } // namespace dart
176 171
177 #endif // RUNTIME_VM_STORE_BUFFER_H_ 172 #endif // RUNTIME_VM_STORE_BUFFER_H_
OLDNEW
« no previous file with comments | « runtime/vm/stack_trace.cc ('k') | runtime/vm/store_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698