| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return page; | 168 return page; |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 HeapPage* PageSpace::AllocateLargePage(intptr_t size, HeapPage::PageType type) { | 172 HeapPage* PageSpace::AllocateLargePage(intptr_t size, HeapPage::PageType type) { |
| 173 intptr_t page_size_in_words = LargePageSizeInWordsFor(size); | 173 intptr_t page_size_in_words = LargePageSizeInWordsFor(size); |
| 174 HeapPage* page = HeapPage::Allocate(page_size_in_words, type); | 174 HeapPage* page = HeapPage::Allocate(page_size_in_words, type); |
| 175 page->set_next(large_pages_); | 175 page->set_next(large_pages_); |
| 176 large_pages_ = page; | 176 large_pages_ = page; |
| 177 usage_.capacity_in_words += page_size_in_words; | 177 usage_.capacity_in_words += page_size_in_words; |
| 178 // Only one object in this page. | 178 // Only one object in this page (at least until String::MakeExternal or |
| 179 // Array::MakeArray is called). |
| 179 page->set_object_end(page->object_start() + size); | 180 page->set_object_end(page->object_start() + size); |
| 180 return page; | 181 return page; |
| 181 } | 182 } |
| 182 | 183 |
| 183 | 184 |
| 184 void PageSpace::FreePage(HeapPage* page, HeapPage* previous_page) { | 185 void PageSpace::FreePage(HeapPage* page, HeapPage* previous_page) { |
| 185 usage_.capacity_in_words -= (page->memory_->size() >> kWordSizeLog2); | 186 usage_.capacity_in_words -= (page->memory_->size() >> kWordSizeLog2); |
| 186 // Remove the page from the list. | 187 // Remove the page from the list. |
| 187 if (previous_page != NULL) { | 188 if (previous_page != NULL) { |
| 188 previous_page->set_next(page->next()); | 189 previous_page->set_next(page->next()); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 return 0; | 682 return 0; |
| 682 } else { | 683 } else { |
| 683 ASSERT(total_time >= gc_time); | 684 ASSERT(total_time >= gc_time); |
| 684 int result= static_cast<int>((static_cast<double>(gc_time) / | 685 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 685 static_cast<double>(total_time)) * 100); | 686 static_cast<double>(total_time)) * 100); |
| 686 return result; | 687 return result; |
| 687 } | 688 } |
| 688 } | 689 } |
| 689 | 690 |
| 690 } // namespace dart | 691 } // namespace dart |
| OLD | NEW |