| 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/gc_marker.h" | 9 #include "vm/gc_marker.h" |
| 9 #include "vm/gc_sweeper.h" | 10 #include "vm/gc_sweeper.h" |
| 10 #include "vm/object.h" | 11 #include "vm/object.h" |
| 11 #include "vm/virtual_memory.h" | 12 #include "vm/virtual_memory.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 DEFINE_FLAG(int, heap_growth_space_ratio, 10, | 16 DEFINE_FLAG(int, heap_growth_space_ratio, 10, |
| 16 "The desired maximum percentage of free space after GC"); | 17 "The desired maximum percentage of free space after GC"); |
| 17 DEFINE_FLAG(int, heap_growth_time_ratio, 3, | 18 DEFINE_FLAG(int, heap_growth_time_ratio, 3, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 231 } |
| 231 if (CanIncreaseCapacity(page_size)) { | 232 if (CanIncreaseCapacity(page_size)) { |
| 232 HeapPage* page = AllocateLargePage(size, type); | 233 HeapPage* page = AllocateLargePage(size, type); |
| 233 if (page != NULL) { | 234 if (page != NULL) { |
| 234 result = page->object_start(); | 235 result = page->object_start(); |
| 235 } | 236 } |
| 236 } | 237 } |
| 237 } | 238 } |
| 238 if (result != 0) { | 239 if (result != 0) { |
| 239 in_use_ += size; | 240 in_use_ += size; |
| 241 if (FLAG_compiler_stats && (type == HeapPage::kExecutable)) { |
| 242 CompilerStats::code_allocated += size; |
| 243 } |
| 240 } | 244 } |
| 241 ASSERT((result & kObjectAlignmentMask) == kOldObjectAlignmentOffset); | 245 ASSERT((result & kObjectAlignmentMask) == kOldObjectAlignmentOffset); |
| 242 return result; | 246 return result; |
| 243 } | 247 } |
| 244 | 248 |
| 245 | 249 |
| 246 bool PageSpace::Contains(uword addr) const { | 250 bool PageSpace::Contains(uword addr) const { |
| 247 HeapPage* page = pages_; | 251 HeapPage* page = pages_; |
| 248 while (page != NULL) { | 252 while (page != NULL) { |
| 249 if (page->Contains(addr)) { | 253 if (page->Contains(addr)) { |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 return 0; | 623 return 0; |
| 620 } else { | 624 } else { |
| 621 ASSERT(total_time >= gc_time); | 625 ASSERT(total_time >= gc_time); |
| 622 int result= static_cast<int>((static_cast<double>(gc_time) / | 626 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 623 static_cast<double>(total_time)) * 100); | 627 static_cast<double>(total_time)) * 100); |
| 624 return result; | 628 return result; |
| 625 } | 629 } |
| 626 } | 630 } |
| 627 | 631 |
| 628 } // namespace dart | 632 } // namespace dart |
| OLD | NEW |