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_SNAPSHOT_H_ | 5 #ifndef VM_SNAPSHOT_H_ |
6 #define VM_SNAPSHOT_H_ | 6 #define VM_SNAPSHOT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 RawGrowableObjectArray* NewGrowableObjectArray(); | 286 RawGrowableObjectArray* NewGrowableObjectArray(); |
287 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); | 287 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); |
288 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); | 288 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); |
289 RawFloat64x2* NewFloat64x2(double v0, double v1); | 289 RawFloat64x2* NewFloat64x2(double v0, double v1); |
290 RawApiError* NewApiError(); | 290 RawApiError* NewApiError(); |
291 RawLanguageError* NewLanguageError(); | 291 RawLanguageError* NewLanguageError(); |
292 RawObject* NewInteger(int64_t value); | 292 RawObject* NewInteger(int64_t value); |
293 RawStacktrace* NewStacktrace(); | 293 RawStacktrace* NewStacktrace(); |
294 | 294 |
295 private: | 295 private: |
296 class BackRefNode : public ZoneAllocated { | 296 class BackRefNode : public ValueObject { |
297 public: | 297 public: |
298 BackRefNode(Object* reference, DeserializeState state) | 298 BackRefNode(Object* reference, DeserializeState state) |
299 : reference_(reference), state_(state) {} | 299 : reference_(reference), state_(state) {} |
300 Object* reference() const { return reference_; } | 300 Object* reference() const { return reference_; } |
301 bool is_deserialized() const { return state_ == kIsDeserialized; } | 301 bool is_deserialized() const { return state_ == kIsDeserialized; } |
302 void set_state(DeserializeState state) { state_ = state; } | 302 void set_state(DeserializeState state) { state_ = state; } |
303 | 303 |
| 304 BackRefNode& operator=(const BackRefNode& other) { |
| 305 reference_ = other.reference_; |
| 306 state_ = other.state_; |
| 307 return *this; |
| 308 } |
| 309 |
304 private: | 310 private: |
305 Object* reference_; | 311 Object* reference_; |
306 DeserializeState state_; | 312 DeserializeState state_; |
307 | |
308 DISALLOW_COPY_AND_ASSIGN(BackRefNode); | |
309 }; | 313 }; |
310 | 314 |
311 // Allocate uninitialized objects, this is used when reading a full snapshot. | 315 // Allocate uninitialized objects, this is used when reading a full snapshot. |
312 RawObject* AllocateUninitialized(const Class& cls, intptr_t size); | 316 RawObject* AllocateUninitialized(const Class& cls, intptr_t size); |
313 | 317 |
314 RawClass* ReadClassId(intptr_t object_id); | 318 RawClass* ReadClassId(intptr_t object_id); |
315 RawObject* ReadObjectImpl(); | 319 RawObject* ReadObjectImpl(); |
316 RawObject* ReadObjectImpl(intptr_t header); | 320 RawObject* ReadObjectImpl(intptr_t header); |
317 RawObject* ReadObjectRef(); | 321 RawObject* ReadObjectRef(); |
318 | 322 |
(...skipping 19 matching lines...) Expand all Loading... |
338 Array& array_; // Temporary Array handle. | 342 Array& array_; // Temporary Array handle. |
339 Field& field_; // Temporary Field handle. | 343 Field& field_; // Temporary Field handle. |
340 String& str_; // Temporary String handle. | 344 String& str_; // Temporary String handle. |
341 Library& library_; // Temporary library handle. | 345 Library& library_; // Temporary library handle. |
342 AbstractType& type_; // Temporary type handle. | 346 AbstractType& type_; // Temporary type handle. |
343 TypeArguments& type_arguments_; // Temporary type argument handle. | 347 TypeArguments& type_arguments_; // Temporary type argument handle. |
344 Array& tokens_; // Temporary tokens handle. | 348 Array& tokens_; // Temporary tokens handle. |
345 TokenStream& stream_; // Temporary token stream handle. | 349 TokenStream& stream_; // Temporary token stream handle. |
346 ExternalTypedData& data_; // Temporary stream data handle. | 350 ExternalTypedData& data_; // Temporary stream data handle. |
347 UnhandledException& error_; // Error handle. | 351 UnhandledException& error_; // Error handle. |
348 GrowableArray<BackRefNode*> backward_references_; | 352 GrowableArray<BackRefNode> backward_references_; |
349 | 353 |
350 friend class ApiError; | 354 friend class ApiError; |
351 friend class Array; | 355 friend class Array; |
352 friend class BoundedType; | 356 friend class BoundedType; |
353 friend class MixinAppType; | 357 friend class MixinAppType; |
354 friend class Class; | 358 friend class Class; |
355 friend class Context; | 359 friend class Context; |
356 friend class ContextScope; | 360 friend class ContextScope; |
357 friend class Field; | 361 friend class Field; |
358 friend class ClosureData; | 362 friend class ClosureData; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 private: | 639 private: |
636 SnapshotWriter* writer_; | 640 SnapshotWriter* writer_; |
637 bool as_references_; | 641 bool as_references_; |
638 | 642 |
639 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 643 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
640 }; | 644 }; |
641 | 645 |
642 } // namespace dart | 646 } // namespace dart |
643 | 647 |
644 #endif // VM_SNAPSHOT_H_ | 648 #endif // VM_SNAPSHOT_H_ |
OLD | NEW |