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

Unified Diff: runtime/vm/object.h

Issue 10796075: - Tighten assertions around store buffers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/heap.cc ('k') | runtime/vm/store_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 9795)
+++ runtime/vm/object.h (working copy)
@@ -379,8 +379,15 @@
return Utils::RoundUp(size, kObjectAlignment);
}
+ bool Contains(uword addr) const {
+ intptr_t this_size = raw()->Size();
+ uword this_addr = RawObject::ToAddr(raw());
+ return (addr >= this_addr) && (addr < (this_addr + this_size));
+ }
+
template<typename type> void StorePointer(type* addr, type value) const {
- // TODO(iposva): Implement real store barrier here.
+ // Ensure that this object contains the addr.
+ ASSERT(Contains(reinterpret_cast<uword>(addr)));
*addr = value;
// Filter stores based on source and target.
if (!value->IsHeapObject()) return;
@@ -3828,10 +3835,10 @@
return *ObjectAddr(index);
}
void SetAt(intptr_t index, const Object& value) const {
- NoGCScope no_gc;
ASSERT(!IsNull());
ASSERT(index < Length());
- StorePointer(ObjectAddr(index), value.raw());
+ const Array& arr = Array::Handle(data());
+ arr.SetAt(index, value);
}
void Add(const Object& value, Heap::Space space = Heap::kNew) const;
« no previous file with comments | « runtime/vm/heap.cc ('k') | runtime/vm/store_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698