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

Side by Side Diff: runtime/vm/object.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/isolate_reload.cc ('k') | runtime/vm/object_graph.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/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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 1109
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 Thread* thread = Thread::Current();
1120 WritableVMIsolateScope scope(thread);
1121 HeapIterationScope iteration(thread);
1120 FinalizeVMIsolateVisitor premarker; 1122 FinalizeVMIsolateVisitor premarker;
1121 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0); 1123 ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0);
1122 isolate->heap()->IterateOldObjectsNoImagePages(&premarker); 1124 iteration.IterateOldObjectsNoImagePages(&premarker);
1123 // Make the VM isolate read-only again after setting all objects as marked. 1125 // Make the VM isolate read-only again after setting all objects as marked.
1124 // Note objects in image pages are already pre-marked. 1126 // Note objects in image pages are already pre-marked.
1125 } 1127 }
1126 } 1128 }
1127 1129
1128 void Object::set_vm_isolate_snapshot_object_table(const Array& table) { 1130 void Object::set_vm_isolate_snapshot_object_table(const Array& table) {
1129 ASSERT(Isolate::Current() == Dart::vm_isolate()); 1131 ASSERT(Isolate::Current() == Dart::vm_isolate());
1130 *vm_isolate_snapshot_object_table_ = table.raw(); 1132 *vm_isolate_snapshot_object_table_ = table.raw();
1131 } 1133 }
1132 1134
(...skipping 12986 matching lines...) Expand 10 before | Expand all | Expand 10 after
14119 14121
14120 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const { 14122 bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const {
14121 return RawCode::ContainsPC(raw_obj, pc_); 14123 return RawCode::ContainsPC(raw_obj, pc_);
14122 } 14124 }
14123 14125
14124 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) { 14126 RawCode* Code::LookupCodeInIsolate(Isolate* isolate, uword pc) {
14125 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate())); 14127 ASSERT((isolate == Isolate::Current()) || (isolate == Dart::vm_isolate()));
14126 if (isolate->heap() == NULL) { 14128 if (isolate->heap() == NULL) {
14127 return Code::null(); 14129 return Code::null();
14128 } 14130 }
14129 NoSafepointScope no_safepoint; 14131 HeapIterationScope heap_iteration_scope(Thread::Current());
14130 SlowFindRawCodeVisitor visitor(pc); 14132 SlowFindRawCodeVisitor visitor(pc);
14131 RawObject* needle = isolate->heap()->FindOldObject(&visitor); 14133 RawObject* needle = isolate->heap()->FindOldObject(&visitor);
14132 if (needle != Code::null()) { 14134 if (needle != Code::null()) {
14133 return static_cast<RawCode*>(needle); 14135 return static_cast<RawCode*>(needle);
14134 } 14136 }
14135 return Code::null(); 14137 return Code::null();
14136 } 14138 }
14137 14139
14138 RawCode* Code::LookupCode(uword pc) { 14140 RawCode* Code::LookupCode(uword pc) {
14139 return LookupCodeInIsolate(Isolate::Current(), pc); 14141 return LookupCodeInIsolate(Isolate::Current(), pc);
(...skipping 8406 matching lines...) Expand 10 before | Expand all | Expand 10 after
22546 } 22548 }
22547 return UserTag::null(); 22549 return UserTag::null();
22548 } 22550 }
22549 22551
22550 const char* UserTag::ToCString() const { 22552 const char* UserTag::ToCString() const {
22551 const String& tag_label = String::Handle(label()); 22553 const String& tag_label = String::Handle(label());
22552 return tag_label.ToCString(); 22554 return tag_label.ToCString();
22553 } 22555 }
22554 22556
22555 } // namespace dart 22557 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | runtime/vm/object_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698