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 #include "vm/store_buffer.h" | 5 #include "vm/store_buffer.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/lockers.h" | 8 #include "vm/lockers.h" |
9 #include "vm/runtime_entry.h" | 9 #include "vm/runtime_entry.h" |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 MutexLocker ml(mutex_); | 93 MutexLocker ml(mutex_); |
94 partial_.Push(block); | 94 partial_.Push(block); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 | 98 |
99 void StoreBuffer::PushBlock(Block* block, ThresholdPolicy policy) { | 99 void StoreBuffer::PushBlock(Block* block, ThresholdPolicy policy) { |
100 BlockStack<Block::kSize>::PushBlockImpl(block); | 100 BlockStack<Block::kSize>::PushBlockImpl(block); |
101 if ((policy == kCheckThreshold) && Overflowed()) { | 101 if ((policy == kCheckThreshold) && Overflowed()) { |
102 MutexLocker ml(mutex_); | 102 MutexLocker ml(mutex_); |
103 Isolate* isolate = Isolate::Current(); | 103 Thread* thread = Thread::Current(); |
104 // Sanity check: it makes no sense to schedule the GC in another isolate. | 104 // Sanity check: it makes no sense to schedule the GC in another isolate. |
105 // (If Isolate ever gets multiple store buffers, we should avoid this | 105 // (If Isolate ever gets multiple store buffers, we should avoid this |
106 // coupling by passing in an explicit callback+parameter at construction.) | 106 // coupling by passing in an explicit callback+parameter at construction.) |
107 ASSERT(isolate->store_buffer() == this); | 107 ASSERT(thread->isolate()->mutator_thread() == thread); |
108 isolate->ScheduleInterrupts(Isolate::kVMInterrupt); | 108 ASSERT(thread->isolate()->store_buffer() == this); |
| 109 thread->ScheduleInterrupts(Thread::kVMInterrupt); |
109 } | 110 } |
110 } | 111 } |
111 | 112 |
112 | 113 |
113 template<int BlockSize> | 114 template<int BlockSize> |
114 typename BlockStack<BlockSize>::Block* | 115 typename BlockStack<BlockSize>::Block* |
115 BlockStack<BlockSize>::PopNonFullBlock() { | 116 BlockStack<BlockSize>::PopNonFullBlock() { |
116 { | 117 { |
117 MutexLocker ml(mutex_); | 118 MutexLocker ml(mutex_); |
118 if (!partial_.IsEmpty()) { | 119 if (!partial_.IsEmpty()) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 while (global_empty_->length() > kMaxGlobalEmpty) { | 205 while (global_empty_->length() > kMaxGlobalEmpty) { |
205 delete global_empty_->Pop(); | 206 delete global_empty_->Pop(); |
206 } | 207 } |
207 } | 208 } |
208 | 209 |
209 | 210 |
210 template class BlockStack<kStoreBufferBlockSize>; | 211 template class BlockStack<kStoreBufferBlockSize>; |
211 template class BlockStack<kMarkingStackBlockSize>; | 212 template class BlockStack<kMarkingStackBlockSize>; |
212 | 213 |
213 } // namespace dart | 214 } // namespace dart |
OLD | NEW |