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

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

Issue 1394673002: Move reusable handles from isolate to thread. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix release build Created 5 years, 2 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/profiler.h » ('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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 435 }
436 436
437 437
438 class WriteGraphVisitor : public ObjectGraph::Visitor { 438 class WriteGraphVisitor : public ObjectGraph::Visitor {
439 public: 439 public:
440 WriteGraphVisitor(Isolate* isolate, WriteStream* stream) 440 WriteGraphVisitor(Isolate* isolate, WriteStream* stream)
441 : stream_(stream), ptr_writer_(isolate, stream), count_(0) {} 441 : stream_(stream), ptr_writer_(isolate, stream), count_(0) {}
442 442
443 virtual Direction VisitObject(ObjectGraph::StackIterator* it) { 443 virtual Direction VisitObject(ObjectGraph::StackIterator* it) {
444 RawObject* raw_obj = it->Get(); 444 RawObject* raw_obj = it->Get();
445 Isolate* isolate = Isolate::Current(); 445 Thread* thread = Thread::Current();
446 REUSABLE_OBJECT_HANDLESCOPE(isolate); 446 REUSABLE_OBJECT_HANDLESCOPE(thread);
447 Object& obj = isolate->ObjectHandle(); 447 Object& obj = thread->ObjectHandle();
448 obj = raw_obj; 448 obj = raw_obj;
449 // Each object is a header + a zero-terminated list of its neighbors. 449 // Each object is a header + a zero-terminated list of its neighbors.
450 WriteHeader(raw_obj, raw_obj->Size(), obj.GetClassId(), stream_); 450 WriteHeader(raw_obj, raw_obj->Size(), obj.GetClassId(), stream_);
451 raw_obj->VisitPointers(&ptr_writer_); 451 raw_obj->VisitPointers(&ptr_writer_);
452 stream_->WriteUnsigned(0); 452 stream_->WriteUnsigned(0);
453 ++count_; 453 ++count_;
454 return kProceed; 454 return kProceed;
455 } 455 }
456 456
457 intptr_t count() const { return count_; } 457 intptr_t count() const { return count_; }
(...skipping 16 matching lines...) Expand all
474 { 474 {
475 WritePointerVisitor ptr_writer(isolate(), stream); 475 WritePointerVisitor ptr_writer(isolate(), stream);
476 isolate()->IterateObjectPointers(&ptr_writer, false, false); 476 isolate()->IterateObjectPointers(&ptr_writer, false, false);
477 } 477 }
478 stream->WriteUnsigned(0); 478 stream->WriteUnsigned(0);
479 IterateObjects(&visitor); 479 IterateObjects(&visitor);
480 return visitor.count() + 1; // + root 480 return visitor.count() + 1; // + root
481 } 481 }
482 482
483 } // namespace dart 483 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698