summaryrefslogtreecommitdiff
path: root/deps/v8/src/snapshot/partial-serializer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/snapshot/partial-serializer.cc')
-rw-r--r--deps/v8/src/snapshot/partial-serializer.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/deps/v8/src/snapshot/partial-serializer.cc b/deps/v8/src/snapshot/partial-serializer.cc
index 638c4f702c..6c650be4c1 100644
--- a/deps/v8/src/snapshot/partial-serializer.cc
+++ b/deps/v8/src/snapshot/partial-serializer.cc
@@ -101,6 +101,12 @@ void PartialSerializer::SerializeObject(HeapObject obj) {
// Clear literal boilerplates and feedback.
if (obj->IsFeedbackVector()) FeedbackVector::cast(obj)->ClearSlots(isolate());
+ // Clear InterruptBudget when serializing FeedbackCell.
+ if (obj->IsFeedbackCell()) {
+ FeedbackCell::cast(obj)->set_interrupt_budget(
+ FeedbackCell::GetInitialInterruptBudget());
+ }
+
if (SerializeJSObjectWithEmbedderFields(obj)) {
return;
}
@@ -143,7 +149,6 @@ bool PartialSerializer::SerializeJSObjectWithEmbedderFields(Object obj) {
int embedder_fields_count = js_obj->GetEmbedderFieldCount();
if (embedder_fields_count == 0) return false;
CHECK_GT(embedder_fields_count, 0);
- DCHECK_NOT_NULL(serialize_embedder_fields_.callback);
DCHECK(!js_obj->NeedsRehashing());
DisallowHeapAllocation no_gc;
@@ -169,9 +174,17 @@ bool PartialSerializer::SerializeJSObjectWithEmbedderFields(Object obj) {
DCHECK(isolate()->heap()->Contains(HeapObject::cast(object)));
serialized_data.push_back({nullptr, 0});
} else {
- StartupData data = serialize_embedder_fields_.callback(
- api_obj, i, serialize_embedder_fields_.data);
- serialized_data.push_back(data);
+ // If no serializer is provided and the field was empty, we serialize it
+ // by default to nullptr.
+ if (serialize_embedder_fields_.callback == nullptr &&
+ object->ptr() == 0) {
+ serialized_data.push_back({nullptr, 0});
+ } else {
+ DCHECK_NOT_NULL(serialize_embedder_fields_.callback);
+ StartupData data = serialize_embedder_fields_.callback(
+ api_obj, i, serialize_embedder_fields_.data);
+ serialized_data.push_back(data);
+ }
}
}