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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // Class Id predicates. 333 // Class Id predicates.
334 static bool IsErrorClassId(intptr_t index); 334 static bool IsErrorClassId(intptr_t index);
335 static bool IsNumberClassId(intptr_t index); 335 static bool IsNumberClassId(intptr_t index);
336 static bool IsIntegerClassId(intptr_t index); 336 static bool IsIntegerClassId(intptr_t index);
337 static bool IsStringClassId(intptr_t index); 337 static bool IsStringClassId(intptr_t index);
338 static bool IsOneByteStringClassId(intptr_t index); 338 static bool IsOneByteStringClassId(intptr_t index);
339 static bool IsTwoByteStringClassId(intptr_t index); 339 static bool IsTwoByteStringClassId(intptr_t index);
340 static bool IsExternalStringClassId(intptr_t index); 340 static bool IsExternalStringClassId(intptr_t index);
341 static bool IsBuiltinListClassId(intptr_t index); 341 static bool IsBuiltinListClassId(intptr_t index);
342 static bool IsByteArrayClassId(intptr_t index); 342 static bool IsByteArrayClassId(intptr_t index);
343 static bool IsExternalByteArrayClassId(intptr_t index);
343 344
344 protected: 345 protected:
345 uword tags_; // Various object tags (bits). 346 uword tags_; // Various object tags (bits).
346 347
347 private: 348 private:
348 class FreeBit : public BitField<bool, kFreeBit, 1> {}; 349 class FreeBit : public BitField<bool, kFreeBit, 1> {};
349 350
350 class MarkBit : public BitField<bool, kMarkBit, 1> {}; 351 class MarkBit : public BitField<bool, kMarkBit, 1> {};
351 352
352 class WatchedBit : public BitField<bool, kWatchedBit, 1> {}; 353 class WatchedBit : public BitField<bool, kWatchedBit, 1> {};
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 kExternalInt32ArrayCid == kByteArrayCid + 15 && 1605 kExternalInt32ArrayCid == kByteArrayCid + 15 &&
1605 kExternalUint32ArrayCid == kByteArrayCid + 16 && 1606 kExternalUint32ArrayCid == kByteArrayCid + 16 &&
1606 kExternalInt64ArrayCid == kByteArrayCid + 17 && 1607 kExternalInt64ArrayCid == kByteArrayCid + 17 &&
1607 kExternalUint64ArrayCid == kByteArrayCid + 18 && 1608 kExternalUint64ArrayCid == kByteArrayCid + 18 &&
1608 kExternalFloat32ArrayCid == kByteArrayCid + 19 && 1609 kExternalFloat32ArrayCid == kByteArrayCid + 19 &&
1609 kExternalFloat64ArrayCid == kByteArrayCid + 20 && 1610 kExternalFloat64ArrayCid == kByteArrayCid + 20 &&
1610 kStacktraceCid == kByteArrayCid + 21); 1611 kStacktraceCid == kByteArrayCid + 21);
1611 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); 1612 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
1612 } 1613 }
1613 1614
1615 inline bool RawObject::IsExternalByteArrayClassId(intptr_t index) {
1616 // Make sure this function is updated when new ByteArray types are added.
1617 ASSERT(kExternalUint8ArrayCid == kExternalInt8ArrayCid + 1 &&
1618 kExternalInt16ArrayCid == kExternalInt8ArrayCid + 2 &&
1619 kExternalUint16ArrayCid == kExternalInt8ArrayCid + 3 &&
1620 kExternalInt32ArrayCid == kExternalInt8ArrayCid + 4 &&
1621 kExternalUint32ArrayCid == kExternalInt8ArrayCid + 5 &&
1622 kExternalInt64ArrayCid == kExternalInt8ArrayCid + 6 &&
1623 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 &&
1624 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 &&
1625 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 &&
1626 kStacktraceCid == kExternalInt8ArrayCid + 10);
1627 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid);
1628 }
1629
1614 } // namespace dart 1630 } // namespace dart
1615 1631
1616 #endif // VM_RAW_OBJECT_H_ 1632 #endif // VM_RAW_OBJECT_H_
OLDNEW
« 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