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

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

Issue 197963002: Remove the ability to allow multiple gc prologue and gc epilogue callbacks (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 371
372 Scavenger::~Scavenger() { 372 Scavenger::~Scavenger() {
373 delete to_; 373 delete to_;
374 delete from_; 374 delete from_;
375 delete space_; 375 delete space_;
376 } 376 }
377 377
378 378
379 void Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) { 379 void Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) {
380 if (invoke_api_callbacks) { 380 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) {
381 isolate->gc_prologue_callbacks().Invoke(); 381 (isolate->gc_prologue_callback())();
382 } 382 }
383 // Flip the two semi-spaces so that to_ is always the space for allocating 383 // Flip the two semi-spaces so that to_ is always the space for allocating
384 // objects. 384 // objects.
385 MemoryRegion* temp = from_; 385 MemoryRegion* temp = from_;
386 from_ = to_; 386 from_ = to_;
387 to_ = temp; 387 to_ = temp;
388 top_ = FirstObjectStart(); 388 top_ = FirstObjectStart();
389 resolved_top_ = top_; 389 resolved_top_ = top_;
390 end_ = to_->end(); 390 end_ = to_->end();
391 } 391 }
(...skipping 15 matching lines...) Expand all
407 // objects candidates for promotion. 407 // objects candidates for promotion.
408 survivor_end_ = end_; 408 survivor_end_ = end_;
409 } 409 }
410 410
411 #if defined(DEBUG) 411 #if defined(DEBUG)
412 VerifyStoreBufferPointerVisitor verify_store_buffer_visitor(isolate, to_); 412 VerifyStoreBufferPointerVisitor verify_store_buffer_visitor(isolate, to_);
413 heap_->IterateOldPointers(&verify_store_buffer_visitor); 413 heap_->IterateOldPointers(&verify_store_buffer_visitor);
414 414
415 memset(from_->pointer(), 0xf3, from_->size()); 415 memset(from_->pointer(), 0xf3, from_->size());
416 #endif // defined(DEBUG) 416 #endif // defined(DEBUG)
417 if (invoke_api_callbacks) { 417 if (invoke_api_callbacks && (isolate->gc_epilogue_callback() != NULL)) {
418 isolate->gc_epilogue_callbacks().Invoke(); 418 (isolate->gc_epilogue_callback())();
419 } 419 }
420 } 420 }
421 421
422 422
423 void Scavenger::IterateStoreBuffers(Isolate* isolate, 423 void Scavenger::IterateStoreBuffers(Isolate* isolate,
424 ScavengerVisitor* visitor) { 424 ScavengerVisitor* visitor) {
425 StoreBuffer* buffer = isolate->store_buffer(); 425 StoreBuffer* buffer = isolate->store_buffer();
426 heap_->RecordData(kStoreBufferEntries, buffer->Count()); 426 heap_->RecordData(kStoreBufferEntries, buffer->Count());
427 427
428 // Iterating through the store buffers. 428 // Iterating through the store buffers.
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 761
762 762
763 void Scavenger::FreeExternal(intptr_t size) { 763 void Scavenger::FreeExternal(intptr_t size) {
764 ASSERT(size >= 0); 764 ASSERT(size >= 0);
765 external_size_ -= size; 765 external_size_ -= size;
766 ASSERT(external_size_ >= 0); 766 ASSERT(external_size_ >= 0);
767 end_ = Utils::Minimum(to_->end(), end_ + size); 767 end_ = Utils::Minimum(to_->end(), end_ + size);
768 } 768 }
769 769
770 } // namespace dart 770 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698