| 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 | 9 |
| 9 namespace dart { | 10 namespace dart { |
| 10 | 11 |
| 12 DEFINE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate) { |
| 13 isolate->store_buffer_block()->ProcessBuffer(isolate); |
| 14 } |
| 15 END_LEAF_RUNTIME_ENTRY |
| 16 |
| 17 |
| 11 void StoreBufferBlock::ProcessBuffer() { | 18 void StoreBufferBlock::ProcessBuffer() { |
| 12 // TODO(iposva): Do the right thing for store buffer overflow. | 19 ProcessBuffer(Isolate::Current()); |
| 13 top_ = 0; // Currently just reset back to the beginning. | 20 } |
| 21 |
| 22 |
| 23 void StoreBufferBlock::ProcessBuffer(Isolate* isolate) { |
| 24 StoreBuffer* buffer = isolate->store_buffer(); |
| 25 int32_t end = top_; |
| 26 for (int32_t i = 0; i < end; i++) { |
| 27 buffer->AddPointer(pointers_[i]); |
| 28 } |
| 29 top_ = 0; // Reset back to the beginning. |
| 14 } | 30 } |
| 15 | 31 |
| 16 | 32 |
| 17 bool StoreBufferBlock::Contains(uword pointer) { | 33 bool StoreBufferBlock::Contains(uword pointer) { |
| 18 for (int32_t i = 0; i < top_; i++) { | 34 for (int32_t i = 0; i < top_; i++) { |
| 19 if (pointers_[i] == pointer) { | 35 if (pointers_[i] == pointer) { |
| 20 return true; | 36 return true; |
| 21 } | 37 } |
| 22 } | 38 } |
| 23 return false; | 39 return false; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 delete dedup_sets_; | 59 delete dedup_sets_; |
| 44 dedup_sets_ = NULL; | 60 dedup_sets_ = NULL; |
| 45 | 61 |
| 46 DedupSet* fresh_element = new DedupSet(); | 62 DedupSet* fresh_element = new DedupSet(); |
| 47 fresh_element->next_ = dedup_sets_; | 63 fresh_element->next_ = dedup_sets_; |
| 48 dedup_sets_ = fresh_element; | 64 dedup_sets_ = fresh_element; |
| 49 } | 65 } |
| 50 } | 66 } |
| 51 | 67 |
| 52 } // namespace dart | 68 } // namespace dart |
| OLD | NEW |