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/heap.h" | 8 #include "vm/heap.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 } | 42 } |
43 predefined_class_heap_stats_table_ = reinterpret_cast<ClassHeapStats*>( | 43 predefined_class_heap_stats_table_ = reinterpret_cast<ClassHeapStats*>( |
44 calloc(kNumPredefinedCids, sizeof(ClassHeapStats))); // NOLINT | 44 calloc(kNumPredefinedCids, sizeof(ClassHeapStats))); // NOLINT |
45 for (intptr_t i = 0; i < kNumPredefinedCids; i++) { | 45 for (intptr_t i = 0; i < kNumPredefinedCids; i++) { |
46 predefined_class_heap_stats_table_[i].Initialize(); | 46 predefined_class_heap_stats_table_[i].Initialize(); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 | 50 |
| 51 ClassTable::ClassTable(ClassTable* original) |
| 52 : top_(original->top_), |
| 53 capacity_(original->top_), |
| 54 table_(reinterpret_cast<RawClass**>( |
| 55 calloc(original->top_, sizeof(RawClass*)))), |
| 56 class_heap_stats_table_(NULL), |
| 57 predefined_class_heap_stats_table_(NULL) { |
| 58 for (intptr_t i = 1; i < top_; i++) { |
| 59 table_[i] = original->At(i); |
| 60 } |
| 61 } |
| 62 |
| 63 |
51 ClassTable::~ClassTable() { | 64 ClassTable::~ClassTable() { |
52 free(table_); | 65 free(table_); |
53 free(predefined_class_heap_stats_table_); | 66 free(predefined_class_heap_stats_table_); |
54 free(class_heap_stats_table_); | 67 free(class_heap_stats_table_); |
55 } | 68 } |
56 | 69 |
57 | 70 |
58 void ClassTable::Register(const Class& cls) { | 71 void ClassTable::Register(const Class& cls) { |
59 intptr_t index = cls.id(); | 72 intptr_t index = cls.id(); |
60 if (index != kIllegalCid) { | 73 if (index != kIllegalCid) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 440 |
428 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { | 441 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { |
429 ClassHeapStats* stats = PreliminaryStatsAt(cid); | 442 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
430 ASSERT(stats != NULL); | 443 ASSERT(stats != NULL); |
431 ASSERT(size >= 0); | 444 ASSERT(size >= 0); |
432 stats->post_gc.AddNew(size); | 445 stats->post_gc.AddNew(size); |
433 } | 446 } |
434 | 447 |
435 | 448 |
436 } // namespace dart | 449 } // namespace dart |
OLD | NEW |