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/address_sanitizer.h" | 7 #include "platform/address_sanitizer.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/compiler_stats.h" | 9 #include "vm/compiler_stats.h" |
10 #include "vm/gc_marker.h" | 10 #include "vm/gc_marker.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 Heap::RegionName(heap_, is_exec ? Heap::kCode : Heap::kOld, vm_name, | 282 Heap::RegionName(heap_, is_exec ? Heap::kCode : Heap::kOld, vm_name, |
283 kVmNameSize); | 283 kVmNameSize); |
284 HeapPage* page = HeapPage::Allocate(page_size_in_words, type, vm_name); | 284 HeapPage* page = HeapPage::Allocate(page_size_in_words, type, vm_name); |
285 if (page == NULL) { | 285 if (page == NULL) { |
286 return NULL; | 286 return NULL; |
287 } | 287 } |
288 page->set_next(large_pages_); | 288 page->set_next(large_pages_); |
289 large_pages_ = page; | 289 large_pages_ = page; |
290 IncreaseCapacityInWords(page_size_in_words); | 290 IncreaseCapacityInWords(page_size_in_words); |
291 // Only one object in this page (at least until String::MakeExternal or | 291 // Only one object in this page (at least until String::MakeExternal or |
292 // Array::MakeFixedLength is called). | 292 // Array::MakeArray is called). |
293 page->set_object_end(page->object_start() + size); | 293 page->set_object_end(page->object_start() + size); |
294 return page; | 294 return page; |
295 } | 295 } |
296 | 296 |
297 | 297 |
298 void PageSpace::TruncateLargePage(HeapPage* page, | 298 void PageSpace::TruncateLargePage(HeapPage* page, |
299 intptr_t new_object_size_in_bytes) { | 299 intptr_t new_object_size_in_bytes) { |
300 const intptr_t old_object_size_in_bytes = | 300 const intptr_t old_object_size_in_bytes = |
301 page->object_end() - page->object_start(); | 301 page->object_end() - page->object_start(); |
302 ASSERT(new_object_size_in_bytes <= old_object_size_in_bytes); | 302 ASSERT(new_object_size_in_bytes <= old_object_size_in_bytes); |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 return 0; | 1319 return 0; |
1320 } else { | 1320 } else { |
1321 ASSERT(total_time >= gc_time); | 1321 ASSERT(total_time >= gc_time); |
1322 int result = static_cast<int>( | 1322 int result = static_cast<int>( |
1323 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); | 1323 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); |
1324 return result; | 1324 return result; |
1325 } | 1325 } |
1326 } | 1326 } |
1327 | 1327 |
1328 } // namespace dart | 1328 } // namespace dart |
OLD | NEW |