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

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

Issue 522893002: Change snapshot versioning code to use plain strings instead of Dart strings (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/datastream.h ('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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 const uint8_t* CurrentBufferAddress() const { 218 const uint8_t* CurrentBufferAddress() const {
219 return stream_.AddressOfCurrentPosition(); 219 return stream_.AddressOfCurrentPosition();
220 } 220 }
221 221
222 void Advance(intptr_t value) { 222 void Advance(intptr_t value) {
223 stream_.Advance(value); 223 stream_.Advance(value);
224 } 224 }
225 225
226 intptr_t PendingBytes() const {
227 return stream_.PendingBytes();
228 }
229
226 RawSmi* ReadAsSmi(); 230 RawSmi* ReadAsSmi();
227 intptr_t ReadSmiValue(); 231 intptr_t ReadSmiValue();
228 232
229 // Negative header value indicates VM isolate object id. 233 // Negative header value indicates VM isolate object id.
230 bool IsVMIsolateObject(intptr_t header_value) { return (header_value < 0); } 234 bool IsVMIsolateObject(intptr_t header_value) { return (header_value < 0); }
231 intptr_t GetVMIsolateObjectId(intptr_t header_val) { 235 intptr_t GetVMIsolateObjectId(intptr_t header_val) {
232 ASSERT(IsVMIsolateObject(header_val)); 236 ASSERT(IsVMIsolateObject(header_val));
233 intptr_t value = -header_val; // Header is negative for VM isolate objects. 237 intptr_t value = -header_val; // Header is negative for VM isolate objects.
234 ASSERT(SerializedHeaderTag::decode(value) == kObjectId); 238 ASSERT(SerializedHeaderTag::decode(value) == kObjectId);
235 return SerializedHeaderData::decode(value); 239 return SerializedHeaderData::decode(value);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 274
271 // Get an object from the backward references list. 275 // Get an object from the backward references list.
272 Object* GetBackRef(intptr_t id); 276 Object* GetBackRef(intptr_t id);
273 277
274 // Read a full snap shot. 278 // Read a full snap shot.
275 RawApiError* ReadFullSnapshot(); 279 RawApiError* ReadFullSnapshot();
276 280
277 // Read a script snap shot. 281 // Read a script snap shot.
278 RawObject* ReadScriptSnapshot(); 282 RawObject* ReadScriptSnapshot();
279 283
284 // Read version number of snapshot and verify.
285 RawApiError* VerifyVersion();
286
280 // Helper functions for creating uninitialized versions 287 // Helper functions for creating uninitialized versions
281 // of various object types. These are used when reading a 288 // of various object types. These are used when reading a
282 // full snapshot. 289 // full snapshot.
283 RawArray* NewArray(intptr_t len); 290 RawArray* NewArray(intptr_t len);
284 RawImmutableArray* NewImmutableArray(intptr_t len); 291 RawImmutableArray* NewImmutableArray(intptr_t len);
285 RawOneByteString* NewOneByteString(intptr_t len); 292 RawOneByteString* NewOneByteString(intptr_t len);
286 RawTwoByteString* NewTwoByteString(intptr_t len); 293 RawTwoByteString* NewTwoByteString(intptr_t len);
287 RawTypeArguments* NewTypeArguments(intptr_t len); 294 RawTypeArguments* NewTypeArguments(intptr_t len);
288 RawTokenStream* NewTokenStream(intptr_t len); 295 RawTokenStream* NewTokenStream(intptr_t len);
289 RawContext* NewContext(intptr_t num_variables); 296 RawContext* NewContext(intptr_t num_variables);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 594 }
588 void set_exception_type(Exceptions::ExceptionType type) { 595 void set_exception_type(Exceptions::ExceptionType type) {
589 exception_type_ = type; 596 exception_type_ = type;
590 } 597 }
591 const char* exception_msg() const { return exception_msg_; } 598 const char* exception_msg() const { return exception_msg_; }
592 void set_exception_msg(const char* msg) { 599 void set_exception_msg(const char* msg) {
593 exception_msg_ = msg; 600 exception_msg_ = msg;
594 } 601 }
595 void ThrowException(Exceptions::ExceptionType type, const char* msg); 602 void ThrowException(Exceptions::ExceptionType type, const char* msg);
596 603
604 // Write a version string for the snapshot.
605 void WriteVersion();
606
597 protected: 607 protected:
598 void UnmarkAll() { 608 void UnmarkAll() {
599 forward_list_.UnmarkAll(); 609 forward_list_.UnmarkAll();
600 } 610 }
601 611
602 bool CheckAndWritePredefinedObject(RawObject* raw); 612 bool CheckAndWritePredefinedObject(RawObject* raw);
603 void HandleVMIsolateObject(RawObject* raw); 613 void HandleVMIsolateObject(RawObject* raw);
604 614
605 void WriteObjectRef(RawObject* raw); 615 void WriteObjectRef(RawObject* raw);
606 void WriteClassId(RawClass* cls); 616 void WriteClassId(RawClass* cls);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 private: 735 private:
726 SnapshotWriter* writer_; 736 SnapshotWriter* writer_;
727 bool as_references_; 737 bool as_references_;
728 738
729 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 739 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
730 }; 740 };
731 741
732 } // namespace dart 742 } // namespace dart
733 743
734 #endif // VM_SNAPSHOT_H_ 744 #endif // VM_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « runtime/vm/datastream.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698