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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 V(GrowableObjectArray) \ | 62 V(GrowableObjectArray) \ |
63 V(TypedData) \ | 63 V(TypedData) \ |
64 V(ExternalTypedData) \ | 64 V(ExternalTypedData) \ |
65 V(Stacktrace) \ | 65 V(Stacktrace) \ |
66 V(JSRegExp) \ | 66 V(JSRegExp) \ |
67 V(WeakProperty) \ | 67 V(WeakProperty) \ |
68 V(MirrorReference) \ | 68 V(MirrorReference) \ |
69 V(Float32x4) \ | 69 V(Float32x4) \ |
70 V(Int32x4) \ | 70 V(Int32x4) \ |
71 V(Float64x2) \ | 71 V(Float64x2) \ |
| 72 V(UserTag) \ |
72 | 73 |
73 #define CLASS_LIST_ARRAYS(V) \ | 74 #define CLASS_LIST_ARRAYS(V) \ |
74 V(Array) \ | 75 V(Array) \ |
75 V(ImmutableArray) \ | 76 V(ImmutableArray) \ |
76 | 77 |
77 #define CLASS_LIST_STRINGS(V) \ | 78 #define CLASS_LIST_STRINGS(V) \ |
78 V(String) \ | 79 V(String) \ |
79 V(OneByteString) \ | 80 V(OneByteString) \ |
80 V(TwoByteString) \ | 81 V(TwoByteString) \ |
81 V(ExternalOneByteString) \ | 82 V(ExternalOneByteString) \ |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 RawObject** from() { | 1575 RawObject** from() { |
1575 return reinterpret_cast<RawObject**>(&ptr()->referent_); | 1576 return reinterpret_cast<RawObject**>(&ptr()->referent_); |
1576 } | 1577 } |
1577 RawObject* referent_; | 1578 RawObject* referent_; |
1578 RawObject** to() { | 1579 RawObject** to() { |
1579 return reinterpret_cast<RawObject**>(&ptr()->referent_); | 1580 return reinterpret_cast<RawObject**>(&ptr()->referent_); |
1580 } | 1581 } |
1581 }; | 1582 }; |
1582 | 1583 |
1583 | 1584 |
| 1585 // UserTag are used by the profiler to track Dart script state. |
| 1586 class RawUserTag : public RawInstance { |
| 1587 RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag); |
| 1588 |
| 1589 RawObject** from() { |
| 1590 return reinterpret_cast<RawObject**>(&ptr()->label_); |
| 1591 } |
| 1592 |
| 1593 RawString* label_; |
| 1594 |
| 1595 RawObject** to() { |
| 1596 return reinterpret_cast<RawObject**>(&ptr()->label_); |
| 1597 } |
| 1598 |
| 1599 // Isolate unique tag. |
| 1600 uword tag_; |
| 1601 |
| 1602 friend class SnapshotReader; |
| 1603 |
| 1604 public: |
| 1605 uword tag() const { return tag_; } |
| 1606 }; |
| 1607 |
1584 // Class Id predicates. | 1608 // Class Id predicates. |
1585 | 1609 |
1586 inline bool RawObject::IsErrorClassId(intptr_t index) { | 1610 inline bool RawObject::IsErrorClassId(intptr_t index) { |
1587 // Make sure this function is updated when new Error types are added. | 1611 // Make sure this function is updated when new Error types are added. |
1588 ASSERT(kApiErrorCid == kErrorCid + 1 && | 1612 ASSERT(kApiErrorCid == kErrorCid + 1 && |
1589 kLanguageErrorCid == kErrorCid + 2 && | 1613 kLanguageErrorCid == kErrorCid + 2 && |
1590 kUnhandledExceptionCid == kErrorCid + 3 && | 1614 kUnhandledExceptionCid == kErrorCid + 3 && |
1591 kUnwindErrorCid == kErrorCid + 4 && | 1615 kUnwindErrorCid == kErrorCid + 4 && |
1592 kInstanceCid == kErrorCid + 5); | 1616 kInstanceCid == kErrorCid + 5); |
1593 return (index >= kErrorCid && index < kInstanceCid); | 1617 return (index >= kErrorCid && index < kInstanceCid); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 // Make sure this is updated when new TypedData types are added. | 1805 // Make sure this is updated when new TypedData types are added. |
1782 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 1806 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
1783 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); | 1807 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); |
1784 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); | 1808 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); |
1785 return (kNullCid - kTypedDataInt8ArrayCid); | 1809 return (kNullCid - kTypedDataInt8ArrayCid); |
1786 } | 1810 } |
1787 | 1811 |
1788 } // namespace dart | 1812 } // namespace dart |
1789 | 1813 |
1790 #endif // VM_RAW_OBJECT_H_ | 1814 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |