Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: runtime/vm/snapshot.h

Issue 9407010: Move MessageWriter from snapshot files to dart_api_message files (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 ~BaseWriter() { } 461 ~BaseWriter() { }
462 462
463 private: 463 private:
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 {
471 public:
472 MessageWriter(uint8_t** buffer, ReAlloc alloc)
473 : BaseWriter(buffer, alloc), object_id_(0) {
474 ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes - 1);
475 }
476 ~MessageWriter() { }
477
478 // Writes a message of integers.
479 void WriteMessage(intptr_t field_count, intptr_t *data);
480
481 void WriteCMessage(Dart_CObject* object);
482
483 void FinalizeBuffer() {
484 BaseWriter::FinalizeBuffer(Snapshot::kMessage);
485 }
486
487 private:
488 static const intptr_t kDartCObjectTypeBits = 4;
489 static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1;
490 static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask;
491 static const intptr_t kDartCObjectMarkOffset = 1;
492
493 void MarkCObject(Dart_CObject* object, intptr_t object_id);
494 void UnmarkCObject(Dart_CObject* object);
495 bool IsCObjectMarked(Dart_CObject* object);
496 intptr_t GetMarkedCObjectMark(Dart_CObject* object);
497 void UnmarkAllCObjects(Dart_CObject* object);
498
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);
503 void WriteInlinedHeader(Dart_CObject* object);
504 void WriteCObject(Dart_CObject* object);
505
506 intptr_t object_id_;
507
508 DISALLOW_COPY_AND_ASSIGN(MessageWriter);
509 };
510
511
512 class SnapshotWriter : public BaseWriter { 470 class SnapshotWriter : public BaseWriter {
513 public: 471 public:
514 SnapshotWriter(Snapshot::Kind kind, uint8_t** buffer, ReAlloc alloc) 472 SnapshotWriter(Snapshot::Kind kind, uint8_t** buffer, ReAlloc alloc)
515 : BaseWriter(buffer, alloc), 473 : BaseWriter(buffer, alloc),
516 kind_(kind), 474 kind_(kind),
517 object_store_(Isolate::Current()->object_store()), 475 object_store_(Isolate::Current()->object_store()),
518 forward_list_() { 476 forward_list_() {
519 } 477 }
520 ~SnapshotWriter() { } 478 ~SnapshotWriter() { }
521 479
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 554
597 private: 555 private:
598 SnapshotWriter* writer_; 556 SnapshotWriter* writer_;
599 557
600 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 558 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
601 }; 559 };
602 560
603 } // namespace dart 561 } // namespace dart
604 562
605 #endif // VM_SNAPSHOT_H_ 563 #endif // VM_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698