| OLD | NEW |
| 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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 NoSafepointScope no_safepoint; | 1711 NoSafepointScope no_safepoint; |
| 1712 InitializeObject(address, cls_id, size); | 1712 InitializeObject(address, cls_id, size); |
| 1713 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); | 1713 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
| 1714 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); | 1714 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); |
| 1715 return raw_obj; | 1715 return raw_obj; |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 | 1718 |
| 1719 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { | 1719 class StoreBufferUpdateVisitor : public ObjectPointerVisitor { |
| 1720 public: | 1720 public: |
| 1721 explicit StoreBufferUpdateVisitor(Isolate* isolate, RawObject* obj) : | 1721 explicit StoreBufferUpdateVisitor(Thread* thread, RawObject* obj) : |
| 1722 ObjectPointerVisitor(isolate), old_obj_(obj) { | 1722 ObjectPointerVisitor(thread->isolate()), thread_(thread), old_obj_(obj) { |
| 1723 ASSERT(old_obj_->IsOldObject()); | 1723 ASSERT(old_obj_->IsOldObject()); |
| 1724 } | 1724 } |
| 1725 | 1725 |
| 1726 void VisitPointers(RawObject** first, RawObject** last) { | 1726 void VisitPointers(RawObject** first, RawObject** last) { |
| 1727 for (RawObject** curr = first; curr <= last; ++curr) { | 1727 for (RawObject** curr = first; curr <= last; ++curr) { |
| 1728 RawObject* raw_obj = *curr; | 1728 RawObject* raw_obj = *curr; |
| 1729 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) { | 1729 if (raw_obj->IsHeapObject() && raw_obj->IsNewObject()) { |
| 1730 old_obj_->SetRememberedBit(); | 1730 old_obj_->SetRememberedBit(); |
| 1731 isolate()->store_buffer()->AddObject(old_obj_); | 1731 thread_->StoreBufferAddObject(old_obj_); |
| 1732 // Remembered this object. There is no need to continue searching. | 1732 // Remembered this object. There is no need to continue searching. |
| 1733 return; | 1733 return; |
| 1734 } | 1734 } |
| 1735 } | 1735 } |
| 1736 } | 1736 } |
| 1737 | 1737 |
| 1738 private: | 1738 private: |
| 1739 Thread* thread_; |
| 1739 RawObject* old_obj_; | 1740 RawObject* old_obj_; |
| 1740 | 1741 |
| 1741 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor); | 1742 DISALLOW_COPY_AND_ASSIGN(StoreBufferUpdateVisitor); |
| 1742 }; | 1743 }; |
| 1743 | 1744 |
| 1744 | 1745 |
| 1745 bool Object::IsReadOnlyHandle() const { | 1746 bool Object::IsReadOnlyHandle() const { |
| 1746 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this)); | 1747 return Dart::IsReadOnlyHandle(reinterpret_cast<uword>(this)); |
| 1747 } | 1748 } |
| 1748 | 1749 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1770 size - kHeaderSizeInBytes); | 1771 size - kHeaderSizeInBytes); |
| 1771 VerifiedMemory::Accept(clone_addr, size); | 1772 VerifiedMemory::Accept(clone_addr, size); |
| 1772 // Add clone to store buffer, if needed. | 1773 // Add clone to store buffer, if needed. |
| 1773 if (!raw_clone->IsOldObject()) { | 1774 if (!raw_clone->IsOldObject()) { |
| 1774 // No need to remember an object in new space. | 1775 // No need to remember an object in new space. |
| 1775 return raw_clone; | 1776 return raw_clone; |
| 1776 } else if (orig.raw()->IsOldObject() && !orig.raw()->IsRemembered()) { | 1777 } else if (orig.raw()->IsOldObject() && !orig.raw()->IsRemembered()) { |
| 1777 // Old original doesn't need to be remembered, so neither does the clone. | 1778 // Old original doesn't need to be remembered, so neither does the clone. |
| 1778 return raw_clone; | 1779 return raw_clone; |
| 1779 } | 1780 } |
| 1780 StoreBufferUpdateVisitor visitor(Isolate::Current(), raw_clone); | 1781 StoreBufferUpdateVisitor visitor(Thread::Current(), raw_clone); |
| 1781 raw_clone->VisitPointers(&visitor); | 1782 raw_clone->VisitPointers(&visitor); |
| 1782 return raw_clone; | 1783 return raw_clone; |
| 1783 } | 1784 } |
| 1784 | 1785 |
| 1785 | 1786 |
| 1786 RawString* Class::Name() const { | 1787 RawString* Class::Name() const { |
| 1787 // TODO(turnidge): This assert fails for the fake kFreeListElement class. | 1788 // TODO(turnidge): This assert fails for the fake kFreeListElement class. |
| 1788 // Fix this. | 1789 // Fix this. |
| 1789 ASSERT(raw_ptr()->name_ != String::null()); | 1790 ASSERT(raw_ptr()->name_ != String::null()); |
| 1790 return raw_ptr()->name_; | 1791 return raw_ptr()->name_; |
| (...skipping 19021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20812 return tag_label.ToCString(); | 20813 return tag_label.ToCString(); |
| 20813 } | 20814 } |
| 20814 | 20815 |
| 20815 | 20816 |
| 20816 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20817 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20817 Instance::PrintJSONImpl(stream, ref); | 20818 Instance::PrintJSONImpl(stream, ref); |
| 20818 } | 20819 } |
| 20819 | 20820 |
| 20820 | 20821 |
| 20821 } // namespace dart | 20822 } // namespace dart |
| OLD | NEW |