Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: runtime/vm/class_table.cc

Issue 16271010: Use 'new' in all the snapshot reallocation functions instead of realloc. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/code_observers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 = reinterpret_cast<RawClass**>( 64 RawClass** new_table = Utils::Realloc(table_, capacity_, new_capacity);
65 realloc(table_, new_capacity * sizeof(RawClass*))); // NOLINT 65 ASSERT(new_capacity > capacity_);
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
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
OLDNEW
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/code_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698