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 #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/runtime_entry.h" | 8 #include "vm/runtime_entry.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 void StoreBuffer::Reset() { | 54 void StoreBuffer::Reset() { |
| 55 DedupSet* current = DedupSets(); | 55 DedupSet* current = DedupSets(); |
| 56 while (current != NULL) { | 56 while (current != NULL) { |
| 57 DedupSet* next = current->next(); | 57 DedupSet* next = current->next(); |
| 58 delete current; | 58 delete current; |
| 59 current = next; | 59 current = next; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 bool StoreBuffer::AddPointerInternal(uword address) { | |
| 65 ASSERT(dedup_sets_ != NULL); | |
| 66 ASSERT(Isolate::Current()->heap()->OldContains(address)); | |
| 67 ASSERT((address & kSmiTagMask) != kSmiTag); | |
| 68 if (!dedup_sets_->set()->Add(address)) { | |
| 69 // Add a new DedupSet. | |
| 70 dedup_sets_ = new DedupSet(dedup_sets_); | |
| 71 count_++; | |
| 72 return true; | |
| 73 } | |
| 74 return false; | |
| 75 } | |
| 76 | |
| 77 | |
| 64 void StoreBuffer::AddPointer(uword address) { | 78 void StoreBuffer::AddPointer(uword address) { |
| 65 ASSERT(dedup_sets_ != NULL); | 79 if (AddPointerInternal(address)) { |
| 66 ASSERT(Isolate::Current()->heap()->OldContains(address)); | 80 // Had to create a new DedupSet. Schedule an interrupt if we have run over |
| 67 ASSERT((address & kSmiTagMask) != kSmiTag); | 81 // the max number of DedupSets. |
| 68 if (!dedup_sets_->set()->Add(address)) { | |
| 69 // Add a new DedupSet. Schedule an interrupt if we have run over the max | |
| 70 // number of DedupSets. | |
| 71 dedup_sets_ = new DedupSet(dedup_sets_); | |
| 72 count_++; | |
| 73 // TODO(iposva): Fix magic number. | 82 // TODO(iposva): Fix magic number. |
| 74 if (count_ > 100) { | 83 if (count_ > 100) { |
| 75 Isolate::Current()->ScheduleInterrupts(Isolate::kStoreBufferInterrupt); | 84 Isolate::Current()->ScheduleInterrupts(Isolate::kStoreBufferInterrupt); |
| 76 } | 85 } |
| 77 } | 86 } |
| 78 } | 87 } |
| 79 | 88 |
| 89 | |
| 90 void StoreBuffer::ProcessBlock(StoreBufferBlock* block) { | |
| 91 intptr_t entries = block->Count(); | |
| 92 for (intptr_t i = 0; i < entries; i++) { | |
| 93 AddPointerInternal(block->At(i)); | |
| 94 } | |
| 95 } | |
|
siva
2013/04/19 18:27:41
This function may not be needed if ProcessBuffer w
Vyacheslav Egorov (Google)
2013/04/19 19:40:20
Done.
| |
| 96 | |
| 80 } // namespace dart | 97 } // namespace dart |
| OLD | NEW |