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/heap.h" | 5 #include "vm/heap.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return old_space_.DataContains(addr); | 182 return old_space_.DataContains(addr); |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 void Heap::VisitObjects(ObjectVisitor* visitor) const { | 186 void Heap::VisitObjects(ObjectVisitor* visitor) const { |
187 new_space_.VisitObjects(visitor); | 187 new_space_.VisitObjects(visitor); |
188 old_space_.VisitObjects(visitor); | 188 old_space_.VisitObjects(visitor); |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 void Heap::VisitObjectsNoExternalPages(ObjectVisitor* visitor) const { | 192 void Heap::VisitObjectsNoImagePages(ObjectVisitor* visitor) const { |
193 new_space_.VisitObjects(visitor); | 193 new_space_.VisitObjects(visitor); |
194 old_space_.VisitObjectsNoExternalPages(visitor); | 194 old_space_.VisitObjectsNoImagePages(visitor); |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 void Heap::VisitObjectsExternalPages(ObjectVisitor* visitor) const { | 198 void Heap::VisitObjectsImagePages(ObjectVisitor* visitor) const { |
199 old_space_.VisitObjectsExternalPages(visitor); | 199 old_space_.VisitObjectsImagePages(visitor); |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 HeapIterationScope::HeapIterationScope(bool writable) | 203 HeapIterationScope::HeapIterationScope(bool writable) |
204 : StackResource(Thread::Current()), | 204 : StackResource(Thread::Current()), |
205 old_space_(isolate()->heap()->old_space()), | 205 old_space_(isolate()->heap()->old_space()), |
206 writable_(writable) { | 206 writable_(writable) { |
207 { | 207 { |
208 // It's not yet safe to iterate over a paged space while it's concurrently | 208 // It's not yet safe to iterate over a paged space while it's concurrently |
209 // sweeping, so wait for any such task to complete first. | 209 // sweeping, so wait for any such task to complete first. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 IterateOldObjects(visitor); | 251 IterateOldObjects(visitor); |
252 } | 252 } |
253 | 253 |
254 | 254 |
255 void Heap::IterateOldObjects(ObjectVisitor* visitor) const { | 255 void Heap::IterateOldObjects(ObjectVisitor* visitor) const { |
256 HeapIterationScope heap_iteration_scope; | 256 HeapIterationScope heap_iteration_scope; |
257 old_space_.VisitObjects(visitor); | 257 old_space_.VisitObjects(visitor); |
258 } | 258 } |
259 | 259 |
260 | 260 |
261 void Heap::IterateOldObjectsNoExternalPages(ObjectVisitor* visitor) const { | 261 void Heap::IterateOldObjectsNoImagePages(ObjectVisitor* visitor) const { |
262 HeapIterationScope heap_iteration_scope; | 262 HeapIterationScope heap_iteration_scope; |
263 old_space_.VisitObjectsNoExternalPages(visitor); | 263 old_space_.VisitObjectsNoImagePages(visitor); |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 void Heap::VisitObjectPointers(ObjectPointerVisitor* visitor) const { | 267 void Heap::VisitObjectPointers(ObjectPointerVisitor* visitor) const { |
268 new_space_.VisitObjectPointers(visitor); | 268 new_space_.VisitObjectPointers(visitor); |
269 old_space_.VisitObjectPointers(visitor); | 269 old_space_.VisitObjectPointers(visitor); |
270 } | 270 } |
271 | 271 |
272 | 272 |
273 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) const { | 273 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) const { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 524 |
525 ObjectSet* Heap::CreateAllocatedObjectSet( | 525 ObjectSet* Heap::CreateAllocatedObjectSet( |
526 Zone* zone, | 526 Zone* zone, |
527 MarkExpectation mark_expectation) const { | 527 MarkExpectation mark_expectation) const { |
528 ObjectSet* allocated_set = new (zone) ObjectSet(zone); | 528 ObjectSet* allocated_set = new (zone) ObjectSet(zone); |
529 | 529 |
530 this->AddRegionsToObjectSet(allocated_set); | 530 this->AddRegionsToObjectSet(allocated_set); |
531 { | 531 { |
532 VerifyObjectVisitor object_visitor(isolate(), allocated_set, | 532 VerifyObjectVisitor object_visitor(isolate(), allocated_set, |
533 mark_expectation); | 533 mark_expectation); |
534 this->VisitObjectsNoExternalPages(&object_visitor); | 534 this->VisitObjectsNoImagePages(&object_visitor); |
535 } | 535 } |
536 { | 536 { |
537 VerifyObjectVisitor object_visitor(isolate(), allocated_set, | 537 VerifyObjectVisitor object_visitor(isolate(), allocated_set, |
538 kRequireMarked); | 538 kRequireMarked); |
539 this->VisitObjectsExternalPages(&object_visitor); | 539 this->VisitObjectsImagePages(&object_visitor); |
540 } | 540 } |
541 | 541 |
542 Isolate* vm_isolate = Dart::vm_isolate(); | 542 Isolate* vm_isolate = Dart::vm_isolate(); |
543 vm_isolate->heap()->AddRegionsToObjectSet(allocated_set); | 543 vm_isolate->heap()->AddRegionsToObjectSet(allocated_set); |
544 { | 544 { |
545 // VM isolate heap is premarked. | 545 // VM isolate heap is premarked. |
546 VerifyObjectVisitor vm_object_visitor(isolate(), allocated_set, | 546 VerifyObjectVisitor vm_object_visitor(isolate(), allocated_set, |
547 kRequireMarked); | 547 kRequireMarked); |
548 vm_isolate->heap()->VisitObjects(&vm_object_visitor); | 548 vm_isolate->heap()->VisitObjects(&vm_object_visitor); |
549 } | 549 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 Dart::vm_isolate()->heap()->WriteProtect(false); | 843 Dart::vm_isolate()->heap()->WriteProtect(false); |
844 } | 844 } |
845 | 845 |
846 | 846 |
847 WritableVMIsolateScope::~WritableVMIsolateScope() { | 847 WritableVMIsolateScope::~WritableVMIsolateScope() { |
848 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 848 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
849 Dart::vm_isolate()->heap()->WriteProtect(true); | 849 Dart::vm_isolate()->heap()->WriteProtect(true); |
850 } | 850 } |
851 | 851 |
852 } // namespace dart | 852 } // namespace dart |
OLD | NEW |