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

Unified Diff: runtime/vm/raw_object.cc

Issue 11312183: - Do not mix scalar values and object fields in RawInstance to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
Index: runtime/vm/raw_object.cc
===================================================================
--- runtime/vm/raw_object.cc (revision 14777)
+++ runtime/vm/raw_object.cc (working copy)
@@ -593,13 +593,17 @@
ObjectPointerVisitor* visitor) {
// Make sure that we got here with the tagged pointer as this.
ASSERT(raw_obj->IsHeapObject());
- RawClass* cls = visitor->isolate()->class_table()->At(raw_obj->GetClassId());
- intptr_t instance_size = cls->ptr()->instance_size_;
- intptr_t num_native_fields = cls->ptr()->num_native_fields_;
+ uword tags = raw_obj->ptr()->tags_;
cshapiro 2012/11/12 18:48:45 Any reason we are not just using RawObject::Size()
Ivan Posva 2012/11/12 22:01:03 I tried to keep it as similar as possible to the o
+ intptr_t instance_size = SizeTag::decode(tags);
+ if (instance_size == 0) {
+ RawClass* cls =
+ visitor->isolate()->class_table()->At(raw_obj->GetClassId());
+ instance_size = cls->ptr()->instance_size_;
+ }
// Calculate the first and last raw object pointer fields.
uword obj_addr = RawObject::ToAddr(raw_obj);
- uword from = obj_addr + sizeof(RawObject) + num_native_fields * kWordSize;
+ uword from = obj_addr + sizeof(RawObject);
uword to = obj_addr + instance_size - kWordSize;
visitor->VisitPointers(reinterpret_cast<RawObject**>(from),
reinterpret_cast<RawObject**>(to));

Powered by Google App Engine
This is Rietveld 408576698