Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: runtime/vm/scavenger.cc

Issue 14348026: Drain StoreBufferBlock into store buffer instead of iterating over it directly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: do not reset block inside ProcessBlock Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/store_buffer.h » ('j') | runtime/vm/store_buffer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 memset(from_->pointer(), 0xf3, from_->size()); 384 memset(from_->pointer(), 0xf3, from_->size());
385 #endif // defined(DEBUG) 385 #endif // defined(DEBUG)
386 if (invoke_api_callbacks) { 386 if (invoke_api_callbacks) {
387 isolate->gc_epilogue_callbacks().Invoke(); 387 isolate->gc_epilogue_callbacks().Invoke();
388 } 388 }
389 } 389 }
390 390
391 391
392 void Scavenger::IterateStoreBuffers(Isolate* isolate, 392 void Scavenger::IterateStoreBuffers(Isolate* isolate,
393 ScavengerVisitor* visitor) { 393 ScavengerVisitor* visitor) {
394 // Drain store buffer block into store buffer to deduplicate it. It might be
395 // full of large objects repeated multiple times.
396 StoreBufferBlock* block = isolate->store_buffer_block();
397 isolate->store_buffer()->ProcessBlock(block);
siva 2013/04/19 18:27:41 Why is it not ok to just call block->ProcessBuffer
Vyacheslav Egorov (Google) 2013/04/19 19:40:20 ProcessBuffer would use normal AddPointer and thus
398 heap_->RecordData(kStoreBufferBlockEntries, block->Count());
399 block->Reset();
siva 2013/04/19 18:27:41 This reset would not be needed if you did a block-
Vyacheslav Egorov (Google) 2013/04/19 19:40:20 Done.
400
394 // Iterating through the store buffers. 401 // Iterating through the store buffers.
395 // Grab the deduplication sets out of the store buffer. 402 // Grab the deduplication sets out of the store buffer.
396 StoreBuffer::DedupSet* pending = isolate->store_buffer()->DedupSets(); 403 StoreBuffer::DedupSet* pending = isolate->store_buffer()->DedupSets();
397 intptr_t entries = 0; 404 intptr_t entries = 0;
398 while (pending != NULL) { 405 while (pending != NULL) {
399 StoreBuffer::DedupSet* next = pending->next(); 406 StoreBuffer::DedupSet* next = pending->next();
400 HashSet* set = pending->set(); 407 HashSet* set = pending->set();
401 intptr_t count = set->Count(); 408 intptr_t count = set->Count();
402 intptr_t size = set->Size(); 409 intptr_t size = set->Size();
403 intptr_t handled = 0; 410 intptr_t handled = 0;
404 entries += count; 411 entries += count;
405 for (intptr_t i = 0; i < size; i++) { 412 for (intptr_t i = 0; i < size; i++) {
406 RawObject* raw_object = reinterpret_cast<RawObject*>(set->At(i)); 413 RawObject* raw_object = reinterpret_cast<RawObject*>(set->At(i));
407 if (raw_object != NULL) { 414 if (raw_object != NULL) {
408 visitor->VisitingOldObject(raw_object); 415 visitor->VisitingOldObject(raw_object);
409 raw_object->VisitPointers(visitor); 416 raw_object->VisitPointers(visitor);
410 handled++; 417 handled++;
411 if (handled == count) { 418 if (handled == count) {
412 break; 419 break;
413 } 420 }
414 } 421 }
415 } 422 }
416 delete pending; 423 delete pending;
417 pending = next; 424 pending = next;
418 } 425 }
419 heap_->RecordData(kStoreBufferEntries, entries); 426 heap_->RecordData(kStoreBufferEntries, entries);
420 StoreBufferBlock* block = isolate->store_buffer_block();
421 entries = block->Count();
422 for (intptr_t i = 0; i < entries; i++) {
423 RawObject* raw_object = reinterpret_cast<RawObject*>(block->At(i));
424 ASSERT(raw_object->IsHeapObject());
425 visitor->VisitingOldObject(raw_object);
426 raw_object->VisitPointers(visitor);
427 }
428 block->Reset();
429 heap_->RecordData(kStoreBufferBlockEntries, entries);
430 // Done iterating through old objects remembered in the store buffers. 427 // Done iterating through old objects remembered in the store buffers.
431 visitor->VisitingOldObject(NULL); 428 visitor->VisitingOldObject(NULL);
432 } 429 }
433 430
434 431
435 void Scavenger::IterateRoots(Isolate* isolate, 432 void Scavenger::IterateRoots(Isolate* isolate,
436 ScavengerVisitor* visitor, 433 ScavengerVisitor* visitor,
437 bool visit_prologue_weak_persistent_handles) { 434 bool visit_prologue_weak_persistent_handles) {
438 int64_t start = OS::GetCurrentTimeMicros(); 435 int64_t start = OS::GetCurrentTimeMicros();
439 isolate->VisitObjectPointers(visitor, 436 isolate->VisitObjectPointers(visitor,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 PeerTable::iterator it = peer_table_.find(raw_obj); 694 PeerTable::iterator it = peer_table_.find(raw_obj);
698 return (it == peer_table_.end()) ? NULL : it->second; 695 return (it == peer_table_.end()) ? NULL : it->second;
699 } 696 }
700 697
701 698
702 int64_t Scavenger::PeerCount() const { 699 int64_t Scavenger::PeerCount() const {
703 return static_cast<int64_t>(peer_table_.size()); 700 return static_cast<int64_t>(peer_table_.size());
704 } 701 }
705 702
706 } // namespace dart 703 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/store_buffer.h » ('j') | runtime/vm/store_buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698