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

Unified Diff: runtime/vm/object.h

Issue 14296006: Fast copy between TypedData and ExternalTypedData (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
« runtime/lib/typeddata.cc ('K') | « runtime/lib/typeddata.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index a81aaa05a37bbc548f7dadf2e98b2bf88b881ce6..beb4fafad9c8af1f8e3f4e78f5bb1bf38151d593 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5034,6 +5034,11 @@ class TypedData : public Instance {
return ElementSizeInBytes(cid);
}
+ intptr_t ElementType() const {
+ intptr_t cid = raw()->GetClassId();
+ return ElementType(cid);
kustermann 2013/04/16 17:26:04 It is not the nicest thing that these functions re
Vyacheslav Egorov (Google) 2013/04/17 11:41:56 Why not introduce an enum: enum TypeDataElementTy
Vyacheslav Egorov (Google) 2013/04/17 12:55:27 I meant: enum TypeDataElementType { #define V(nam
kustermann 2013/04/18 13:57:57 Done.
+ }
+
intptr_t LengthInBytes() const {
intptr_t cid = raw()->GetClassId();
return (ElementSizeInBytes(cid) * Length());
@@ -5086,6 +5091,11 @@ class TypedData : public Instance {
return element_size[class_id - kTypedDataInt8ArrayCid];
}
+ static intptr_t ElementType(intptr_t class_id) {
+ ASSERT(RawObject::IsTypedDataClassId(class_id));
+ return class_id - kTypedDataInt8ArrayCid;
+ }
+
static intptr_t MaxElements(intptr_t class_id) {
ASSERT(RawObject::IsTypedDataClassId(class_id));
return (kSmiMax / ElementSizeInBytes(class_id));
@@ -5134,6 +5144,11 @@ class ExternalTypedData : public Instance {
return ElementSizeInBytes(cid);
}
+ intptr_t ElementType() const {
+ intptr_t cid = raw()->GetClassId();
+ return ElementType(cid);
+ }
+
intptr_t LengthInBytes() const {
intptr_t cid = raw()->GetClassId();
return (ElementSizeInBytes(cid) * Length());
@@ -5187,6 +5202,11 @@ class ExternalTypedData : public Instance {
return TypedData::element_size[class_id - kExternalTypedDataInt8ArrayCid];
}
+ static intptr_t ElementType(intptr_t class_id) {
+ ASSERT(RawObject::IsExternalTypedDataClassId(class_id));
+ return class_id - kExternalTypedDataInt8ArrayCid;
+ }
+
static intptr_t MaxElements(intptr_t class_id) {
ASSERT(RawObject::IsExternalTypedDataClassId(class_id));
return (kSmiMax / ElementSizeInBytes(class_id));
« runtime/lib/typeddata.cc ('K') | « runtime/lib/typeddata.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698