| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_STORE_H_ | 5 #ifndef VM_OBJECT_STORE_H_ |
| 6 #define VM_OBJECT_STORE_H_ | 6 #define VM_OBJECT_STORE_H_ |
| 7 | 7 |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // Forward declarations. | 12 // Forward declarations. |
| 13 class Isolate; | 13 class Isolate; |
| 14 class ObjectPointerVisitor; | 14 class ObjectPointerVisitor; |
| 15 | 15 |
| 16 // The object store is a per isolate instance which stores references to | 16 // The object store is a per isolate instance which stores references to |
| 17 // objects used by the VM. | 17 // objects used by the VM. |
| 18 // TODO(iposva): Move the actual store into the object heap for quick handling | 18 // TODO(iposva): Move the actual store into the object heap for quick handling |
| 19 // by snapshots eventually. | 19 // by snapshots eventually. |
| 20 class ObjectStore { | 20 class ObjectStore { |
| 21 public: | 21 public: |
| 22 // Index for objects/types/classes stored in the object store, | 22 // Index for objects/types/classes stored in the object store, |
| 23 // this index is used in snapshots to refer to classes or objects directly. | 23 // this index is used in snapshots to refer to classes or objects directly. |
| 24 enum { | 24 enum { |
| 25 kTrueValue = Object::kMaxId, | 25 kTrueValue = Object::kMaxId, |
| 26 kFalseValue, | 26 kFalseValue, |
| 27 kObjectType, | 27 kObjectType, |
| 28 kNullType, | 28 kNullType, |
| 29 kVarType, | 29 kDynamicType, |
| 30 kVoidType, | 30 kVoidType, |
| 31 kFunctionInterface, | 31 kFunctionInterface, |
| 32 kNumberInterface, | 32 kNumberInterface, |
| 33 kDoubleInterface, | 33 kDoubleInterface, |
| 34 kIntInterface, | 34 kIntInterface, |
| 35 kBoolInterface, | 35 kBoolInterface, |
| 36 kStringInterface, | 36 kStringInterface, |
| 37 kObjectClass, | 37 kObjectClass, |
| 38 kSmiClass, | 38 kSmiClass, |
| 39 kMintClass, | 39 kMintClass, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 59 static intptr_t object_class_offset() { | 59 static intptr_t object_class_offset() { |
| 60 return OFFSET_OF(ObjectStore, object_class_); | 60 return OFFSET_OF(ObjectStore, object_class_); |
| 61 } | 61 } |
| 62 | 62 |
| 63 RawType* object_type() const { return object_type_; } | 63 RawType* object_type() const { return object_type_; } |
| 64 void set_object_type(const Type& value) { object_type_ = value.raw(); } | 64 void set_object_type(const Type& value) { object_type_ = value.raw(); } |
| 65 | 65 |
| 66 RawType* null_type() const { return null_type_; } | 66 RawType* null_type() const { return null_type_; } |
| 67 void set_null_type(const Type& value) { null_type_ = value.raw(); } | 67 void set_null_type(const Type& value) { null_type_ = value.raw(); } |
| 68 | 68 |
| 69 RawType* var_type() const { return var_type_; } | 69 RawType* dynamic_type() const { return dynamic_type_; } |
| 70 void set_var_type(const Type& value) { var_type_ = value.raw(); } | 70 void set_dynamic_type(const Type& value) { dynamic_type_ = value.raw(); } |
| 71 | 71 |
| 72 RawType* void_type() const { return void_type_; } | 72 RawType* void_type() const { return void_type_; } |
| 73 void set_void_type(const Type& value) { void_type_ = value.raw(); } | 73 void set_void_type(const Type& value) { void_type_ = value.raw(); } |
| 74 | 74 |
| 75 RawType* function_interface() const { return function_interface_; } | 75 RawType* function_interface() const { return function_interface_; } |
| 76 void set_function_interface(const Type& value) { | 76 void set_function_interface(const Type& value) { |
| 77 function_interface_ = value.raw(); | 77 function_interface_ = value.raw(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 RawType* number_interface() const { return number_interface_; } | 80 RawType* number_interface() const { return number_interface_; } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 static void Init(Isolate* isolate); | 233 static void Init(Isolate* isolate); |
| 234 | 234 |
| 235 private: | 235 private: |
| 236 ObjectStore(); | 236 ObjectStore(); |
| 237 | 237 |
| 238 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } | 238 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } |
| 239 RawClass* object_class_; | 239 RawClass* object_class_; |
| 240 RawType* object_type_; | 240 RawType* object_type_; |
| 241 RawType* null_type_; | 241 RawType* null_type_; |
| 242 RawType* var_type_; | 242 RawType* dynamic_type_; |
| 243 RawType* void_type_; | 243 RawType* void_type_; |
| 244 RawType* function_interface_; | 244 RawType* function_interface_; |
| 245 RawType* number_interface_; | 245 RawType* number_interface_; |
| 246 RawType* int_interface_; | 246 RawType* int_interface_; |
| 247 RawClass* smi_class_; | 247 RawClass* smi_class_; |
| 248 RawClass* mint_class_; | 248 RawClass* mint_class_; |
| 249 RawClass* bigint_class_; | 249 RawClass* bigint_class_; |
| 250 RawType* double_interface_; | 250 RawType* double_interface_; |
| 251 RawClass* double_class_; | 251 RawClass* double_class_; |
| 252 RawType* string_interface_; | 252 RawType* string_interface_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 274 RawObject** to() { return reinterpret_cast<RawObject**>(&empty_context_); } | 274 RawObject** to() { return reinterpret_cast<RawObject**>(&empty_context_); } |
| 275 | 275 |
| 276 friend class SnapshotReader; | 276 friend class SnapshotReader; |
| 277 | 277 |
| 278 DISALLOW_COPY_AND_ASSIGN(ObjectStore); | 278 DISALLOW_COPY_AND_ASSIGN(ObjectStore); |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 } // namespace dart | 281 } // namespace dart |
| 282 | 282 |
| 283 #endif // VM_OBJECT_STORE_H_ | 283 #endif // VM_OBJECT_STORE_H_ |
| OLD | NEW |