| OLD | NEW |
| 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" |
| 11 #include "vm/snapshot.h" | 11 #include "vm/snapshot.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 // Macrobatics to define the Object hierarchy of VM implementation classes. | 15 // Macrobatics to define the Object hierarchy of VM implementation classes. |
| 16 #define CLASS_LIST_NO_OBJECT_OR_STRING(V) \ | 16 #define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \ |
| 17 V(Class) \ | 17 V(Class) \ |
| 18 V(UnresolvedClass) \ | 18 V(UnresolvedClass) \ |
| 19 V(AbstractTypeArguments) \ | 19 V(AbstractTypeArguments) \ |
| 20 V(TypeArguments) \ | 20 V(TypeArguments) \ |
| 21 V(InstantiatedTypeArguments) \ | 21 V(InstantiatedTypeArguments) \ |
| 22 V(PatchClass) \ | 22 V(PatchClass) \ |
| 23 V(Function) \ | 23 V(Function) \ |
| 24 V(ClosureData) \ | 24 V(ClosureData) \ |
| 25 V(RedirectionData) \ | 25 V(RedirectionData) \ |
| 26 V(Field) \ | 26 V(Field) \ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 53 V(TypeParameter) \ | 53 V(TypeParameter) \ |
| 54 V(BoundedType) \ | 54 V(BoundedType) \ |
| 55 V(MixinAppType) \ | 55 V(MixinAppType) \ |
| 56 V(Number) \ | 56 V(Number) \ |
| 57 V(Integer) \ | 57 V(Integer) \ |
| 58 V(Smi) \ | 58 V(Smi) \ |
| 59 V(Mint) \ | 59 V(Mint) \ |
| 60 V(Bigint) \ | 60 V(Bigint) \ |
| 61 V(Double) \ | 61 V(Double) \ |
| 62 V(Bool) \ | 62 V(Bool) \ |
| 63 V(Array) \ | |
| 64 V(ImmutableArray) \ | |
| 65 V(GrowableObjectArray) \ | 63 V(GrowableObjectArray) \ |
| 66 V(TypedData) \ | 64 V(TypedData) \ |
| 67 V(ExternalTypedData) \ | 65 V(ExternalTypedData) \ |
| 68 V(Stacktrace) \ | 66 V(Stacktrace) \ |
| 69 V(JSRegExp) \ | 67 V(JSRegExp) \ |
| 70 V(WeakProperty) \ | 68 V(WeakProperty) \ |
| 71 V(DartFunction) \ | 69 V(DartFunction) \ |
| 72 V(Float32x4) \ | 70 V(Float32x4) \ |
| 73 V(Uint32x4) \ | 71 V(Uint32x4) \ |
| 74 | 72 |
| 73 #define CLASS_LIST_ARRAYS(V) \ |
| 74 V(Array) \ |
| 75 V(ImmutableArray) \ |
| 75 | 76 |
| 76 #define CLASS_LIST_STRINGS(V) \ | 77 #define CLASS_LIST_STRINGS(V) \ |
| 77 V(String) \ | 78 V(String) \ |
| 78 V(OneByteString) \ | 79 V(OneByteString) \ |
| 79 V(TwoByteString) \ | 80 V(TwoByteString) \ |
| 80 V(ExternalOneByteString) \ | 81 V(ExternalOneByteString) \ |
| 81 V(ExternalTwoByteString) | 82 V(ExternalTwoByteString) |
| 82 | 83 |
| 83 #define CLASS_LIST_TYPED_DATA(V) \ | 84 #define CLASS_LIST_TYPED_DATA(V) \ |
| 84 V(Int8Array) \ | 85 V(Int8Array) \ |
| 85 V(Uint8Array) \ | 86 V(Uint8Array) \ |
| 86 V(Uint8ClampedArray) \ | 87 V(Uint8ClampedArray) \ |
| 87 V(Int16Array) \ | 88 V(Int16Array) \ |
| 88 V(Uint16Array) \ | 89 V(Uint16Array) \ |
| 89 V(Int32Array) \ | 90 V(Int32Array) \ |
| 90 V(Uint32Array) \ | 91 V(Uint32Array) \ |
| 91 V(Int64Array) \ | 92 V(Int64Array) \ |
| 92 V(Uint64Array) \ | 93 V(Uint64Array) \ |
| 93 V(Float32Array) \ | 94 V(Float32Array) \ |
| 94 V(Float64Array) \ | 95 V(Float64Array) \ |
| 95 V(Float32x4Array) \ | 96 V(Float32x4Array) \ |
| 96 | 97 |
| 97 #define CLASS_LIST_FOR_HANDLES(V) \ | 98 #define CLASS_LIST_FOR_HANDLES(V) \ |
| 98 CLASS_LIST_NO_OBJECT_OR_STRING(V) \ | 99 CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \ |
| 100 V(Array) \ |
| 99 V(String) | 101 V(String) |
| 100 | 102 |
| 101 #define CLASS_LIST_NO_OBJECT(V) \ | 103 #define CLASS_LIST_NO_OBJECT(V) \ |
| 102 CLASS_LIST_NO_OBJECT_OR_STRING(V) \ | 104 CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \ |
| 105 CLASS_LIST_ARRAYS(V) \ |
| 103 CLASS_LIST_STRINGS(V) | 106 CLASS_LIST_STRINGS(V) |
| 104 | 107 |
| 105 #define CLASS_LIST(V) \ | 108 #define CLASS_LIST(V) \ |
| 106 V(Object) \ | 109 V(Object) \ |
| 107 CLASS_LIST_NO_OBJECT(V) | 110 CLASS_LIST_NO_OBJECT(V) |
| 108 | 111 |
| 109 | 112 |
| 110 // Forward declarations. | 113 // Forward declarations. |
| 111 class Isolate; | 114 class Isolate; |
| 112 #define DEFINE_FORWARD_DECLARATION(clazz) \ | 115 #define DEFINE_FORWARD_DECLARATION(clazz) \ |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 kExternalOneByteStringCid == kStringCid + 3 && | 1598 kExternalOneByteStringCid == kStringCid + 3 && |
| 1596 kExternalTwoByteStringCid == kStringCid + 4); | 1599 kExternalTwoByteStringCid == kStringCid + 4); |
| 1597 return (index == kExternalOneByteStringCid || | 1600 return (index == kExternalOneByteStringCid || |
| 1598 index == kExternalTwoByteStringCid); | 1601 index == kExternalTwoByteStringCid); |
| 1599 } | 1602 } |
| 1600 | 1603 |
| 1601 | 1604 |
| 1602 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { | 1605 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { |
| 1603 // Make sure this function is updated when new builtin List types are added. | 1606 // Make sure this function is updated when new builtin List types are added. |
| 1604 ASSERT(kImmutableArrayCid == kArrayCid + 1 && | 1607 ASSERT(kImmutableArrayCid == kArrayCid + 1 && |
| 1605 kGrowableObjectArrayCid == kArrayCid + 2 && | 1608 kTypedDataCid == kGrowableObjectArrayCid + 1); |
| 1606 kTypedDataCid == kArrayCid + 3); | 1609 return ((index >= kArrayCid && index < kImmutableArrayCid) || |
| 1607 return ((index >= kArrayCid && index < kTypedDataCid) || | 1610 (index >= kGrowableObjectArrayCid && index < kTypedDataCid) || |
| 1608 IsTypedDataClassId(index) || | 1611 IsTypedDataClassId(index) || |
| 1609 IsTypedDataViewClassId(index) || | 1612 IsTypedDataViewClassId(index) || |
| 1610 IsExternalTypedDataClassId(index)); | 1613 IsExternalTypedDataClassId(index)); |
| 1611 } | 1614 } |
| 1612 | 1615 |
| 1613 | 1616 |
| 1614 inline bool RawObject::IsTypedDataClassId(intptr_t index) { | 1617 inline bool RawObject::IsTypedDataClassId(intptr_t index) { |
| 1615 // Make sure this is updated when new TypedData types are added. | 1618 // Make sure this is updated when new TypedData types are added. |
| 1616 ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && | 1619 ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && |
| 1617 kTypedDataUint8ClampedArrayCid == kTypedDataInt8ArrayCid + 2 && | 1620 kTypedDataUint8ClampedArrayCid == kTypedDataInt8ArrayCid + 2 && |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 // Make sure this is updated when new TypedData types are added. | 1687 // Make sure this is updated when new TypedData types are added. |
| 1685 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); | 1688 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); |
| 1686 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); | 1689 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); |
| 1687 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); | 1690 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); |
| 1688 return (kNullCid - kTypedDataInt8ArrayCid); | 1691 return (kNullCid - kTypedDataInt8ArrayCid); |
| 1689 } | 1692 } |
| 1690 | 1693 |
| 1691 } // namespace dart | 1694 } // namespace dart |
| 1692 | 1695 |
| 1693 #endif // VM_RAW_OBJECT_H_ | 1696 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |