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

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

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: . 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
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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 // Set up names for the pseudo-classes for free list elements and forwarding 1110 // Set up names for the pseudo-classes for free list elements and forwarding
1111 // corpses. Mainly this makes VM debugging easier. 1111 // corpses. Mainly this makes VM debugging easier.
1112 cls = isolate->class_table()->At(kFreeListElement); 1112 cls = isolate->class_table()->At(kFreeListElement);
1113 cls.set_name(Symbols::FreeListElement()); 1113 cls.set_name(Symbols::FreeListElement());
1114 cls = isolate->class_table()->At(kForwardingCorpse); 1114 cls = isolate->class_table()->At(kForwardingCorpse);
1115 cls.set_name(Symbols::ForwardingCorpse()); 1115 cls.set_name(Symbols::ForwardingCorpse());
1116 1116
1117 { 1117 {
1118 ASSERT(isolate == Dart::vm_isolate()); 1118 ASSERT(isolate == Dart::vm_isolate());
1119 WritableVMIsolateScope scope(Thread::Current()); 1119 WritableVMIsolateScope scope(Thread::Current());
1120 HeapIterationScope iteration;
1120 FinalizeVMIsolateVisitor premarker; 1121 FinalizeVMIsolateVisitor premarker;
1121 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0); 1122 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0);
1122 isolate->heap()->IterateOldObjectsNoImagePages(&premarker); 1123 iteration.IterateOldObjectsNoImagePages(&premarker);
1123 // Make the VM isolate read-only again after setting all objects as marked. 1124 // Make the VM isolate read-only again after setting all objects as marked.
1124 // Note objects in image pages are already pre-marked. 1125 // Note objects in image pages are already pre-marked.
1125 } 1126 }
1126 } 1127 }
1127 1128
1128 void Object::set_vm_isolate_snapshot_object_table(const Array& table) { 1129 void Object::set_vm_isolate_snapshot_object_table(const Array& table) {
1129 ASSERT(Isolate::Current() == Dart::vm_isolate()); 1130 ASSERT(Isolate::Current() == Dart::vm_isolate());
1130 *vm_isolate_snapshot_object_table_ = table.raw(); 1131 *vm_isolate_snapshot_object_table_ = table.raw();
1131 } 1132 }
1132 1133
(...skipping 12986 matching lines...) Expand 10 before | Expand all | Expand 10 after
14119 14120
14120 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { 14121 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const {
14121 return RawCode::ContainsPC(raw_obj, pc_); 14122 return RawCode::ContainsPC(raw_obj, pc_);
14122 } 14123 }
14123 14124
14124 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { 14125 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) {
14125 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); 14126 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate()));
14126 if (isolate->heap() == NULL) { 14127 if (isolate->heap() == NULL) {
14127 return Code::null(); 14128 return Code::null();
14128 } 14129 }
14129 NoSafepointScope no_safepoint; 14130 HeapIterationScope heap_iteration_scope;
14130 SlowFindRawCodeVisitor visitor(pc); 14131 SlowFindRawCodeVisitor visitor(pc);
14131 RawObject* needle = isolate->heap()->FindOldObject(&visitor); 14132 RawObject* needle = isolate->heap()->FindOldObject(&visitor);
14132 if (needle != Code::null()) { 14133 if (needle != Code::null()) {
14133 return static_cast<RawCode*>(needle); 14134 return static_cast<RawCode*>(needle);
14134 } 14135 }
14135 return Code::null(); 14136 return Code::null();
14136 } 14137 }
14137 14138
14138 RawCode* Code::LookupCode(uword pc) { 14139 RawCode* Code::LookupCode(uword pc) {
14139 return LookupCodeInIsolate(Isolate::Current(), pc); 14140 return LookupCodeInIsolate(Isolate::Current(), pc);
(...skipping 8406 matching lines...) Expand 10 before | Expand all | Expand 10 after
22546 } 22547 }
22547 return UserTag::null(); 22548 return UserTag::null();
22548 } 22549 }
22549 22550
22550 const char* UserTag::ToCString() const { 22551 const char* UserTag::ToCString() const {
22551 const String& tag_label = String::Handle(label()); 22552 const String& tag_label = String::Handle(label());
22552 return tag_label.ToCString(); 22553 return tag_label.ToCString();
22553 } 22554 }
22554 22555
22555 } // namespace dart 22556 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698