OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/scavenger.h" | 5 #include "vm/scavenger.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 // Iterating through the store buffers. | 519 // Iterating through the store buffers. |
520 // Grab the deduplication sets out of the isolate's consolidated store buffer. | 520 // Grab the deduplication sets out of the isolate's consolidated store buffer. |
521 StoreBufferBlock* pending = isolate->store_buffer()->Blocks(); | 521 StoreBufferBlock* pending = isolate->store_buffer()->Blocks(); |
522 intptr_t total_count = 0; | 522 intptr_t total_count = 0; |
523 while (pending != NULL) { | 523 while (pending != NULL) { |
524 StoreBufferBlock* next = pending->next(); | 524 StoreBufferBlock* next = pending->next(); |
525 // Generated code appends to store buffers; tell MemorySanitizer. | 525 // Generated code appends to store buffers; tell MemorySanitizer. |
526 MSAN_UNPOISON(pending, sizeof(*pending)); | 526 MSAN_UNPOISON(pending, sizeof(*pending)); |
527 intptr_t count = pending->Count(); | 527 intptr_t count = pending->Count(); |
528 total_count += count; | 528 total_count += count; |
529 for (intptr_t i = 0; i < count; i++) { | 529 while (!pending->IsEmpty()) { |
530 RawObject* raw_object = pending->At(i); | 530 RawObject* raw_object = pending->Pop(); |
531 ASSERT(raw_object->IsRemembered()); | 531 ASSERT(raw_object->IsRemembered()); |
532 raw_object->ClearRememberedBit(); | 532 raw_object->ClearRememberedBit(); |
533 visitor->VisitingOldObject(raw_object); | 533 visitor->VisitingOldObject(raw_object); |
534 raw_object->VisitPointers(visitor); | 534 raw_object->VisitPointers(visitor); |
535 } | 535 } |
536 delete pending; | 536 pending->Reset(); |
| 537 isolate->store_buffer()->PushBlock(pending); |
537 pending = next; | 538 pending = next; |
538 } | 539 } |
539 heap_->RecordData(kStoreBufferEntries, total_count); | 540 heap_->RecordData(kStoreBufferEntries, total_count); |
540 heap_->RecordData(kDataUnused1, 0); | 541 heap_->RecordData(kDataUnused1, 0); |
541 heap_->RecordData(kDataUnused2, 0); | 542 heap_->RecordData(kDataUnused2, 0); |
542 // Done iterating through old objects remembered in the store buffers. | 543 // Done iterating through old objects remembered in the store buffers. |
543 visitor->VisitingOldObject(NULL); | 544 visitor->VisitingOldObject(NULL); |
544 } | 545 } |
545 | 546 |
546 | 547 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 } | 903 } |
903 | 904 |
904 | 905 |
905 void Scavenger::FreeExternal(intptr_t size) { | 906 void Scavenger::FreeExternal(intptr_t size) { |
906 ASSERT(size >= 0); | 907 ASSERT(size >= 0); |
907 external_size_ -= size; | 908 external_size_ -= size; |
908 ASSERT(external_size_ >= 0); | 909 ASSERT(external_size_ >= 0); |
909 } | 910 } |
910 | 911 |
911 } // namespace dart | 912 } // namespace dart |
OLD | NEW |