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

Side by Side Diff: vm/snapshot.h

Issue 10665035: Prepare for writing token streams directly into a snapshot and reading it directly from the snapsho… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « vm/raw_object_snapshot.cc ('k') | no next file » | 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 // Write serialization header information for an object. 316 // Write serialization header information for an object.
317 void WriteSerializationMarker(SerializedHeaderType type, intptr_t id) { 317 void WriteSerializationMarker(SerializedHeaderType type, intptr_t id) {
318 ASSERT(id <= kMaxObjectId); 318 ASSERT(id <= kMaxObjectId);
319 intptr_t value = 0; 319 intptr_t value = 0;
320 value = SerializedHeaderTag::update(type, value); 320 value = SerializedHeaderTag::update(type, value);
321 value = SerializedHeaderData::update(id, value); 321 value = SerializedHeaderData::update(id, value);
322 WriteIntptrValue(value); 322 WriteIntptrValue(value);
323 } 323 }
324 324
325 // Write out a buffer of bytes.
326 void WriteBytes(const uint8_t* addr, intptr_t len) {
327 stream_.WriteBytes(addr, len);
328 }
329
325 // Finalize the serialized buffer by filling in the header information 330 // Finalize the serialized buffer by filling in the header information
326 // which comprises of a flag(snaphot kind) and the length of 331 // which comprises of a flag(snaphot kind) and the length of
327 // serialzed bytes. 332 // serialzed bytes.
328 void FinalizeBuffer(Snapshot::Kind kind) { 333 void FinalizeBuffer(Snapshot::Kind kind) {
329 int32_t* data = reinterpret_cast<int32_t*>(stream_.buffer()); 334 int32_t* data = reinterpret_cast<int32_t*>(stream_.buffer());
330 data[Snapshot::kLengthIndex] = stream_.bytes_written(); 335 data[Snapshot::kLengthIndex] = stream_.bytes_written();
331 data[Snapshot::kSnapshotFlagIndex] = kind; 336 data[Snapshot::kSnapshotFlagIndex] = kind;
332 } 337 }
333 338
334 protected: 339 protected:
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 private: 475 private:
471 SnapshotWriter* writer_; 476 SnapshotWriter* writer_;
472 bool as_references_; 477 bool as_references_;
473 478
474 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 479 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
475 }; 480 };
476 481
477 } // namespace dart 482 } // namespace dart
478 483
479 #endif // VM_SNAPSHOT_H_ 484 #endif // VM_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698