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

Unified Diff: runtime/vm/raw_object.cc

Issue 9195031: Add ByteArray interface and provide internal and external implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address remaining review comments Created 8 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 | « runtime/vm/raw_object.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.cc
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index a51f69c5fcf1c19fd91fc37b74efdfe0d8b508cc..2c3c564775cd7c4b1604da1d9e5f12ac3e81fd90 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -116,6 +116,13 @@ intptr_t RawObject::SizeFromClass() const {
instance_size = Array::InstanceSize(array_length);
break;
}
+ case kInternalByteArray: {
+ const RawInternalByteArray* raw_byte_array =
+ reinterpret_cast<const RawInternalByteArray*>(this);
+ intptr_t byte_array_length = Smi::Value(raw_byte_array->ptr()->length_);
+ instance_size = InternalByteArray::InstanceSize(byte_array_length);
+ break;
+ }
case kTypeArguments: {
const RawTypeArguments* raw_array =
reinterpret_cast<const RawTypeArguments*>(this);
@@ -576,12 +583,30 @@ intptr_t RawImmutableArray::VisitImmutableArrayPointers(
}
-intptr_t RawByteBuffer::VisitByteBufferPointers(
- RawByteBuffer* raw_obj, ObjectPointerVisitor* visitor) {
+intptr_t RawByteArray::VisitByteArrayPointers(RawByteArray* raw_obj,
+ ObjectPointerVisitor* visitor) {
+ // ByteArray is an abstract class.
+ UNREACHABLE();
+ return 0;
+}
+
+
+intptr_t RawInternalByteArray::VisitInternalByteArrayPointers(
+ RawInternalByteArray* raw_obj, ObjectPointerVisitor* visitor) {
+ // Make sure that we got here with the tagged pointer as this.
+ ASSERT(raw_obj->IsHeapObject());
+ intptr_t length = Smi::Value(raw_obj->ptr()->length_);
+ visitor->VisitPointers(raw_obj->from(), raw_obj->to());
+ return InternalByteArray::InstanceSize(length);
+}
+
+
+intptr_t RawExternalByteArray::VisitExternalByteArrayPointers(
+ RawExternalByteArray* raw_obj, ObjectPointerVisitor* visitor) {
// Make sure that we got here with the tagged pointer as this.
ASSERT(raw_obj->IsHeapObject());
visitor->VisitPointers(raw_obj->from(), raw_obj->to());
- return ByteBuffer::InstanceSize();
+ return ExternalByteArray::InstanceSize();
}
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698