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

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

Issue 1168483003: Thread-local store buffers, v2 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 5 years, 6 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.h ('k') | runtime/vm/raw_object.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) 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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 NoSafepointScope no_safepoint; 1710 NoSafepointScope no_safepoint;
1711 InitializeObject(address, cls_id, size); 1711 InitializeObject(address, cls_id, size);
1712 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); 1712 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
1713 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); 1713 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_));
1714 return raw_obj; 1714 return raw_obj;
1715 } 1715 }
1716 1716
1717 1717
1718 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { 1718 class StoreBufferUpdateVisitor : public ObjectPointerVisitor {
1719 public: 1719 public:
1720 explicit StoreBufferUpdateVisitor(Isolate* isolate, RawObject* obj) : 1720 explicit StoreBufferUpdateVisitor(Thread* thread, RawObject* obj) :
1721 ObjectPointerVisitor(isolate), old_obj_(obj) { 1721 ObjectPointerVisitor(thread->isolate()), thread_(thread), old_obj_(obj) {
1722 ASSERT(old_obj_->IsOldObject()); 1722 ASSERT(old_obj_->IsOldObject());
1723 } 1723 }
1724 1724
1725 void VisitPointers(RawObject** first, RawObject** last) { 1725 void VisitPointers(RawObject** first, RawObject** last) {
1726 for (RawObject** curr = first; curr <= last; ++curr) { 1726 for (RawObject** curr = first; curr <= last; ++curr) {
1727 RawObject* raw_obj = *curr; 1727 RawObject* raw_obj = *curr;
1728 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) { 1728 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) {
1729 old_obj_->SetRememberedBit(); 1729 old_obj_->SetRememberedBit();
1730 isolate()->store_buffer()->AddObject(old_obj_); 1730 thread_->StoreBufferAddObject(old_obj_);
1731 // Remembered this object. There is no need to continue searching. 1731 // Remembered this object. There is no need to continue searching.
1732 return; 1732 return;
1733 } 1733 }
1734 } 1734 }
1735 } 1735 }
1736 1736
1737 private: 1737 private:
1738 Thread* thread_;
1738 RawObject* old_obj_; 1739 RawObject* old_obj_;
1739 1740
1740 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor); 1741 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor);
1741 }; 1742 };
1742 1743
1743 1744
1744 bool Object::IsReadOnlyHandle() const { 1745 bool Object::IsReadOnlyHandle() const {
1745 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this)); 1746 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this));
1746 } 1747 }
1747 1748
(...skipping 21 matching lines...) Expand all
1769 size - kHeaderSizeInBytes); 1770 size - kHeaderSizeInBytes);
1770 VerifiedMemory::Accept(clone_addr, size); 1771 VerifiedMemory::Accept(clone_addr, size);
1771 // Add clone to store buffer, if needed. 1772 // Add clone to store buffer, if needed.
1772 if (!raw_clone->IsOldObject()) { 1773 if (!raw_clone->IsOldObject()) {
1773 // No need to remember an object in new space. 1774 // No need to remember an object in new space.
1774 return raw_clone; 1775 return raw_clone;
1775 } else if (orig.raw()->IsOldObject() && !orig.raw()->IsRemembered()) { 1776 } else if (orig.raw()->IsOldObject() && !orig.raw()->IsRemembered()) {
1776 // Old original doesn't need to be remembered, so neither does the clone. 1777 // Old original doesn't need to be remembered, so neither does the clone.
1777 return raw_clone; 1778 return raw_clone;
1778 } 1779 }
1779 StoreBufferUpdateVisitor visitor(Isolate::Current(), raw_clone); 1780 StoreBufferUpdateVisitor visitor(Thread::Current(), raw_clone);
1780 raw_clone->VisitPointers(&visitor); 1781 raw_clone->VisitPointers(&visitor);
1781 return raw_clone; 1782 return raw_clone;
1782 } 1783 }
1783 1784
1784 1785
1785 RawString* Class::Name() const { 1786 RawString* Class::Name() const {
1786 // TODO(turnidge): This assert fails for the fake kFreeListElement class. 1787 // TODO(turnidge): This assert fails for the fake kFreeListElement class.
1787 // Fix this. 1788 // Fix this.
1788 ASSERT(raw_ptr()->name_ != String::null()); 1789 ASSERT(raw_ptr()->name_ != String::null());
1789 return raw_ptr()->name_; 1790 return raw_ptr()->name_;
(...skipping 19061 matching lines...) Expand 10 before | Expand all | Expand 10 after
20851 return tag_label.ToCString(); 20852 return tag_label.ToCString();
20852 } 20853 }
20853 20854
20854 20855
20855 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20856 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20856 Instance::PrintJSONImpl(stream, ref); 20857 Instance::PrintJSONImpl(stream, ref);
20857 } 20858 }
20858 20859
20859 20860
20860 } // namespace dart 20861 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698