| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 | 127 |
| 128 PageSpace::~PageSpace() { | 128 PageSpace::~PageSpace() { |
| 129 FreePages(pages_); | 129 FreePages(pages_); |
| 130 FreePages(large_pages_); | 130 FreePages(large_pages_); |
| 131 } | 131 } |
| 132 | 132 |
| 133 | 133 |
| 134 intptr_t PageSpace::LargePageSizeFor(intptr_t size) { | 134 intptr_t PageSpace::LargePageSizeFor(intptr_t size) { |
| 135 intptr_t page_size = Utils::RoundUp(size + sizeof(HeapPage), | 135 intptr_t page_size = Utils::RoundUp(size + HeapPage::ObjectStartOffset(), |
| 136 VirtualMemory::PageSize()); | 136 VirtualMemory::PageSize()); |
| 137 return page_size; | 137 return page_size; |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) { | 141 HeapPage* PageSpace::AllocatePage(HeapPage::PageType type) { |
| 142 HeapPage* page = HeapPage::Allocate(kPageSize, type); | 142 HeapPage* page = HeapPage::Allocate(kPageSize, type); |
| 143 if (pages_ == NULL) { | 143 if (pages_ == NULL) { |
| 144 pages_ = page; | 144 pages_ = page; |
| 145 } else { | 145 } else { |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 return 0; | 617 return 0; |
| 618 } else { | 618 } else { |
| 619 ASSERT(total_time >= gc_time); | 619 ASSERT(total_time >= gc_time); |
| 620 int result= static_cast<int>((static_cast<double>(gc_time) / | 620 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 621 static_cast<double>(total_time)) * 100); | 621 static_cast<double>(total_time)) * 100); |
| 622 return result; | 622 return result; |
| 623 } | 623 } |
| 624 } | 624 } |
| 625 | 625 |
| 626 } // namespace dart | 626 } // namespace dart |
| OLD | NEW |