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/class_table.h" | 5 #include "vm/class_table.h" |
6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
7 #include "vm/freelist.h" | 7 #include "vm/freelist.h" |
8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 void ClassTable::FreeOldTables() { | 78 void ClassTable::FreeOldTables() { |
79 while (old_tables_->length() > 0) { | 79 while (old_tables_->length() > 0) { |
80 free(old_tables_->RemoveLast()); | 80 free(old_tables_->RemoveLast()); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 | 84 |
| 85 void ClassTable::TraceAllocationsFor(intptr_t cid, bool trace) { |
| 86 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
| 87 stats->set_trace_allocation(trace); |
| 88 } |
| 89 |
| 90 |
85 void ClassTable::Register(const Class& cls) { | 91 void ClassTable::Register(const Class& cls) { |
86 intptr_t index = cls.id(); | 92 intptr_t index = cls.id(); |
87 if (index != kIllegalCid) { | 93 if (index != kIllegalCid) { |
88 ASSERT(index > 0); | 94 ASSERT(index > 0); |
89 ASSERT(index < kNumPredefinedCids); | 95 ASSERT(index < kNumPredefinedCids); |
90 ASSERT(table_[index] == 0); | 96 ASSERT(table_[index] == 0); |
91 ASSERT(index < capacity_); | 97 ASSERT(index < capacity_); |
92 table_[index] = cls.raw(); | 98 table_[index] = cls.raw(); |
93 // Add the vtable for this predefined class into the static vtable registry | 99 // Add the vtable for this predefined class into the static vtable registry |
94 // if it has not been setup yet. | 100 // if it has not been setup yet. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 232 |
227 | 233 |
228 void ClassHeapStats::Initialize() { | 234 void ClassHeapStats::Initialize() { |
229 pre_gc.Reset(); | 235 pre_gc.Reset(); |
230 post_gc.Reset(); | 236 post_gc.Reset(); |
231 recent.Reset(); | 237 recent.Reset(); |
232 accumulated.Reset(); | 238 accumulated.Reset(); |
233 last_reset.Reset(); | 239 last_reset.Reset(); |
234 promoted_count = 0; | 240 promoted_count = 0; |
235 promoted_size = 0; | 241 promoted_size = 0; |
| 242 state_ = 0; |
236 } | 243 } |
237 | 244 |
238 | 245 |
239 void ClassHeapStats::ResetAtNewGC() { | 246 void ClassHeapStats::ResetAtNewGC() { |
240 Verify(); | 247 Verify(); |
241 pre_gc.new_count = post_gc.new_count + recent.new_count; | 248 pre_gc.new_count = post_gc.new_count + recent.new_count; |
242 pre_gc.new_size = post_gc.new_size + recent.new_size; | 249 pre_gc.new_size = post_gc.new_size + recent.new_size; |
243 // Accumulate allocations. | 250 // Accumulate allocations. |
244 accumulated.new_count += recent.new_count - last_reset.new_count; | 251 accumulated.new_count += recent.new_count - last_reset.new_count; |
245 accumulated.new_size += recent.new_size - last_reset.new_size; | 252 accumulated.new_size += recent.new_size - last_reset.new_size; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 482 |
476 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { | 483 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { |
477 ClassHeapStats* stats = PreliminaryStatsAt(cid); | 484 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
478 ASSERT(stats != NULL); | 485 ASSERT(stats != NULL); |
479 ASSERT(size >= 0); | 486 ASSERT(size >= 0); |
480 stats->post_gc.AddNew(size); | 487 stats->post_gc.AddNew(size); |
481 } | 488 } |
482 | 489 |
483 | 490 |
484 } // namespace dart | 491 } // namespace dart |
OLD | NEW |