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

Unified Diff: runtime/vm/object.cc

Issue 11968020: Fix for 7941 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « no previous file | runtime/vm/object_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 17155)
+++ runtime/vm/object.cc (working copy)
@@ -515,9 +515,8 @@
// Make unused space in an object whose type has been transformed safe
// for traversing during GC.
-// The unused part of the transformed object is marked as an Array
-// object or a regular Object so that it can be traversed during garbage
-// collection.
+// The unused part of the transformed object is marked as an Int8Array
+// object.
void Object::MakeUnusedSpaceTraversable(const Object& obj,
intptr_t original_size,
intptr_t used_size) {
@@ -528,29 +527,17 @@
intptr_t leftover_size = original_size - used_size;
uword addr = RawObject::ToAddr(obj.raw()) + used_size;
- if (leftover_size >= Array::InstanceSize(0)) {
- // As we have enough space to use an array object, update the leftover
- // space as an Array object.
- RawArray* raw = reinterpret_cast<RawArray*>(RawObject::FromAddr(addr));
- uword tags = 0;
- tags = RawObject::SizeTag::update(leftover_size, tags);
- tags = RawObject::ClassIdTag::update(kArrayCid, tags);
- raw->ptr()->tags_ = tags;
- intptr_t leftover_len =
- ((leftover_size - Array::InstanceSize(0)) / kWordSize);
- ASSERT(Array::InstanceSize(leftover_len) == leftover_size);
- raw->ptr()->tags_ = tags;
- raw->ptr()->length_ = Smi::New(leftover_len);
- } else {
- // Update the leftover space as a basic object.
- ASSERT(leftover_size == Object::InstanceSize());
- RawObject* raw =
- reinterpret_cast<RawObject*>(RawObject::FromAddr(addr));
- uword tags = 0;
- tags = RawObject::SizeTag::update(leftover_size, tags);
- tags = RawObject::ClassIdTag::update(kInstanceCid, tags);
- raw->ptr()->tags_ = tags;
- }
+ ASSERT(Int8Array::InstanceSize(0) == Object::InstanceSize());
+ // Update the leftover space as an Int8Array object.
+ RawInt8Array* raw =
+ reinterpret_cast<RawInt8Array*>(RawObject::FromAddr(addr));
+ uword tags = 0;
+ tags = RawObject::SizeTag::update(leftover_size, tags);
+ tags = RawObject::ClassIdTag::update(kInt8ArrayCid, tags);
+ raw->ptr()->tags_ = tags;
+ intptr_t leftover_len = (leftover_size - Int8Array::InstanceSize(0));
+ ASSERT(Int8Array::InstanceSize(leftover_len) == leftover_size);
+ raw->ptr()->length_ = Smi::New(leftover_len);
}
}
« no previous file with comments | « no previous file | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698