| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Thread* thread = Thread::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(thread->isolate()->mutator_thread() == thread); | |
| 108 ASSERT(thread->isolate()->store_buffer() == this); | 107 ASSERT(thread->isolate()->store_buffer() == this); |
| 109 thread->ScheduleInterrupts(Thread::kVMInterrupt); | 108 thread->ScheduleInterrupts(Thread::kVMInterrupt); |
| 110 } | 109 } |
| 111 } | 110 } |
| 112 | 111 |
| 113 | 112 |
| 114 template<int BlockSize> | 113 template<int BlockSize> |
| 115 typename BlockStack<BlockSize>::Block* | 114 typename BlockStack<BlockSize>::Block* |
| 116 BlockStack<BlockSize>::PopNonFullBlock() { | 115 BlockStack<BlockSize>::PopNonFullBlock() { |
| 117 { | 116 { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 while (global_empty_->length() > kMaxGlobalEmpty) { | 204 while (global_empty_->length() > kMaxGlobalEmpty) { |
| 206 delete global_empty_->Pop(); | 205 delete global_empty_->Pop(); |
| 207 } | 206 } |
| 208 } | 207 } |
| 209 | 208 |
| 210 | 209 |
| 211 template class BlockStack<kStoreBufferBlockSize>; | 210 template class BlockStack<kStoreBufferBlockSize>; |
| 212 template class BlockStack<kMarkingStackBlockSize>; | 211 template class BlockStack<kMarkingStackBlockSize>; |
| 213 | 212 |
| 214 } // namespace dart | 213 } // namespace dart |
| OLD | NEW |