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

Side by Side Diff: src/snapshot/deserializer.h

Issue 2205973003: [wasm] Serialization/Deserialization of compiled module (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: disable dchecks Created 4 years, 4 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
« no previous file with comments | « src/snapshot/code-serializer.cc ('k') | src/snapshot/deserializer.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_SNAPSHOT_DESERIALIZER_H_ 5 #ifndef V8_SNAPSHOT_DESERIALIZER_H_
6 #define V8_SNAPSHOT_DESERIALIZER_H_ 6 #define V8_SNAPSHOT_DESERIALIZER_H_
7 7
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 #include "src/snapshot/serializer-common.h" 10 #include "src/snapshot/serializer-common.h"
(...skipping 12 matching lines...) Expand all
23 #define V8_CODE_EMBEDS_OBJECT_POINTER 0 23 #define V8_CODE_EMBEDS_OBJECT_POINTER 0
24 #endif 24 #endif
25 25
26 class Heap; 26 class Heap;
27 27
28 // A Deserializer reads a snapshot and reconstructs the Object graph it defines. 28 // A Deserializer reads a snapshot and reconstructs the Object graph it defines.
29 class Deserializer : public SerializerDeserializer { 29 class Deserializer : public SerializerDeserializer {
30 public: 30 public:
31 // Create a deserializer from a snapshot byte source. 31 // Create a deserializer from a snapshot byte source.
32 template <class Data> 32 template <class Data>
33 explicit Deserializer(Data* data) 33 explicit Deserializer(Data* data, bool deserializing_user_code = false)
34 : isolate_(NULL), 34 : isolate_(NULL),
35 source_(data->Payload()), 35 source_(data->Payload()),
36 magic_number_(data->GetMagicNumber()), 36 magic_number_(data->GetMagicNumber()),
37 external_reference_table_(NULL), 37 external_reference_table_(NULL),
38 deserialized_large_objects_(0), 38 deserialized_large_objects_(0),
39 deserializing_user_code_(false), 39 deserializing_user_code_(deserializing_user_code),
40 next_alignment_(kWordAligned) { 40 next_alignment_(kWordAligned) {
41 DecodeReservation(data->Reservations()); 41 DecodeReservation(data->Reservations());
42 } 42 }
43 43
44 ~Deserializer() override; 44 ~Deserializer() override;
45 45
46 // Deserialize the snapshot into an empty heap. 46 // Deserialize the snapshot into an empty heap.
47 void Deserialize(Isolate* isolate); 47 void Deserialize(Isolate* isolate);
48 48
49 // Deserialize a single object and the objects reachable from it. 49 // Deserialize a single object and the objects reachable from it.
50 MaybeHandle<Object> DeserializePartial(Isolate* isolate, 50 MaybeHandle<Object> DeserializePartial(Isolate* isolate,
51 Handle<JSGlobalProxy> global_proxy); 51 Handle<JSGlobalProxy> global_proxy);
52 52
53 // Deserialize a shared function info. Fail gracefully. 53 // Deserialize an object graph. Fail gracefully.
54 MaybeHandle<SharedFunctionInfo> DeserializeCode(Isolate* isolate); 54 MaybeHandle<HeapObject> DeserializeObject(Isolate* isolate);
55 55
56 // Add an object to back an attached reference. The order to add objects must 56 // Add an object to back an attached reference. The order to add objects must
57 // mirror the order they are added in the serializer. 57 // mirror the order they are added in the serializer.
58 void AddAttachedObject(Handle<HeapObject> attached_object) { 58 void AddAttachedObject(Handle<HeapObject> attached_object) {
59 attached_objects_.Add(attached_object); 59 attached_objects_.Add(attached_object);
60 } 60 }
61 61
62 private: 62 private:
63 void VisitPointers(Object** start, Object** end) override; 63 void VisitPointers(Object** start, Object** end) override;
64 64
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 AllocationAlignment next_alignment_; 142 AllocationAlignment next_alignment_;
143 143
144 DISALLOW_COPY_AND_ASSIGN(Deserializer); 144 DISALLOW_COPY_AND_ASSIGN(Deserializer);
145 }; 145 };
146 146
147 } // namespace internal 147 } // namespace internal
148 } // namespace v8 148 } // namespace v8
149 149
150 #endif // V8_SNAPSHOT_DESERIALIZER_H_ 150 #endif // V8_SNAPSHOT_DESERIALIZER_H_
OLDNEW
« no previous file with comments | « src/snapshot/code-serializer.cc ('k') | src/snapshot/deserializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698