OLD | NEW |
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_STARTUP_SERIALIZER_H_ | 5 #ifndef V8_SNAPSHOT_STARTUP_SERIALIZER_H_ |
6 #define V8_SNAPSHOT_STARTUP_SERIALIZER_H_ | 6 #define V8_SNAPSHOT_STARTUP_SERIALIZER_H_ |
7 | 7 |
8 #include "src/snapshot/serializer.h" | 8 #include "src/snapshot/serializer.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 class StartupSerializer : public Serializer { | 13 class StartupSerializer : public Serializer { |
14 public: | 14 public: |
15 StartupSerializer(Isolate* isolate, SnapshotByteSink* sink); | 15 enum FunctionCodeHandling { CLEAR_FUNCTION_CODE, KEEP_FUNCTION_CODE }; |
| 16 |
| 17 StartupSerializer( |
| 18 Isolate* isolate, SnapshotByteSink* sink, |
| 19 FunctionCodeHandling function_code_handling = CLEAR_FUNCTION_CODE); |
16 ~StartupSerializer() override; | 20 ~StartupSerializer() override; |
17 | 21 |
18 // Serialize the current state of the heap. The order is: | 22 // Serialize the current state of the heap. The order is: |
19 // 1) Strong references. | 23 // 1) Strong references. |
20 // 2) Partial snapshot cache. | 24 // 2) Partial snapshot cache. |
21 // 3) Weak references (e.g. the string table). | 25 // 3) Weak references (e.g. the string table). |
22 void SerializeStrongReferences(); | 26 void SerializeStrongReferences(); |
23 void SerializeWeakReferencesAndDeferred(); | 27 void SerializeWeakReferencesAndDeferred(); |
24 | 28 |
25 private: | 29 private: |
26 // The StartupSerializer has to serialize the root array, which is slightly | 30 // The StartupSerializer has to serialize the root array, which is slightly |
27 // different. | 31 // different. |
28 void VisitPointers(Object** start, Object** end) override; | 32 void VisitPointers(Object** start, Object** end) override; |
29 void SerializeObject(HeapObject* o, HowToCode how_to_code, | 33 void SerializeObject(HeapObject* o, HowToCode how_to_code, |
30 WhereToPoint where_to_point, int skip) override; | 34 WhereToPoint where_to_point, int skip) override; |
31 void Synchronize(VisitorSynchronization::SyncTag tag) override; | 35 void Synchronize(VisitorSynchronization::SyncTag tag) override; |
32 | 36 |
33 intptr_t root_index_wave_front_; | 37 intptr_t root_index_wave_front_; |
34 bool serializing_builtins_; | 38 bool serializing_builtins_; |
| 39 FunctionCodeHandling function_code_handling_; |
35 DISALLOW_COPY_AND_ASSIGN(StartupSerializer); | 40 DISALLOW_COPY_AND_ASSIGN(StartupSerializer); |
36 }; | 41 }; |
37 | 42 |
38 } // namespace internal | 43 } // namespace internal |
39 } // namespace v8 | 44 } // namespace v8 |
40 | 45 |
41 #endif // V8_SNAPSHOT_STARTUP_SERIALIZER_H_ | 46 #endif // V8_SNAPSHOT_STARTUP_SERIALIZER_H_ |
OLD | NEW |