Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/pages.h" | 5 #include "vm/pages.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/compiler_stats.h" | 8 #include "vm/compiler_stats.h" |
| 9 #include "vm/gc_marker.h" | 9 #include "vm/gc_marker.h" |
| 10 #include "vm/gc_sweeper.h" | 10 #include "vm/gc_sweeper.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 if ((result == 0) && | 213 if ((result == 0) && |
| 214 (page_space_controller_.CanGrowPageSpace(size) || | 214 (page_space_controller_.CanGrowPageSpace(size) || |
| 215 growth_policy == kForceGrowth) && | 215 growth_policy == kForceGrowth) && |
| 216 CanIncreaseCapacity(kPageSize)) { | 216 CanIncreaseCapacity(kPageSize)) { |
| 217 HeapPage* page = AllocatePage(type); | 217 HeapPage* page = AllocatePage(type); |
| 218 ASSERT(page != NULL); | 218 ASSERT(page != NULL); |
| 219 // Start of the newly allocated page is the allocated object. | 219 // Start of the newly allocated page is the allocated object. |
| 220 result = page->object_start(); | 220 result = page->object_start(); |
| 221 // Enqueue the remainder in the free list. | 221 // Enqueue the remainder in the free list. |
| 222 uword free_start = result + size; | 222 uword free_start = result + size; |
| 223 freelist_[type].Free(free_start, page->object_end() - free_start); | 223 intptr_t free_size = page->object_end() - free_start; |
| 224 if (free_size > 0) freelist_[type].Free(free_start, free_size); | |
|
Ivan Posva
2012/12/13 14:45:20
{} please.
| |
| 224 } | 225 } |
| 225 } else { | 226 } else { |
| 226 // Large page allocation. | 227 // Large page allocation. |
| 227 intptr_t page_size = LargePageSizeFor(size); | 228 intptr_t page_size = LargePageSizeFor(size); |
| 228 if (page_size < size) { | 229 if (page_size < size) { |
| 229 // On overflow we fail to allocate. | 230 // On overflow we fail to allocate. |
| 230 return 0; | 231 return 0; |
| 231 } | 232 } |
| 232 if (CanIncreaseCapacity(page_size)) { | 233 if (CanIncreaseCapacity(page_size)) { |
| 233 HeapPage* page = AllocateLargePage(size, type); | 234 HeapPage* page = AllocateLargePage(size, type); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 return 0; | 624 return 0; |
| 624 } else { | 625 } else { |
| 625 ASSERT(total_time >= gc_time); | 626 ASSERT(total_time >= gc_time); |
| 626 int result= static_cast<int>((static_cast<double>(gc_time) / | 627 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 627 static_cast<double>(total_time)) * 100); | 628 static_cast<double>(total_time)) * 100); |
| 628 return result; | 629 return result; |
| 629 } | 630 } |
| 630 } | 631 } |
| 631 | 632 |
| 632 } // namespace dart | 633 } // namespace dart |
| OLD | NEW |