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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } else { | 360 } else { |
361 intptr_t size_in_bytes = size_in_words << kWordSizeLog2; | 361 intptr_t size_in_bytes = size_in_words << kWordSizeLog2; |
362 VirtualMemory* reserved = VerifiedMemory::Reserve(size_in_bytes); | 362 VirtualMemory* reserved = VerifiedMemory::Reserve(size_in_bytes); |
363 if ((reserved == NULL) || !reserved->Commit(false)) { // Not executable. | 363 if ((reserved == NULL) || !reserved->Commit(false)) { // Not executable. |
364 // TODO(koda): If cache_ is not empty, we could try to delete it. | 364 // TODO(koda): If cache_ is not empty, we could try to delete it. |
365 delete reserved; | 365 delete reserved; |
366 return NULL; | 366 return NULL; |
367 } | 367 } |
368 #if defined(DEBUG) | 368 #if defined(DEBUG) |
369 memset(reserved->address(), kZapValue, size_in_bytes); | 369 memset(reserved->address(), kZapValue, size_in_bytes); |
| 370 VerifiedMemory::Accept(reserved->start(), size_in_bytes); |
370 #endif // defined(DEBUG) | 371 #endif // defined(DEBUG) |
371 return new SemiSpace(reserved); | 372 return new SemiSpace(reserved); |
372 } | 373 } |
373 } | 374 } |
374 | 375 |
375 | 376 |
376 void SemiSpace::Delete() { | 377 void SemiSpace::Delete() { |
377 #ifdef DEBUG | 378 #ifdef DEBUG |
378 if (reserved_ != NULL) { | 379 if (reserved_ != NULL) { |
379 memset(reserved_->address(), kZapValue, size_in_words() << kWordSizeLog2); | 380 memset(reserved_->address(), kZapValue, size_in_words() << kWordSizeLog2); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 } | 894 } |
894 | 895 |
895 | 896 |
896 void Scavenger::FreeExternal(intptr_t size) { | 897 void Scavenger::FreeExternal(intptr_t size) { |
897 ASSERT(size >= 0); | 898 ASSERT(size >= 0); |
898 external_size_ -= size; | 899 external_size_ -= size; |
899 ASSERT(external_size_ >= 0); | 900 ASSERT(external_size_ >= 0); |
900 } | 901 } |
901 | 902 |
902 } // namespace dart | 903 } // namespace dart |
OLD | NEW |