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 26 matching lines...) Expand all Loading... | |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 StoreBuffer::~StoreBuffer() { | 43 StoreBuffer::~StoreBuffer() { |
| 44 DedupSet* current = dedup_sets_; | 44 DedupSet* current = dedup_sets_; |
| 45 dedup_sets_ = NULL; | 45 dedup_sets_ = NULL; |
| 46 while (current != NULL) { | 46 while (current != NULL) { |
| 47 DedupSet* next = current->next_; | 47 DedupSet* next = current->next(); |
| 48 delete current; | 48 delete current; |
| 49 current = next; | 49 current = next; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 | 53 |
| 54 void StoreBuffer::AddPointer(uword address) { | 54 void StoreBuffer::AddPointer(uword address) { |
| 55 ASSERT(dedup_sets_ != NULL); | 55 ASSERT(dedup_sets_ != NULL); |
| 56 if (!dedup_sets_->set_->Add(address)) { | 56 if (!dedup_sets_->set()->Add(address)) { |
| 57 // TODO(iposva): Limit growth of deduplication sets until the rest of the | 57 // Add a new DedupSet. Schedule an interrupt if we have run over the max |
| 58 // mechanism is hooked up. | 58 // number of DedupSets. |
| 59 delete dedup_sets_; | 59 dedup_sets_ = new DedupSet(dedup_sets_); |
| 60 dedup_sets_ = NULL; | 60 count_++; |
| 61 | 61 // TODO(iposva): Fix magic number. |
| 62 DedupSet* fresh_element = new DedupSet(); | 62 if (count_ > 100) { |
| 63 fresh_element->next_ = dedup_sets_; | 63 Isolate::Current()->ScheduleInterrupts(Isolate::kStoreBufferInterrupt); |
| 64 dedup_sets_ = fresh_element; | 64 } |
|
siva
2012/07/19 17:36:06
If we overflow again before the interrupt actually
Ivan Posva
2012/07/20 15:37:46
You can schedule an interrupt as many times as you
| |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace dart | 68 } // namespace dart |
| OLD | NEW |