| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 WriteStream stream_; | 464 WriteStream stream_; |
| 465 | 465 |
| 466 DISALLOW_IMPLICIT_CONSTRUCTORS(BaseWriter); | 466 DISALLOW_IMPLICIT_CONSTRUCTORS(BaseWriter); |
| 467 }; | 467 }; |
| 468 | 468 |
| 469 | 469 |
| 470 class MessageWriter : public BaseWriter { | 470 class MessageWriter : public BaseWriter { |
| 471 public: | 471 public: |
| 472 MessageWriter(uint8_t** buffer, ReAlloc alloc) | 472 MessageWriter(uint8_t** buffer, ReAlloc alloc) |
| 473 : BaseWriter(buffer, alloc), object_id_(0) { | 473 : BaseWriter(buffer, alloc), object_id_(0) { |
| 474 ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes); | 474 ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes - 1); |
| 475 } | 475 } |
| 476 ~MessageWriter() { } | 476 ~MessageWriter() { } |
| 477 | 477 |
| 478 // Writes a message of integers. | 478 // Writes a message of integers. |
| 479 void WriteMessage(intptr_t field_count, intptr_t *data); | 479 void WriteMessage(intptr_t field_count, intptr_t *data); |
| 480 | 480 |
| 481 void WriteCMessage(Dart_CObject* object); | 481 void WriteCMessage(Dart_CObject* object); |
| 482 | 482 |
| 483 void FinalizeBuffer() { | 483 void FinalizeBuffer() { |
| 484 BaseWriter::FinalizeBuffer(Snapshot::kMessage); | 484 BaseWriter::FinalizeBuffer(Snapshot::kMessage); |
| 485 } | 485 } |
| 486 | 486 |
| 487 private: | 487 private: |
| 488 static const intptr_t kDartCObjectTypeBits = 3; | 488 static const intptr_t kDartCObjectTypeBits = 3; |
| 489 static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1; | 489 static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1; |
| 490 static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask; | 490 static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask; |
| 491 static const intptr_t kDartCObjectMarkOffset = 1; | 491 static const intptr_t kDartCObjectMarkOffset = 1; |
| 492 | 492 |
| 493 void MarkCObject(Dart_CObject* object, intptr_t object_id); | 493 void MarkCObject(Dart_CObject* object, intptr_t object_id); |
| 494 void UnmarkCObject(Dart_CObject* object); | 494 void UnmarkCObject(Dart_CObject* object); |
| 495 bool IsCObjectMarked(Dart_CObject* object); | 495 bool IsCObjectMarked(Dart_CObject* object); |
| 496 intptr_t GetMarkedCObjectMark(Dart_CObject* object); | 496 intptr_t GetMarkedCObjectMark(Dart_CObject* object); |
| 497 void UnmarkAllCObjects(Dart_CObject* object); | 497 void UnmarkAllCObjects(Dart_CObject* object); |
| 498 | 498 |
| 499 void WriteSmi(int32_t value); | 499 void WriteSmi(int64_t value); |
| 500 void WriteMint(Dart_CObject* object, int64_t value); |
| 501 void WriteInt32(Dart_CObject* object); |
| 502 void WriteInt64(Dart_CObject* object); |
| 500 void WriteInlinedHeader(Dart_CObject* object); | 503 void WriteInlinedHeader(Dart_CObject* object); |
| 501 void WriteCObject(Dart_CObject* object); | 504 void WriteCObject(Dart_CObject* object); |
| 502 | 505 |
| 503 intptr_t object_id_; | 506 intptr_t object_id_; |
| 504 | 507 |
| 505 DISALLOW_COPY_AND_ASSIGN(MessageWriter); | 508 DISALLOW_COPY_AND_ASSIGN(MessageWriter); |
| 506 }; | 509 }; |
| 507 | 510 |
| 508 | 511 |
| 509 class SnapshotWriter : public BaseWriter { | 512 class SnapshotWriter : public BaseWriter { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 596 |
| 594 private: | 597 private: |
| 595 SnapshotWriter* writer_; | 598 SnapshotWriter* writer_; |
| 596 | 599 |
| 597 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 600 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 598 }; | 601 }; |
| 599 | 602 |
| 600 } // namespace dart | 603 } // namespace dart |
| 601 | 604 |
| 602 #endif // VM_SNAPSHOT_H_ | 605 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |