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

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

Issue 1181943002: Assert no allocation during heap iteration; fix unsafe iteration in ObjectGraph. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: spelling fix Created 5 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
« no previous file with comments | « runtime/vm/object_graph.cc ('k') | no next file » | 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/pages.h" 5 #include "vm/pages.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/compiler_stats.h" 8 #include "vm/compiler_stats.h"
9 #include "vm/gc_marker.h" 9 #include "vm/gc_marker.h"
10 #include "vm/gc_sweeper.h" 10 #include "vm/gc_sweeper.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 78
79 void HeapPage::Deallocate() { 79 void HeapPage::Deallocate() {
80 // The memory for this object will become unavailable after the delete below. 80 // The memory for this object will become unavailable after the delete below.
81 delete memory_; 81 delete memory_;
82 } 82 }
83 83
84 84
85 void HeapPage::VisitObjects(ObjectVisitor* visitor) const { 85 void HeapPage::VisitObjects(ObjectVisitor* visitor) const {
86 NoSafepointScope no_safepoint;
86 uword obj_addr = object_start(); 87 uword obj_addr = object_start();
87 uword end_addr = object_end(); 88 uword end_addr = object_end();
88 while (obj_addr < end_addr) { 89 while (obj_addr < end_addr) {
89 RawObject* raw_obj = RawObject::FromAddr(obj_addr); 90 RawObject* raw_obj = RawObject::FromAddr(obj_addr);
90 visitor->VisitObject(raw_obj); 91 visitor->VisitObject(raw_obj);
91 obj_addr += raw_obj->Size(); 92 obj_addr += raw_obj->Size();
92 } 93 }
93 ASSERT(obj_addr == end_addr); 94 ASSERT(obj_addr == end_addr);
94 } 95 }
95 96
96 97
97 void HeapPage::VisitObjectPointers(ObjectPointerVisitor* visitor) const { 98 void HeapPage::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
99 NoSafepointScope no_safepoint;
98 uword obj_addr = object_start(); 100 uword obj_addr = object_start();
99 uword end_addr = object_end(); 101 uword end_addr = object_end();
100 while (obj_addr < end_addr) { 102 while (obj_addr < end_addr) {
101 RawObject* raw_obj = RawObject::FromAddr(obj_addr); 103 RawObject* raw_obj = RawObject::FromAddr(obj_addr);
102 obj_addr += raw_obj->VisitPointers(visitor); 104 obj_addr += raw_obj->VisitPointers(visitor);
103 } 105 }
104 ASSERT(obj_addr == end_addr); 106 ASSERT(obj_addr == end_addr);
105 } 107 }
106 108
107 109
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 return 0; 1134 return 0;
1133 } else { 1135 } else {
1134 ASSERT(total_time >= gc_time); 1136 ASSERT(total_time >= gc_time);
1135 int result = static_cast<int>((static_cast<double>(gc_time) / 1137 int result = static_cast<int>((static_cast<double>(gc_time) /
1136 static_cast<double>(total_time)) * 100); 1138 static_cast<double>(total_time)) * 100);
1137 return result; 1139 return result;
1138 } 1140 }
1139 } 1141 }
1140 1142
1141 } // namespace dart 1143 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_graph.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698