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

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

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: explicit-thread Created 3 years, 4 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
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/clustered_snapshot.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 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"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 table_[index] = cls.raw(); 198 table_[index] = cls.raw();
199 } 199 }
200 200
201 #if defined(DEBUG) 201 #if defined(DEBUG)
202 void ClassTable::Unregister(intptr_t index) { 202 void ClassTable::Unregister(intptr_t index) {
203 table_[index] = 0; 203 table_[index] = 0;
204 } 204 }
205 #endif 205 #endif
206 206
207 void ClassTable::Remap(intptr_t* old_to_new_cid) { 207 void ClassTable::Remap(intptr_t* old_to_new_cid) {
208 ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0); 208 ASSERT(Thread::Current()->IsAtSafepoint());
209 intptr_t num_cids = NumCids(); 209 intptr_t num_cids = NumCids();
210 RawClass** cls_by_old_cid = new RawClass*[num_cids]; 210 RawClass** cls_by_old_cid = new RawClass*[num_cids];
211 for (intptr_t i = 0; i < num_cids; i++) { 211 for (intptr_t i = 0; i < num_cids; i++) {
212 cls_by_old_cid[i] = table_[i]; 212 cls_by_old_cid[i] = table_[i];
213 } 213 }
214 for (intptr_t i = 0; i < num_cids; i++) { 214 for (intptr_t i = 0; i < num_cids; i++) {
215 table_[old_to_new_cid[i]] = cls_by_old_cid[i]; 215 table_[old_to_new_cid[i]] = cls_by_old_cid[i];
216 } 216 }
217 delete[] cls_by_old_cid; 217 delete[] cls_by_old_cid;
218 } 218 }
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 547
548 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { 548 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) {
549 ClassHeapStats* stats = PreliminaryStatsAt(cid); 549 ClassHeapStats* stats = PreliminaryStatsAt(cid);
550 ASSERT(stats != NULL); 550 ASSERT(stats != NULL);
551 ASSERT(size >= 0); 551 ASSERT(size >= 0);
552 stats->post_gc.AddNew(size); 552 stats->post_gc.AddNew(size);
553 } 553 }
554 #endif // !PRODUCT 554 #endif // !PRODUCT
555 555
556 } // namespace dart 556 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698