| 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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 Snapshot::Kind); \ | 123 Snapshot::Kind); \ |
| 124 friend class SnapshotReader; \ | 124 friend class SnapshotReader; \ |
| 125 | 125 |
| 126 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \ | 126 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \ |
| 127 OBJECT_IMPLEMENTATION(object, super); \ | 127 OBJECT_IMPLEMENTATION(object, super); \ |
| 128 Raw##object* raw_ptr() const { \ | 128 Raw##object* raw_ptr() const { \ |
| 129 ASSERT(raw() != null()); \ | 129 ASSERT(raw() != null()); \ |
| 130 return raw()->ptr(); \ | 130 return raw()->ptr(); \ |
| 131 } \ | 131 } \ |
| 132 SNAPSHOT_READER_SUPPORT(object) \ | 132 SNAPSHOT_READER_SUPPORT(object) \ |
| 133 friend class DartFrame; \ |
| 133 | 134 |
| 134 class Object { | 135 class Object { |
| 135 public: | 136 public: |
| 136 // Index for Singleton internal VM classes, | 137 // Index for Singleton internal VM classes, |
| 137 // this index is used in snapshots to refer to these classes directly. | 138 // this index is used in snapshots to refer to these classes directly. |
| 138 enum { | 139 enum { |
| 139 kNullObject = 0, | 140 kNullObject = 0, |
| 140 kSentinelObject, | 141 kSentinelObject, |
| 141 kClassClass, | 142 kClassClass, |
| 142 kNullClass, | 143 kNullClass, |
| (...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 bool IsObject(intptr_t offset) const { | 2070 bool IsObject(intptr_t offset) const { |
| 2070 return InRange(offset) && GetBit(offset); | 2071 return InRange(offset) && GetBit(offset); |
| 2071 } | 2072 } |
| 2072 uword PC() const { return raw_ptr()->pc_; } | 2073 uword PC() const { return raw_ptr()->pc_; } |
| 2073 void SetPC(uword value) const { raw_ptr()->pc_ = value; } | 2074 void SetPC(uword value) const { raw_ptr()->pc_ = value; } |
| 2074 | 2075 |
| 2075 RawCode* GetCode() const { return raw_ptr()->code_; } | 2076 RawCode* GetCode() const { return raw_ptr()->code_; } |
| 2076 void SetCode(const Code& code) const; | 2077 void SetCode(const Code& code) const; |
| 2077 | 2078 |
| 2078 // Return the offset of the highest stack slot that has an object. | 2079 // Return the offset of the highest stack slot that has an object. |
| 2079 intptr_t Maximum() const; | 2080 intptr_t MaximumBitOffset() const { return raw_ptr()->max_set_bit_offset_; } |
| 2080 | 2081 |
| 2081 // Return the offset of the lowest stack slot that has an object. | 2082 // Return the offset of the lowest stack slot that has an object. |
| 2082 intptr_t Minimum() const; | 2083 intptr_t MinimumBitOffset() const { return raw_ptr()->min_set_bit_offset_; } |
| 2083 | 2084 |
| 2084 static intptr_t InstanceSize() { | 2085 static intptr_t InstanceSize() { |
| 2085 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); | 2086 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); |
| 2086 return 0; | 2087 return 0; |
| 2087 } | 2088 } |
| 2088 static intptr_t InstanceSize(intptr_t size) { | 2089 static intptr_t InstanceSize(intptr_t size) { |
| 2089 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize)); | 2090 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize)); |
| 2090 } | 2091 } |
| 2091 static RawStackmap* New(uword pc, const Code& code, BitmapBuilder* bmap); | 2092 static RawStackmap* New(uword pc, BitmapBuilder* bmap); |
| 2092 | 2093 |
| 2093 private: | 2094 private: |
| 2094 inline intptr_t SizeInBits() const; | 2095 inline intptr_t SizeInBits() const; |
| 2095 | 2096 |
| 2097 void SetMinBitOffset(intptr_t value) const { |
| 2098 raw_ptr()->min_set_bit_offset_ = value; |
| 2099 } |
| 2100 void SetMaxBitOffset(intptr_t value) const { |
| 2101 raw_ptr()->max_set_bit_offset_ = value; |
| 2102 } |
| 2103 |
| 2096 bool InRange(intptr_t offset) const { return offset < SizeInBits(); } | 2104 bool InRange(intptr_t offset) const { return offset < SizeInBits(); } |
| 2097 | 2105 |
| 2098 bool GetBit(intptr_t bit_offset) const; | 2106 bool GetBit(intptr_t bit_offset) const; |
| 2099 void SetBit(intptr_t bit_offset, bool value) const; | 2107 void SetBit(intptr_t bit_offset, bool value) const; |
| 2100 | 2108 |
| 2101 void set_bitmap_size_in_bytes(intptr_t value) const; | 2109 void set_bitmap_size_in_bytes(intptr_t value) const; |
| 2102 void set_pc(uword value) const; | |
| 2103 void set_code(const Code& code) const; | |
| 2104 | 2110 |
| 2105 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); | 2111 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); |
| 2106 friend class Class; | 2112 friend class Class; |
| 2107 friend class BitmapBuilder; | 2113 friend class BitmapBuilder; |
| 2108 }; | 2114 }; |
| 2109 | 2115 |
| 2110 | 2116 |
| 2111 class ExceptionHandlers : public Object { | 2117 class ExceptionHandlers : public Object { |
| 2112 public: | 2118 public: |
| 2113 intptr_t Length() const; | 2119 intptr_t Length() const; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 return raw_ptr()->pc_descriptors_; | 2195 return raw_ptr()->pc_descriptors_; |
| 2190 } | 2196 } |
| 2191 void set_pc_descriptors(const PcDescriptors& descriptors) const { | 2197 void set_pc_descriptors(const PcDescriptors& descriptors) const { |
| 2192 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); | 2198 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); |
| 2193 } | 2199 } |
| 2194 | 2200 |
| 2195 RawArray* stackmaps() const { | 2201 RawArray* stackmaps() const { |
| 2196 return raw_ptr()->stackmaps_; | 2202 return raw_ptr()->stackmaps_; |
| 2197 } | 2203 } |
| 2198 void set_stackmaps(const Array& maps) const; | 2204 void set_stackmaps(const Array& maps) const; |
| 2205 RawStackmap* GetStackmap(uword pc, Array* stackmaps, Stackmap* map) const; |
| 2199 | 2206 |
| 2200 RawLocalVarDescriptors* var_descriptors() const { | 2207 RawLocalVarDescriptors* var_descriptors() const { |
| 2201 return raw_ptr()->var_descriptors_; | 2208 return raw_ptr()->var_descriptors_; |
| 2202 } | 2209 } |
| 2203 void set_var_descriptors(const LocalVarDescriptors& value) const { | 2210 void set_var_descriptors(const LocalVarDescriptors& value) const { |
| 2204 StorePointer(&raw_ptr()->var_descriptors_, value.raw()); | 2211 StorePointer(&raw_ptr()->var_descriptors_, value.raw()); |
| 2205 } | 2212 } |
| 2206 | 2213 |
| 2207 RawExceptionHandlers* exception_handlers() const { | 2214 RawExceptionHandlers* exception_handlers() const { |
| 2208 return raw_ptr()->exception_handlers_; | 2215 return raw_ptr()->exception_handlers_; |
| (...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3966 } | 3973 } |
| 3967 | 3974 |
| 3968 | 3975 |
| 3969 intptr_t Stackmap::SizeInBits() const { | 3976 intptr_t Stackmap::SizeInBits() const { |
| 3970 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); | 3977 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); |
| 3971 } | 3978 } |
| 3972 | 3979 |
| 3973 } // namespace dart | 3980 } // namespace dart |
| 3974 | 3981 |
| 3975 #endif // VM_OBJECT_H_ | 3982 #endif // VM_OBJECT_H_ |
| OLD | NEW |