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

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

Issue 1250463004: Migrate NoSafepointScope; add constrained concurrent allocation to unit test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Assert current thread is mutator; add shared assertion macro. Created 5 years, 5 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.cc ('k') | runtime/vm/raw_object_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_graph.h" 5 #include "vm/object_graph.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 intptr_t size_excluding_class = excluding_class.size(); 249 intptr_t size_excluding_class = excluding_class.size();
250 return size_total - size_excluding_class; 250 return size_total - size_excluding_class;
251 } 251 }
252 252
253 253
254 class RetainingPathVisitor : public ObjectGraph::Visitor { 254 class RetainingPathVisitor : public ObjectGraph::Visitor {
255 public: 255 public:
256 // We cannot use a GrowableObjectArray, since we must not trigger GC. 256 // We cannot use a GrowableObjectArray, since we must not trigger GC.
257 RetainingPathVisitor(RawObject* obj, const Array& path) 257 RetainingPathVisitor(RawObject* obj, const Array& path)
258 : obj_(obj), path_(path), length_(0) { 258 : obj_(obj), path_(path), length_(0) {
259 ASSERT(Isolate::Current()->no_safepoint_scope_depth() != 0); 259 ASSERT(Thread::Current()->no_safepoint_scope_depth() != 0);
260 } 260 }
261 261
262 intptr_t length() const { return length_; } 262 intptr_t length() const { return length_; }
263 263
264 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { 264 virtual Direction VisitObject(ObjectGraph::StackIterator* it) {
265 if (it->Get() != obj_) { 265 if (it->Get() != obj_) {
266 return kProceed; 266 return kProceed;
267 } else { 267 } else {
268 HANDLESCOPE(Isolate::Current()); 268 HANDLESCOPE(Isolate::Current());
269 Object& current = Object::Handle(); 269 Object& current = Object::Handle();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 class InboundReferencesVisitor : public ObjectVisitor, 306 class InboundReferencesVisitor : public ObjectVisitor,
307 public ObjectPointerVisitor { 307 public ObjectPointerVisitor {
308 public: 308 public:
309 // We cannot use a GrowableObjectArray, since we must not trigger GC. 309 // We cannot use a GrowableObjectArray, since we must not trigger GC.
310 InboundReferencesVisitor(Isolate* isolate, 310 InboundReferencesVisitor(Isolate* isolate,
311 RawObject* target, 311 RawObject* target,
312 const Array& references, 312 const Array& references,
313 Object* scratch) 313 Object* scratch)
314 : ObjectVisitor(isolate), ObjectPointerVisitor(isolate), source_(NULL), 314 : ObjectVisitor(isolate), ObjectPointerVisitor(isolate), source_(NULL),
315 target_(target), references_(references), scratch_(scratch), length_(0) { 315 target_(target), references_(references), scratch_(scratch), length_(0) {
316 ASSERT(Isolate::Current()->no_safepoint_scope_depth() != 0); 316 ASSERT(Thread::Current()->no_safepoint_scope_depth() != 0);
317 } 317 }
318 318
319 intptr_t length() const { return length_; } 319 intptr_t length() const { return length_; }
320 320
321 virtual void VisitObject(RawObject* raw_obj) { 321 virtual void VisitObject(RawObject* raw_obj) {
322 source_ = raw_obj; 322 source_ = raw_obj;
323 raw_obj->VisitPointers(this); 323 raw_obj->VisitPointers(this);
324 } 324 }
325 325
326 virtual void VisitPointers(RawObject** first, RawObject** last) { 326 virtual void VisitPointers(RawObject** first, RawObject** last) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 { 457 {
458 WritePointerVisitor ptr_writer(isolate(), stream); 458 WritePointerVisitor ptr_writer(isolate(), stream);
459 isolate()->IterateObjectPointers(&ptr_writer, false, false); 459 isolate()->IterateObjectPointers(&ptr_writer, false, false);
460 } 460 }
461 stream->WriteUnsigned(0); 461 stream->WriteUnsigned(0);
462 IterateObjects(&visitor); 462 IterateObjects(&visitor);
463 return visitor.count() + 1; // + root 463 return visitor.count() + 1; // + root
464 } 464 }
465 465
466 } // namespace dart 466 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698