| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 }; | 417 }; |
| 418 }; | 418 }; |
| 419 | 419 |
| 420 | 420 |
| 421 // Reads a message snapshot into C structure. | 421 // Reads a message snapshot into C structure. |
| 422 class CMessageReader : public BaseReader { | 422 class CMessageReader : public BaseReader { |
| 423 public: | 423 public: |
| 424 CMessageReader(const uint8_t* buffer, intptr_t length, ReAlloc alloc); | 424 CMessageReader(const uint8_t* buffer, intptr_t length, ReAlloc alloc); |
| 425 ~CMessageReader() { } | 425 ~CMessageReader() { } |
| 426 | 426 |
| 427 Dart_CObject* ReadObject(); | 427 Dart_CMessage* ReadMessage(); |
| 428 | 428 |
| 429 private: | 429 private: |
| 430 // Allocates a Dart_CObject object on the C heap. | 430 // Allocates a Dart_CObject object on the C heap. |
| 431 Dart_CObject* AllocateDartCObject(); | 431 Dart_CObject* AllocateDartCObject(); |
| 432 // Allocates a Dart_CObject object with the specified type on the C heap. | 432 // Allocates a Dart_CObject object with the specified type on the C heap. |
| 433 Dart_CObject* AllocateDartCObject(Dart_CObject::Type type); | 433 Dart_CObject* AllocateDartCObject(Dart_CObject::Type type); |
| 434 // Allocates a Dart_CObject object for the null object on the C heap. | 434 // Allocates a Dart_CObject object for the null object on the C heap. |
| 435 Dart_CObject* AllocateDartCObjectNull(); | 435 Dart_CObject* AllocateDartCObjectNull(); |
| 436 // Allocates a Dart_CObject object for a boolean object on the C heap. | 436 // Allocates a Dart_CObject object for a boolean object on the C heap. |
| 437 Dart_CObject* AllocateDartCObjectBool(bool value); | 437 Dart_CObject* AllocateDartCObjectBool(bool value); |
| 438 // Allocates a Dart_CObject object for for a 32-bit integer on the C heap. | 438 // Allocates a Dart_CObject object for for a 32-bit integer on the C heap. |
| 439 Dart_CObject* AllocateDartCObjectInt32(int32_t value); | 439 Dart_CObject* AllocateDartCObjectInt32(int32_t value); |
| 440 // Allocates a Dart_CObject object for a double on the C heap. | 440 // Allocates a Dart_CObject object for a double on the C heap. |
| 441 Dart_CObject* AllocateDartCObjectDouble(double value); | 441 Dart_CObject* AllocateDartCObjectDouble(double value); |
| 442 // Allocates a Dart_CObject object for string data on the C heap. | 442 // Allocates a Dart_CObject object for string data on the C heap. |
| 443 Dart_CObject* AllocateDartCObjectString(intptr_t length); | 443 Dart_CObject* AllocateDartCObjectString(intptr_t length); |
| 444 // Allocates a C array of Dart_CObject objects on the C heap. | 444 // Allocates a C array of Dart_CObject objects on the C heap. |
| 445 Dart_CObject* AllocateDartCObjectArray(intptr_t length); | 445 Dart_CObject* AllocateDartCObjectArray(intptr_t length); |
| 446 | 446 |
| 447 intptr_t LookupInternalClass(intptr_t class_header); | 447 intptr_t LookupInternalClass(intptr_t class_header); |
| 448 Dart_CObject* ReadInlinedObject(intptr_t object_id); | 448 Dart_CObject* ReadInlinedObject(intptr_t object_id); |
| 449 Dart_CObject* ReadObjectImpl(intptr_t header); | 449 Dart_CObject* ReadObjectImpl(intptr_t header); |
| 450 Dart_CObject* ReadIndexedObject(intptr_t object_id); | 450 Dart_CObject* ReadIndexedObject(intptr_t object_id); |
| 451 Dart_CObject* ReadObject(); |
| 451 | 452 |
| 452 // Add object to backward references. | 453 // Add object to backward references. |
| 453 void AddBackwardReference(intptr_t id, Dart_CObject* obj); | 454 void AddBackwardReference(intptr_t id, Dart_CObject* obj); |
| 454 | 455 |
| 455 Dart_CObject_Internal* AsInternal(Dart_CObject* object) { | 456 Dart_CObject_Internal* AsInternal(Dart_CObject* object) { |
| 456 ASSERT(object->type >= Dart_CObject::kNumberOfTypes); | 457 ASSERT(object->type >= Dart_CObject::kNumberOfTypes); |
| 457 return reinterpret_cast<Dart_CObject_Internal*>(object); | 458 return reinterpret_cast<Dart_CObject_Internal*>(object); |
| 458 } | 459 } |
| 459 | 460 |
| 460 ReAlloc alloc_; | 461 ReAlloc alloc_; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 634 |
| 634 private: | 635 private: |
| 635 SnapshotWriter* writer_; | 636 SnapshotWriter* writer_; |
| 636 | 637 |
| 637 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 638 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 638 }; | 639 }; |
| 639 | 640 |
| 640 } // namespace dart | 641 } // namespace dart |
| 641 | 642 |
| 642 #endif // VM_SNAPSHOT_H_ | 643 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |