| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } else { | 442 } else { |
| 443 return old_size_in_words; | 443 return old_size_in_words; |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 | 446 |
| 447 | 447 |
| 448 SemiSpace* Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) { | 448 SemiSpace* Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) { |
| 449 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { | 449 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { |
| 450 (isolate->gc_prologue_callback())(); | 450 (isolate->gc_prologue_callback())(); |
| 451 } | 451 } |
| 452 Thread::PrepareForGC(); | 452 isolate->thread_registry()->PrepareForGC(); |
| 453 // Flip the two semi-spaces so that to_ is always the space for allocating | 453 // Flip the two semi-spaces so that to_ is always the space for allocating |
| 454 // objects. | 454 // objects. |
| 455 SemiSpace* from = to_; | 455 SemiSpace* from = to_; |
| 456 to_ = SemiSpace::New(NewSizeInWords(from->size_in_words())); | 456 to_ = SemiSpace::New(NewSizeInWords(from->size_in_words())); |
| 457 if (to_ == NULL) { | 457 if (to_ == NULL) { |
| 458 // TODO(koda): We could try to recover (collect old space, wait for another | 458 // TODO(koda): We could try to recover (collect old space, wait for another |
| 459 // isolate to finish scavenge, etc.). | 459 // isolate to finish scavenge, etc.). |
| 460 FATAL("Out of memory.\n"); | 460 FATAL("Out of memory.\n"); |
| 461 } | 461 } |
| 462 UpdateMaxHeapCapacity(); | 462 UpdateMaxHeapCapacity(); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 } | 866 } |
| 867 | 867 |
| 868 | 868 |
| 869 void Scavenger::FreeExternal(intptr_t size) { | 869 void Scavenger::FreeExternal(intptr_t size) { |
| 870 ASSERT(size >= 0); | 870 ASSERT(size >= 0); |
| 871 external_size_ -= size; | 871 external_size_ -= size; |
| 872 ASSERT(external_size_ >= 0); | 872 ASSERT(external_size_ >= 0); |
| 873 } | 873 } |
| 874 | 874 |
| 875 } // namespace dart | 875 } // namespace dart |
| OLD | NEW |