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

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

Issue 388963003: Avoid allocating an exception object in the snapshot reader. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 6 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 | « runtime/vm/raw_object_snapshot.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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class RawCapability; 60 class RawCapability;
61 class RawReceivePort; 61 class RawReceivePort;
62 class RawSendPort; 62 class RawSendPort;
63 class RawStacktrace; 63 class RawStacktrace;
64 class RawTokenStream; 64 class RawTokenStream;
65 class RawType; 65 class RawType;
66 class RawTypeRef; 66 class RawTypeRef;
67 class RawTypeParameter; 67 class RawTypeParameter;
68 class RawTypeArguments; 68 class RawTypeArguments;
69 class RawTwoByteString; 69 class RawTwoByteString;
70 class RawUnhandledException;
70 class RawUnresolvedClass; 71 class RawUnresolvedClass;
71 class String; 72 class String;
72 class TokenStream; 73 class TokenStream;
73 class TypeArguments; 74 class TypeArguments;
74 class UnhandledException; 75 class UnhandledException;
75 76
76 // Serialized object header encoding is as follows: 77 // Serialized object header encoding is as follows:
77 // - Smi: the Smi value is written as is (last bit is not tagged). 78 // - Smi: the Smi value is written as is (last bit is not tagged).
78 // - VM object (from VM isolate): (object id in vm isolate | 0x3) 79 // - VM object (from VM isolate): (object id in vm isolate | 0x3)
79 // This valus is serialized as a negative number. 80 // This valus is serialized as a negative number.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 ObjectStore* object_store() const { return isolate_->object_store(); } 242 ObjectStore* object_store() const { return isolate_->object_store(); }
242 ClassTable* class_table() const { return isolate_->class_table(); } 243 ClassTable* class_table() const { return isolate_->class_table(); }
243 Object* ObjectHandle() { return &obj_; } 244 Object* ObjectHandle() { return &obj_; }
244 Array* ArrayHandle() { return &array_; } 245 Array* ArrayHandle() { return &array_; }
245 String* StringHandle() { return &str_; } 246 String* StringHandle() { return &str_; }
246 AbstractType* TypeHandle() { return &type_; } 247 AbstractType* TypeHandle() { return &type_; }
247 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } 248 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; }
248 Array* TokensHandle() { return &tokens_; } 249 Array* TokensHandle() { return &tokens_; }
249 TokenStream* StreamHandle() { return &stream_; } 250 TokenStream* StreamHandle() { return &stream_; }
250 ExternalTypedData* DataHandle() { return &data_; } 251 ExternalTypedData* DataHandle() { return &data_; }
251 UnhandledException* ErrorHandle() { return &error_; }
252 252
253 // Reads an object. 253 // Reads an object.
254 RawObject* ReadObject(); 254 RawObject* ReadObject();
255 255
256 // Add object to backward references. 256 // Add object to backward references.
257 void AddBackRef(intptr_t id, Object* obj, DeserializeState state); 257 void AddBackRef(intptr_t id, Object* obj, DeserializeState state);
258 258
259 // Get an object from the backward references list. 259 // Get an object from the backward references list.
260 Object* GetBackRef(intptr_t id); 260 Object* GetBackRef(intptr_t id);
261 261
(...skipping 30 matching lines...) Expand all
292 RawLibraryPrefix* NewLibraryPrefix(); 292 RawLibraryPrefix* NewLibraryPrefix();
293 RawNamespace* NewNamespace(); 293 RawNamespace* NewNamespace();
294 RawScript* NewScript(); 294 RawScript* NewScript();
295 RawLiteralToken* NewLiteralToken(); 295 RawLiteralToken* NewLiteralToken();
296 RawGrowableObjectArray* NewGrowableObjectArray(); 296 RawGrowableObjectArray* NewGrowableObjectArray();
297 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3); 297 RawFloat32x4* NewFloat32x4(float v0, float v1, float v2, float v3);
298 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3); 298 RawInt32x4* NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3);
299 RawFloat64x2* NewFloat64x2(double v0, double v1); 299 RawFloat64x2* NewFloat64x2(double v0, double v1);
300 RawApiError* NewApiError(); 300 RawApiError* NewApiError();
301 RawLanguageError* NewLanguageError(); 301 RawLanguageError* NewLanguageError();
302 RawUnhandledException* NewUnhandledException();
302 RawObject* NewInteger(int64_t value); 303 RawObject* NewInteger(int64_t value);
303 RawStacktrace* NewStacktrace(); 304 RawStacktrace* NewStacktrace();
304 305
305 private: 306 private:
306 class BackRefNode : public ValueObject { 307 class BackRefNode : public ValueObject {
307 public: 308 public:
308 BackRefNode(Object* reference, DeserializeState state) 309 BackRefNode(Object* reference, DeserializeState state)
309 : reference_(reference), state_(state) {} 310 : reference_(reference), state_(state) {}
310 Object* reference() const { return reference_; } 311 Object* reference() const { return reference_; }
311 bool is_deserialized() const { return state_ == kIsDeserialized; } 312 bool is_deserialized() const { return state_ == kIsDeserialized; }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 friend class LiteralToken; 383 friend class LiteralToken;
383 friend class PatchClass; 384 friend class PatchClass;
384 friend class Script; 385 friend class Script;
385 friend class Stacktrace; 386 friend class Stacktrace;
386 friend class TokenStream; 387 friend class TokenStream;
387 friend class Type; 388 friend class Type;
388 friend class TypeArguments; 389 friend class TypeArguments;
389 friend class TypeParameter; 390 friend class TypeParameter;
390 friend class TypeRef; 391 friend class TypeRef;
391 friend class UnresolvedClass; 392 friend class UnresolvedClass;
393 friend class UnhandledException;
392 friend class WeakProperty; 394 friend class WeakProperty;
393 friend class MirrorReference; 395 friend class MirrorReference;
394 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); 396 DISALLOW_COPY_AND_ASSIGN(SnapshotReader);
395 }; 397 };
396 398
397 399
398 class BaseWriter { 400 class BaseWriter {
399 public: 401 public:
400 // Size of the snapshot. 402 // Size of the snapshot.
401 intptr_t BytesWritten() const { return stream_.bytes_written(); } 403 intptr_t BytesWritten() const { return stream_.bytes_written(); }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 private: 700 private:
699 SnapshotWriter* writer_; 701 SnapshotWriter* writer_;
700 bool as_references_; 702 bool as_references_;
701 703
702 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 704 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
703 }; 705 };
704 706
705 } // namespace dart 707 } // namespace dart
706 708
707 #endif // VM_SNAPSHOT_H_ 709 #endif // VM_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698