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

Unified Diff: runtime/vm/raw_object.h

Issue 11362009: New APIs for external byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 2 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/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 1fc850f69e7dcc3bcdd88a0b728e6fe4944b5a71..0a35859eaeda8ac4284720aa5a923defe87f4cea 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -340,6 +340,7 @@ class RawObject {
static bool IsExternalStringClassId(intptr_t index);
static bool IsBuiltinListClassId(intptr_t index);
static bool IsByteArrayClassId(intptr_t index);
+ static bool IsExternalByteArrayClassId(intptr_t index);
protected:
uword tags_; // Various object tags (bits).
@@ -1611,6 +1612,21 @@ inline bool RawObject::IsByteArrayClassId(intptr_t index) {
return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
}
+inline bool RawObject::IsExternalByteArrayClassId(intptr_t index) {
+ // Make sure this function is updated when new ByteArray types are added.
+ ASSERT(kExternalUint8ArrayCid == kExternalInt8ArrayCid + 1 &&
+ kExternalInt16ArrayCid == kExternalInt8ArrayCid + 2 &&
+ kExternalUint16ArrayCid == kExternalInt8ArrayCid + 3 &&
+ kExternalInt32ArrayCid == kExternalInt8ArrayCid + 4 &&
+ kExternalUint32ArrayCid == kExternalInt8ArrayCid + 5 &&
+ kExternalInt64ArrayCid == kExternalInt8ArrayCid + 6 &&
+ kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 &&
+ kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 &&
+ kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 &&
+ kStacktraceCid == kExternalInt8ArrayCid + 10);
+ return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid);
+}
+
} // namespace dart
#endif // VM_RAW_OBJECT_H_
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698