| 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 | 6 |
| 7 #include "vm/atomic.h" | 7 #include "vm/atomic.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| 11 #include "vm/heap.h" | 11 #include "vm/heap.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/raw_object.h" | 13 #include "vm/raw_object.h" |
| 14 #include "vm/visitor.h" | 14 #include "vm/visitor.h" |
| 15 | 15 |
| 16 namespace dart { | 16 namespace dart { |
| 17 | 17 |
| 18 DEFINE_FLAG(bool, print_class_table, false, "Print initial class table."); | 18 DEFINE_FLAG(bool, print_class_table, false, "Print initial class table."); |
| 19 | 19 |
| 20 ClassTable::ClassTable() | 20 ClassTable::ClassTable() |
| 21 : top_(kNumPredefinedCids), capacity_(0), table_(NULL), | 21 : top_(kNumPredefinedCids), capacity_(0), table_(NULL), |
| 22 old_tables_(new MallocGrowableArray<RawClass**>()) { | 22 old_tables_(new MallocGrowableArray<RawClass**>()) { |
| 23 NOT_IN_PRODUCT(class_heap_stats_table_ = NULL); |
| 24 NOT_IN_PRODUCT(predefined_class_heap_stats_table_ = NULL); |
| 23 if (Dart::vm_isolate() == NULL) { | 25 if (Dart::vm_isolate() == NULL) { |
| 24 capacity_ = initial_capacity_; | 26 capacity_ = initial_capacity_; |
| 25 table_ = reinterpret_cast<RawClass**>( | 27 table_ = reinterpret_cast<RawClass**>( |
| 26 calloc(capacity_, sizeof(RawClass*))); // NOLINT | 28 calloc(capacity_, sizeof(RawClass*))); // NOLINT |
| 27 } else { | 29 } else { |
| 28 // Duplicate the class table from the VM isolate. | 30 // Duplicate the class table from the VM isolate. |
| 29 ClassTable* vm_class_table = Dart::vm_isolate()->class_table(); | 31 ClassTable* vm_class_table = Dart::vm_isolate()->class_table(); |
| 30 capacity_ = vm_class_table->capacity_; | 32 capacity_ = vm_class_table->capacity_; |
| 31 table_ = reinterpret_cast<RawClass**>( | 33 table_ = reinterpret_cast<RawClass**>( |
| 32 calloc(capacity_, sizeof(RawClass*))); // NOLINT | 34 calloc(capacity_, sizeof(RawClass*))); // NOLINT |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { | 569 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { |
| 568 ClassHeapStats* stats = PreliminaryStatsAt(cid); | 570 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
| 569 ASSERT(stats != NULL); | 571 ASSERT(stats != NULL); |
| 570 ASSERT(size >= 0); | 572 ASSERT(size >= 0); |
| 571 stats->post_gc.AddNew(size); | 573 stats->post_gc.AddNew(size); |
| 572 } | 574 } |
| 573 #endif // !PRODUCT | 575 #endif // !PRODUCT |
| 574 | 576 |
| 575 | 577 |
| 576 } // namespace dart | 578 } // namespace dart |
| OLD | NEW |