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" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 kTypedData##clazz##ViewCid, | 143 kTypedData##clazz##ViewCid, |
144 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 144 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
145 kByteDataViewCid, | 145 kByteDataViewCid, |
146 #undef DEFINE_OBJECT_KIND | 146 #undef DEFINE_OBJECT_KIND |
147 | 147 |
148 #define DEFINE_OBJECT_KIND(clazz) \ | 148 #define DEFINE_OBJECT_KIND(clazz) \ |
149 kExternalTypedData##clazz##Cid, | 149 kExternalTypedData##clazz##Cid, |
150 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) | 150 CLASS_LIST_TYPED_DATA(DEFINE_OBJECT_KIND) |
151 #undef DEFINE_OBJECT_KIND | 151 #undef DEFINE_OBJECT_KIND |
152 | 152 |
| 153 kByteBufferCid, |
| 154 |
153 // The following entries do not describe a predefined class, but instead | 155 // The following entries do not describe a predefined class, but instead |
154 // are class indexes for pre-allocated instance (Null, dynamic and Void). | 156 // are class indexes for pre-allocated instance (Null, dynamic and Void). |
155 kNullCid, | 157 kNullCid, |
156 kDynamicCid, | 158 kDynamicCid, |
157 kVoidCid, | 159 kVoidCid, |
158 | 160 |
159 // The following entry does not describe a real class, but instead it is an | 161 // The following entry does not describe a real class, but instead it is an |
160 // id which is used to identify free list elements in the heap. | 162 // id which is used to identify free list elements in the heap. |
161 kFreeListElement, | 163 kFreeListElement, |
162 | 164 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 446 |
445 intptr_t SizeFromClass() const; | 447 intptr_t SizeFromClass() const; |
446 | 448 |
447 intptr_t GetClassId() const { | 449 intptr_t GetClassId() const { |
448 uword tags = ptr()->tags_; | 450 uword tags = ptr()->tags_; |
449 return ClassIdTag::decode(tags); | 451 return ClassIdTag::decode(tags); |
450 } | 452 } |
451 | 453 |
452 friend class Api; | 454 friend class Api; |
453 friend class Array; | 455 friend class Array; |
| 456 friend class ByteBuffer; |
454 friend class Code; | 457 friend class Code; |
455 friend class FreeListElement; | 458 friend class FreeListElement; |
456 friend class GCMarker; | 459 friend class GCMarker; |
457 friend class ExternalTypedData; | 460 friend class ExternalTypedData; |
458 friend class ForwardList; | 461 friend class ForwardList; |
459 friend class Heap; | 462 friend class Heap; |
460 friend class HeapMapAsJSONVisitor; | 463 friend class HeapMapAsJSONVisitor; |
461 friend class ClassStatsVisitor; | 464 friend class ClassStatsVisitor; |
462 friend class MarkingVisitor; | 465 friend class MarkingVisitor; |
463 friend class Object; | 466 friend class Object; |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 (kExternalTypedDataFloat32ArrayCid == | 1894 (kExternalTypedDataFloat32ArrayCid == |
1892 kExternalTypedDataInt8ArrayCid + 9) && | 1895 kExternalTypedDataInt8ArrayCid + 9) && |
1893 (kExternalTypedDataFloat64ArrayCid == | 1896 (kExternalTypedDataFloat64ArrayCid == |
1894 kExternalTypedDataInt8ArrayCid + 10) && | 1897 kExternalTypedDataInt8ArrayCid + 10) && |
1895 (kExternalTypedDataFloat32x4ArrayCid == | 1898 (kExternalTypedDataFloat32x4ArrayCid == |
1896 kExternalTypedDataInt8ArrayCid + 11) && | 1899 kExternalTypedDataInt8ArrayCid + 11) && |
1897 (kExternalTypedDataInt32x4ArrayCid == | 1900 (kExternalTypedDataInt32x4ArrayCid == |
1898 kExternalTypedDataInt8ArrayCid + 12) && | 1901 kExternalTypedDataInt8ArrayCid + 12) && |
1899 (kExternalTypedDataFloat64x2ArrayCid == | 1902 (kExternalTypedDataFloat64x2ArrayCid == |
1900 kExternalTypedDataInt8ArrayCid + 13) && | 1903 kExternalTypedDataInt8ArrayCid + 13) && |
1901 (kNullCid == kExternalTypedDataInt8ArrayCid + 14)); | 1904 (kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14)); |
1902 return (index >= kExternalTypedDataInt8ArrayCid && | 1905 return (index >= kExternalTypedDataInt8ArrayCid && |
1903 index <= kExternalTypedDataFloat64x2ArrayCid); | 1906 index <= kExternalTypedDataFloat64x2ArrayCid); |
1904 } | 1907 } |
1905 | 1908 |
1906 | 1909 |
1907 inline bool RawObject::IsInternalVMdefinedClassId(intptr_t index) { | 1910 inline bool RawObject::IsInternalVMdefinedClassId(intptr_t index) { |
1908 return ((index < kNumPredefinedCids) && | 1911 return ((index < kNumPredefinedCids) && |
1909 !RawObject::IsTypedDataViewClassId(index)); | 1912 !RawObject::IsTypedDataViewClassId(index)); |
1910 } | 1913 } |
1911 | 1914 |
(...skipping 19 matching lines...) Expand all Loading... |
1931 (index == kBigintCid) || | 1934 (index == kBigintCid) || |
1932 (index == kJSRegExpCid); | 1935 (index == kJSRegExpCid); |
1933 } | 1936 } |
1934 | 1937 |
1935 | 1938 |
1936 inline intptr_t RawObject::NumberOfTypedDataClasses() { | 1939 inline intptr_t RawObject::NumberOfTypedDataClasses() { |
1937 // Make sure this is updated when new TypedData types are added. | 1940 // Make sure this is updated when new TypedData types are added. |
1938 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 1941 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
1939 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 1942 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
1940 kTypedDataInt8ArrayViewCid + 15); | 1943 kTypedDataInt8ArrayViewCid + 15); |
1941 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); | 1944 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 1945 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
1942 return (kNullCid - kTypedDataInt8ArrayCid); | 1946 return (kNullCid - kTypedDataInt8ArrayCid); |
1943 } | 1947 } |
1944 | 1948 |
1945 } // namespace dart | 1949 } // namespace dart |
1946 | 1950 |
1947 #endif // VM_RAW_OBJECT_H_ | 1951 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |