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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 object() : super() {} \ | 196 object() : super() {} \ |
197 BASE_OBJECT_IMPLEMENTATION(object, super) \ | 197 BASE_OBJECT_IMPLEMENTATION(object, super) \ |
198 | 198 |
199 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \ | 199 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \ |
200 OBJECT_IMPLEMENTATION(object, super); \ | 200 OBJECT_IMPLEMENTATION(object, super); \ |
201 const Raw##object* raw_ptr() const { \ | 201 const Raw##object* raw_ptr() const { \ |
202 ASSERT(raw() != null()); \ | 202 ASSERT(raw() != null()); \ |
203 return raw()->ptr(); \ | 203 return raw()->ptr(); \ |
204 } \ | 204 } \ |
205 SNAPSHOT_READER_SUPPORT(object) \ | 205 SNAPSHOT_READER_SUPPORT(object) \ |
206 friend class Isolate; \ | |
207 friend class StackFrame; \ | 206 friend class StackFrame; \ |
| 207 friend class Thread; \ |
208 | 208 |
209 // This macro is used to denote types that do not have a sub-type. | 209 // This macro is used to denote types that do not have a sub-type. |
210 #define FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \ | 210 #define FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \ |
211 public: /* NOLINT */ \ | 211 public: /* NOLINT */ \ |
212 void operator=(Raw##object* value) { \ | 212 void operator=(Raw##object* value) { \ |
213 raw_ = value; \ | 213 raw_ = value; \ |
214 CHECK_HANDLE(); \ | 214 CHECK_HANDLE(); \ |
215 } \ | 215 } \ |
216 void operator^=(RawObject* value) { \ | 216 void operator^=(RawObject* value) { \ |
217 raw_ = value; \ | 217 raw_ = value; \ |
218 CHECK_HANDLE(); \ | 218 CHECK_HANDLE(); \ |
219 } \ | 219 } \ |
220 private: /* NOLINT */ \ | 220 private: /* NOLINT */ \ |
221 object() : super() {} \ | 221 object() : super() {} \ |
222 BASE_OBJECT_IMPLEMENTATION(object, super) \ | 222 BASE_OBJECT_IMPLEMENTATION(object, super) \ |
223 const Raw##object* raw_ptr() const { \ | 223 const Raw##object* raw_ptr() const { \ |
224 ASSERT(raw() != null()); \ | 224 ASSERT(raw() != null()); \ |
225 return raw()->ptr(); \ | 225 return raw()->ptr(); \ |
226 } \ | 226 } \ |
227 static intptr_t NextFieldOffset() { \ | 227 static intptr_t NextFieldOffset() { \ |
228 return -kWordSize; \ | 228 return -kWordSize; \ |
229 } \ | 229 } \ |
230 SNAPSHOT_READER_SUPPORT(rettype) \ | 230 SNAPSHOT_READER_SUPPORT(rettype) \ |
231 friend class Isolate; \ | |
232 friend class StackFrame; \ | 231 friend class StackFrame; \ |
| 232 friend class Thread; \ |
233 | 233 |
234 #define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super) \ | 234 #define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super) \ |
235 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, object, super) \ | 235 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, object, super) \ |
236 | 236 |
237 #define MINT_OBJECT_IMPLEMENTATION(object, rettype, super) \ | 237 #define MINT_OBJECT_IMPLEMENTATION(object, rettype, super) \ |
238 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \ | 238 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \ |
239 | 239 |
240 class Object { | 240 class Object { |
241 public: | 241 public: |
242 virtual ~Object() { } | 242 virtual ~Object() { } |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 static Array* vm_isolate_snapshot_object_table_; | 815 static Array* vm_isolate_snapshot_object_table_; |
816 | 816 |
817 friend void ClassTable::Register(const Class& cls); | 817 friend void ClassTable::Register(const Class& cls); |
818 friend void RawObject::Validate(Isolate* isolate) const; | 818 friend void RawObject::Validate(Isolate* isolate) const; |
819 friend class Closure; | 819 friend class Closure; |
820 friend class SnapshotReader; | 820 friend class SnapshotReader; |
821 friend class OneByteString; | 821 friend class OneByteString; |
822 friend class TwoByteString; | 822 friend class TwoByteString; |
823 friend class ExternalOneByteString; | 823 friend class ExternalOneByteString; |
824 friend class ExternalTwoByteString; | 824 friend class ExternalTwoByteString; |
825 friend class Isolate; | 825 friend class Thread; |
| 826 |
826 #define REUSABLE_FRIEND_DECLARATION(name) \ | 827 #define REUSABLE_FRIEND_DECLARATION(name) \ |
827 friend class Reusable##name##HandleScope; | 828 friend class Reusable##name##HandleScope; |
828 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 829 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
829 #undef REUSABLE_FRIEND_DECLARATION | 830 #undef REUSABLE_FRIEND_DECLARATION |
830 | 831 |
831 DISALLOW_ALLOCATION(); | 832 DISALLOW_ALLOCATION(); |
832 DISALLOW_COPY_AND_ASSIGN(Object); | 833 DISALLOW_COPY_AND_ASSIGN(Object); |
833 }; | 834 }; |
834 | 835 |
835 | 836 |
(...skipping 7323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8159 | 8160 |
8160 | 8161 |
8161 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8162 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8162 intptr_t index) { | 8163 intptr_t index) { |
8163 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8164 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8164 } | 8165 } |
8165 | 8166 |
8166 } // namespace dart | 8167 } // namespace dart |
8167 | 8168 |
8168 #endif // VM_OBJECT_H_ | 8169 #endif // VM_OBJECT_H_ |
OLD | NEW |