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 #include "src/snapshot/startup-serializer.h" | 5 #include "src/snapshot/startup-serializer.h" |
6 | 6 |
7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
8 #include "src/v8threads.h" | 8 #include "src/v8threads.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 obj = isolate()->heap()->undefined_value(); | 43 obj = isolate()->heap()->undefined_value(); |
44 } | 44 } |
45 } else if (obj->IsCode()) { | 45 } else if (obj->IsCode()) { |
46 Code* code = Code::cast(obj); | 46 Code* code = Code::cast(obj); |
47 if (code->kind() == Code::FUNCTION) { | 47 if (code->kind() == Code::FUNCTION) { |
48 code->ClearInlineCaches(); | 48 code->ClearInlineCaches(); |
49 code->set_profiler_ticks(0); | 49 code->set_profiler_ticks(0); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
| 53 if (SerializeHotObject(obj, how_to_code, where_to_point, skip)) return; |
| 54 |
53 int root_index = root_index_map_.Lookup(obj); | 55 int root_index = root_index_map_.Lookup(obj); |
54 // We can only encode roots as such if it has already been serialized. | 56 // We can only encode roots as such if it has already been serialized. |
55 // That applies to root indices below the wave front. | 57 // That applies to root indices below the wave front. |
56 if (root_index != RootIndexMap::kInvalidRootIndex) { | 58 if (root_index != RootIndexMap::kInvalidRootIndex) { |
57 if (root_has_been_serialized_.test(root_index)) { | 59 if (root_has_been_serialized_.test(root_index)) { |
58 PutRoot(root_index, obj, how_to_code, where_to_point, skip); | 60 PutRoot(root_index, obj, how_to_code, where_to_point, skip); |
59 return; | 61 return; |
60 } | 62 } |
61 } | 63 } |
62 | 64 |
63 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; | 65 if (SerializeBackReference(obj, how_to_code, where_to_point, skip)) return; |
64 | 66 |
65 FlushSkip(skip); | 67 FlushSkip(skip); |
66 | 68 |
67 // Object has not yet been serialized. Serialize it here. | 69 // Object has not yet been serialized. Serialize it here. |
68 ObjectSerializer object_serializer(this, obj, &sink_, how_to_code, | 70 ObjectSerializer object_serializer(this, obj, &sink_, how_to_code, |
69 where_to_point); | 71 where_to_point); |
70 object_serializer.Serialize(); | 72 object_serializer.Serialize(); |
71 | 73 |
72 if (serializing_immortal_immovables_roots_ && | 74 if (serializing_immortal_immovables_roots_ && |
73 root_index != RootIndexMap::kInvalidRootIndex) { | 75 root_index != RootIndexMap::kInvalidRootIndex) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (root_index == Heap::kStackLimitRootIndex || | 172 if (root_index == Heap::kStackLimitRootIndex || |
171 root_index == Heap::kRealStackLimitRootIndex) { | 173 root_index == Heap::kRealStackLimitRootIndex) { |
172 return true; | 174 return true; |
173 } | 175 } |
174 return Heap::RootIsImmortalImmovable(root_index) != | 176 return Heap::RootIsImmortalImmovable(root_index) != |
175 serializing_immortal_immovables_roots_; | 177 serializing_immortal_immovables_roots_; |
176 } | 178 } |
177 | 179 |
178 } // namespace internal | 180 } // namespace internal |
179 } // namespace v8 | 181 } // namespace v8 |
OLD | NEW |