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 { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 void set_false_value(const Bool& value) { false_value_ = value.raw(); } | 272 void set_false_value(const Bool& value) { false_value_ = value.raw(); } |
273 | 273 |
274 RawArray* empty_array() const { return empty_array_; } | 274 RawArray* empty_array() const { return empty_array_; } |
275 void set_empty_array(const Array& value) { empty_array_ = value.raw(); } | 275 void set_empty_array(const Array& value) { empty_array_ = value.raw(); } |
276 | 276 |
277 RawContext* empty_context() const { return empty_context_; } | 277 RawContext* empty_context() const { return empty_context_; } |
278 void set_empty_context(const Context& value) { | 278 void set_empty_context(const Context& value) { |
279 empty_context_ = value.raw(); | 279 empty_context_ = value.raw(); |
280 } | 280 } |
281 | 281 |
| 282 RawInstance* stack_overflow() const { return stack_overflow_; } |
| 283 void set_stack_overflow(const Instance& value) { |
| 284 stack_overflow_ = value.raw(); |
| 285 } |
| 286 |
282 // Visit all object pointers. | 287 // Visit all object pointers. |
283 void VisitObjectPointers(ObjectPointerVisitor* visitor); | 288 void VisitObjectPointers(ObjectPointerVisitor* visitor); |
284 | 289 |
285 RawClass* GetClass(int index); | 290 RawClass* GetClass(int index); |
286 int GetClassIndex(const RawClass* raw_class); | 291 int GetClassIndex(const RawClass* raw_class); |
287 RawType* GetType(int index); | 292 RawType* GetType(int index); |
288 int GetTypeIndex(const RawType* raw_type); | 293 int GetTypeIndex(const RawType* raw_type); |
289 | 294 |
| 295 // Called to initialize objects required by the vm but which invoke |
| 296 // dart code. If an error occurs then false is returned and error |
| 297 // information is stored in sticky_error(). |
| 298 bool PreallocateObjects(); |
| 299 |
290 static void Init(Isolate* isolate); | 300 static void Init(Isolate* isolate); |
291 | 301 |
292 private: | 302 private: |
293 ObjectStore(); | 303 ObjectStore(); |
294 | 304 |
295 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } | 305 RawObject** from() { return reinterpret_cast<RawObject**>(&object_class_); } |
296 RawClass* object_class_; | 306 RawClass* object_class_; |
297 RawType* object_type_; | 307 RawType* object_type_; |
298 RawType* null_type_; | 308 RawType* null_type_; |
299 RawType* dynamic_type_; | 309 RawType* dynamic_type_; |
(...skipping 27 matching lines...) Expand all Loading... |
327 RawArray* empty_array_; | 337 RawArray* empty_array_; |
328 RawArray* symbol_table_; | 338 RawArray* symbol_table_; |
329 RawLibrary* core_library_; | 339 RawLibrary* core_library_; |
330 RawLibrary* core_impl_library_; | 340 RawLibrary* core_impl_library_; |
331 RawLibrary* native_wrappers_library_; | 341 RawLibrary* native_wrappers_library_; |
332 RawLibrary* root_library_; | 342 RawLibrary* root_library_; |
333 RawLibrary* registered_libraries_; | 343 RawLibrary* registered_libraries_; |
334 RawArray* pending_classes_; | 344 RawArray* pending_classes_; |
335 RawString* sticky_error_; | 345 RawString* sticky_error_; |
336 RawContext* empty_context_; | 346 RawContext* empty_context_; |
337 RawObject** to() { return reinterpret_cast<RawObject**>(&empty_context_); } | 347 RawInstance* stack_overflow_; |
| 348 RawObject** to() { return reinterpret_cast<RawObject**>(&stack_overflow_); } |
| 349 |
| 350 bool preallocate_objects_called_; |
338 | 351 |
339 friend class SnapshotReader; | 352 friend class SnapshotReader; |
340 | 353 |
341 DISALLOW_COPY_AND_ASSIGN(ObjectStore); | 354 DISALLOW_COPY_AND_ASSIGN(ObjectStore); |
342 }; | 355 }; |
343 | 356 |
344 } // namespace dart | 357 } // namespace dart |
345 | 358 |
346 #endif // VM_OBJECT_STORE_H_ | 359 #endif // VM_OBJECT_STORE_H_ |
OLD | NEW |