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/partial-serializer.h" | 5 #include "src/snapshot/partial-serializer.h" |
6 #include "src/snapshot/startup-serializer.h" | 6 #include "src/snapshot/startup-serializer.h" |
7 | 7 |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 JSFunction* function = JSFunction::cast(obj); | 95 JSFunction* function = JSFunction::cast(obj); |
96 LiteralsArray* literals = function->literals(); | 96 LiteralsArray* literals = function->literals(); |
97 for (int i = 0; i < literals->literals_count(); i++) { | 97 for (int i = 0; i < literals->literals_count(); i++) { |
98 literals->set_literal_undefined(i); | 98 literals->set_literal_undefined(i); |
99 } | 99 } |
100 function->ClearTypeFeedbackInfo(); | 100 function->ClearTypeFeedbackInfo(); |
101 } | 101 } |
102 | 102 |
103 if (obj->IsJSObject()) { | 103 if (obj->IsJSObject()) { |
104 JSObject* jsobj = JSObject::cast(obj); | 104 JSObject* jsobj = JSObject::cast(obj); |
105 if (jsobj->GetInternalFieldCount() > 0) internal_field_holders_.Add(jsobj); | 105 if (jsobj->GetInternalFieldCount() > 0) { |
| 106 DCHECK_NOT_NULL(serialize_internal_fields_); |
| 107 internal_field_holders_.Add(jsobj); |
| 108 } |
106 } | 109 } |
107 | 110 |
108 // Object has not yet been serialized. Serialize it here. | 111 // Object has not yet been serialized. Serialize it here. |
109 ObjectSerializer serializer(this, obj, &sink_, how_to_code, where_to_point); | 112 ObjectSerializer serializer(this, obj, &sink_, how_to_code, where_to_point); |
110 serializer.Serialize(); | 113 serializer.Serialize(); |
111 } | 114 } |
112 | 115 |
113 bool PartialSerializer::ShouldBeInThePartialSnapshotCache(HeapObject* o) { | 116 bool PartialSerializer::ShouldBeInThePartialSnapshotCache(HeapObject* o) { |
114 // Scripts should be referred only through shared function infos. We can't | 117 // Scripts should be referred only through shared function infos. We can't |
115 // allow them to be part of the partial snapshot because they contain a | 118 // allow them to be part of the partial snapshot because they contain a |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 sink_.PutRaw(reinterpret_cast<const byte*>(data.data), data.raw_size, | 150 sink_.PutRaw(reinterpret_cast<const byte*>(data.data), data.raw_size, |
148 "internal fields data"); | 151 "internal fields data"); |
149 delete[] data.data; | 152 delete[] data.data; |
150 } | 153 } |
151 } | 154 } |
152 sink_.Put(kSynchronize, "Finished with internal fields data"); | 155 sink_.Put(kSynchronize, "Finished with internal fields data"); |
153 } | 156 } |
154 | 157 |
155 } // namespace internal | 158 } // namespace internal |
156 } // namespace v8 | 159 } // namespace v8 |
OLD | NEW |