| 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/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/raw_object.h" | 9 #include "vm/raw_object.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 cpp_vtable cls_vtable = cls.handle_vtable(); | 54 cpp_vtable cls_vtable = cls.handle_vtable(); |
| 55 cpp_vtable table_entry = Object::builtin_vtables_[index]; | 55 cpp_vtable table_entry = Object::builtin_vtables_[index]; |
| 56 ASSERT((table_entry == 0) || (table_entry == cls_vtable)); | 56 ASSERT((table_entry == 0) || (table_entry == cls_vtable)); |
| 57 if (table_entry == 0) { | 57 if (table_entry == 0) { |
| 58 Object::builtin_vtables_[index] = cls_vtable; | 58 Object::builtin_vtables_[index] = cls_vtable; |
| 59 } | 59 } |
| 60 } else { | 60 } else { |
| 61 if (top_ == capacity_) { | 61 if (top_ == capacity_) { |
| 62 // Grow the capacity of the class table. | 62 // Grow the capacity of the class table. |
| 63 intptr_t new_capacity = capacity_ + capacity_increment_; | 63 intptr_t new_capacity = capacity_ + capacity_increment_; |
| 64 RawClass** new_table = Utils::Realloc(table_, capacity_, new_capacity); | 64 RawClass** new_table = reinterpret_cast<RawClass**>( |
| 65 ASSERT(new_capacity > capacity_); | 65 realloc(table_, new_capacity * sizeof(RawClass*))); // NOLINT |
| 66 for (intptr_t i = capacity_; i < new_capacity; i++) { | 66 for (intptr_t i = capacity_; i < new_capacity; i++) { |
| 67 new_table[i] = NULL; | 67 new_table[i] = NULL; |
| 68 } | 68 } |
| 69 capacity_ = new_capacity; | 69 capacity_ = new_capacity; |
| 70 table_ = new_table; | 70 table_ = new_table; |
| 71 } | 71 } |
| 72 ASSERT(top_ < capacity_); | 72 ASSERT(top_ < capacity_); |
| 73 cls.set_id(top_); | 73 cls.set_id(top_); |
| 74 table_[top_] = cls.raw(); | 74 table_[top_] = cls.raw(); |
| 75 top_++; // Increment next index. | 75 top_++; // Increment next index. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 90 for (intptr_t i = 1; i < top_; i++) { | 90 for (intptr_t i = 1; i < top_; i++) { |
| 91 cls = At(i); | 91 cls = At(i); |
| 92 if (cls.raw() != reinterpret_cast<RawClass*>(0)) { | 92 if (cls.raw() != reinterpret_cast<RawClass*>(0)) { |
| 93 name = cls.Name(); | 93 name = cls.Name(); |
| 94 OS::Print("%"Pd": %s\n", i, name.ToCString()); | 94 OS::Print("%"Pd": %s\n", i, name.ToCString()); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace dart | 99 } // namespace dart |
| OLD | NEW |