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

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

Issue 1838373002: Remove unnecessary isolate argument from some visitors (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 4 years, 8 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/service.cc ('k') | runtime/vm/symbols.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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 #undef VM_OBJECT_WRITE 1838 #undef VM_OBJECT_WRITE
1839 1839
1840 1840
1841 // An object visitor which will iterate over all the script objects in the heap 1841 // An object visitor which will iterate over all the script objects in the heap
1842 // and either count them or collect them into an array. This is used during 1842 // and either count them or collect them into an array. This is used during
1843 // full snapshot generation of the VM isolate to write out all script 1843 // full snapshot generation of the VM isolate to write out all script
1844 // objects and their accompanying token streams. 1844 // objects and their accompanying token streams.
1845 class ScriptVisitor : public ObjectVisitor { 1845 class ScriptVisitor : public ObjectVisitor {
1846 public: 1846 public:
1847 explicit ScriptVisitor(Thread* thread) : 1847 explicit ScriptVisitor(Thread* thread) :
1848 ObjectVisitor(thread->isolate()),
1849 objHandle_(Object::Handle(thread->zone())), 1848 objHandle_(Object::Handle(thread->zone())),
1850 count_(0), 1849 count_(0),
1851 scripts_(NULL) {} 1850 scripts_(NULL) {}
1852 1851
1853 ScriptVisitor(Thread* thread, const Array* scripts) : 1852 ScriptVisitor(Thread* thread, const Array* scripts) :
1854 ObjectVisitor(thread->isolate()),
1855 objHandle_(Object::Handle(thread->zone())), 1853 objHandle_(Object::Handle(thread->zone())),
1856 count_(0), 1854 count_(0),
1857 scripts_(scripts) {} 1855 scripts_(scripts) {}
1858 1856
1859 void VisitObject(RawObject* obj) { 1857 void VisitObject(RawObject* obj) {
1860 if (obj->IsScript()) { 1858 if (obj->IsScript()) {
1861 if (scripts_ != NULL) { 1859 if (scripts_ != NULL) {
1862 objHandle_ = obj; 1860 objHandle_ = obj;
1863 scripts_->SetAt(count_, objHandle_); 1861 scripts_->SetAt(count_, objHandle_);
1864 } 1862 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 } 2262 }
2265 2263
2266 const Object& obj = Object::Handle(raw); 2264 const Object& obj = Object::Handle(raw);
2267 FATAL1("Unexpected object: %s\n", obj.ToCString()); 2265 FATAL1("Unexpected object: %s\n", obj.ToCString());
2268 } 2266 }
2269 2267
2270 2268
2271 class WriteInlinedObjectVisitor : public ObjectVisitor { 2269 class WriteInlinedObjectVisitor : public ObjectVisitor {
2272 public: 2270 public:
2273 explicit WriteInlinedObjectVisitor(SnapshotWriter* writer) 2271 explicit WriteInlinedObjectVisitor(SnapshotWriter* writer)
2274 : ObjectVisitor(Isolate::Current()), writer_(writer) {} 2272 : writer_(writer) {}
2275 2273
2276 virtual void VisitObject(RawObject* obj) { 2274 virtual void VisitObject(RawObject* obj) {
2277 intptr_t object_id = writer_->forward_list_->FindObject(obj); 2275 intptr_t object_id = writer_->forward_list_->FindObject(obj);
2278 ASSERT(object_id != kInvalidIndex); 2276 ASSERT(object_id != kInvalidIndex);
2279 intptr_t tags = writer_->GetObjectTags(obj); 2277 intptr_t tags = writer_->GetObjectTags(obj);
2280 writer_->WriteMarkedObjectImpl(obj, tags, object_id, kAsInlinedObject); 2278 writer_->WriteMarkedObjectImpl(obj, tags, object_id, kAsInlinedObject);
2281 } 2279 }
2282 2280
2283 private: 2281 private:
2284 SnapshotWriter* writer_; 2282 SnapshotWriter* writer_;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 if (setjmp(*jump.Set()) == 0) { 2660 if (setjmp(*jump.Set()) == 0) {
2663 NoSafepointScope no_safepoint; 2661 NoSafepointScope no_safepoint;
2664 WriteObject(obj.raw()); 2662 WriteObject(obj.raw());
2665 } else { 2663 } else {
2666 ThrowException(exception_type(), exception_msg()); 2664 ThrowException(exception_type(), exception_msg());
2667 } 2665 }
2668 } 2666 }
2669 2667
2670 2668
2671 } // namespace dart 2669 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698