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

Side by Side Diff: runtime/vm/raw_object.h

Issue 10574006: Ensure the ByteArray subtypes are known to implement List. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 return (index == kExternalOneByteString || 1475 return (index == kExternalOneByteString ||
1476 index == kExternalTwoByteString || 1476 index == kExternalTwoByteString ||
1477 index == kExternalFourByteString); 1477 index == kExternalFourByteString);
1478 } 1478 }
1479 1479
1480 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { 1480 inline bool RawObject::IsBuiltinListClassId(intptr_t index) {
1481 // Make sure this function is updated when new builtin List types are added. 1481 // Make sure this function is updated when new builtin List types are added.
1482 ASSERT(kImmutableArray == kArray + 1 && 1482 ASSERT(kImmutableArray == kArray + 1 &&
1483 kGrowableObjectArray == kArray + 2 && 1483 kGrowableObjectArray == kArray + 2 &&
1484 kByteArray == kArray + 3); 1484 kByteArray == kArray + 3);
1485 return (index >= kArray && index < kByteArray); 1485 return (index >= kArray && index < kByteArray) || IsByteArrayClassId(index);
1486 } 1486 }
1487 1487
1488 inline bool RawObject::IsByteArrayClassId(intptr_t index) { 1488 inline bool RawObject::IsByteArrayClassId(intptr_t index) {
1489 // Make sure this function is updated when new ByteArray types are added. 1489 // Make sure this function is updated when new ByteArray types are added.
1490 ASSERT(kInt8Array == kByteArray + 1 && 1490 ASSERT(kInt8Array == kByteArray + 1 &&
1491 kUint8Array == kByteArray + 2 && 1491 kUint8Array == kByteArray + 2 &&
1492 kInt16Array == kByteArray + 3 && 1492 kInt16Array == kByteArray + 3 &&
1493 kUint16Array == kByteArray + 4 && 1493 kUint16Array == kByteArray + 4 &&
1494 kInt32Array == kByteArray + 5 && 1494 kInt32Array == kByteArray + 5 &&
1495 kUint32Array == kByteArray + 6 && 1495 kUint32Array == kByteArray + 6 &&
(...skipping 11 matching lines...) Expand all
1507 kExternalUint64Array == kByteArray + 18 && 1507 kExternalUint64Array == kByteArray + 18 &&
1508 kExternalFloat32Array == kByteArray + 19 && 1508 kExternalFloat32Array == kByteArray + 19 &&
1509 kExternalFloat64Array == kByteArray + 20 && 1509 kExternalFloat64Array == kByteArray + 20 &&
1510 kClosure == kByteArray + 21); 1510 kClosure == kByteArray + 21);
1511 return (index >= kByteArray && index <= kClosure); 1511 return (index >= kByteArray && index <= kClosure);
1512 } 1512 }
1513 1513
1514 } // namespace dart 1514 } // namespace dart
1515 1515
1516 #endif // VM_RAW_OBJECT_H_ 1516 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698