| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 bool ClassTable::TraceAllocationFor(intptr_t cid) { | 91 bool ClassTable::TraceAllocationFor(intptr_t cid) { |
| 92 ClassHeapStats* stats = PreliminaryStatsAt(cid); | 92 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
| 93 return stats->trace_allocation(); | 93 return stats->trace_allocation(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 void ClassTable::Register(const Class& cls) { | 97 void ClassTable::Register(const Class& cls) { |
| 98 ASSERT(Thread::Current()->IsMutatorThread()); |
| 98 intptr_t index = cls.id(); | 99 intptr_t index = cls.id(); |
| 99 if (index != kIllegalCid) { | 100 if (index != kIllegalCid) { |
| 100 ASSERT(index > 0); | 101 ASSERT(index > 0); |
| 101 ASSERT(index < kNumPredefinedCids); | 102 ASSERT(index < kNumPredefinedCids); |
| 102 ASSERT(table_[index] == 0); | 103 ASSERT(table_[index] == 0); |
| 103 ASSERT(index < capacity_); | 104 ASSERT(index < capacity_); |
| 104 table_[index] = cls.raw(); | 105 table_[index] = cls.raw(); |
| 105 // Add the vtable for this predefined class into the static vtable registry | 106 // Add the vtable for this predefined class into the static vtable registry |
| 106 // if it has not been setup yet. | 107 // if it has not been setup yet. |
| 107 cpp_vtable cls_vtable = cls.handle_vtable(); | 108 cpp_vtable cls_vtable = cls.handle_vtable(); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 532 |
| 532 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { | 533 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { |
| 533 ClassHeapStats* stats = PreliminaryStatsAt(cid); | 534 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
| 534 ASSERT(stats != NULL); | 535 ASSERT(stats != NULL); |
| 535 ASSERT(size >= 0); | 536 ASSERT(size >= 0); |
| 536 stats->post_gc.AddNew(size); | 537 stats->post_gc.AddNew(size); |
| 537 } | 538 } |
| 538 | 539 |
| 539 | 540 |
| 540 } // namespace dart | 541 } // namespace dart |
| OLD | NEW |