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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void PageSpace::TruncateLargePage(HeapPage* page, | 220 void PageSpace::TruncateLargePage(HeapPage* page, |
221 intptr_t new_object_size_in_bytes) { | 221 intptr_t new_object_size_in_bytes) { |
222 const intptr_t old_object_size_in_bytes = | 222 const intptr_t old_object_size_in_bytes = |
223 page->object_end() - page->object_start(); | 223 page->object_end() - page->object_start(); |
224 ASSERT(new_object_size_in_bytes <= old_object_size_in_bytes); | 224 ASSERT(new_object_size_in_bytes <= old_object_size_in_bytes); |
225 const intptr_t new_page_size_in_words = | 225 const intptr_t new_page_size_in_words = |
226 LargePageSizeInWordsFor(new_object_size_in_bytes); | 226 LargePageSizeInWordsFor(new_object_size_in_bytes); |
227 VirtualMemory* memory = page->memory_; | 227 VirtualMemory* memory = page->memory_; |
228 const intptr_t old_page_size_in_words = (memory->size() >> kWordSizeLog2); | 228 const intptr_t old_page_size_in_words = (memory->size() >> kWordSizeLog2); |
229 if (new_page_size_in_words < old_page_size_in_words) { | 229 if (new_page_size_in_words < old_page_size_in_words) { |
230 memory->Truncate(memory->start(), new_page_size_in_words << kWordSizeLog2); | 230 memory->Truncate(new_page_size_in_words << kWordSizeLog2); |
231 usage_.capacity_in_words -= old_page_size_in_words; | 231 usage_.capacity_in_words -= old_page_size_in_words; |
232 usage_.capacity_in_words += new_page_size_in_words; | 232 usage_.capacity_in_words += new_page_size_in_words; |
233 page->set_object_end(page->object_start() + new_object_size_in_bytes); | 233 page->set_object_end(page->object_start() + new_object_size_in_bytes); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 | 237 |
238 void PageSpace::FreePage(HeapPage* page, HeapPage* previous_page) { | 238 void PageSpace::FreePage(HeapPage* page, HeapPage* previous_page) { |
239 bool is_exec = (page->type() == HeapPage::kExecutable); | 239 bool is_exec = (page->type() == HeapPage::kExecutable); |
240 { | 240 { |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 return 0; | 996 return 0; |
997 } else { | 997 } else { |
998 ASSERT(total_time >= gc_time); | 998 ASSERT(total_time >= gc_time); |
999 int result= static_cast<int>((static_cast<double>(gc_time) / | 999 int result= static_cast<int>((static_cast<double>(gc_time) / |
1000 static_cast<double>(total_time)) * 100); | 1000 static_cast<double>(total_time)) * 100); |
1001 return result; | 1001 return result; |
1002 } | 1002 } |
1003 } | 1003 } |
1004 | 1004 |
1005 } // namespace dart | 1005 } // namespace dart |
OLD | NEW |