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