#include "src/snapshot/context-serializer.h"
#include "src/api/api-inl.h"
#include "src/execution/microtask-queue.h"
#include "src/heap/combined-heap.h"
#include "src/numbers/math-random.h"
#include "src/objects/embedder-data-array-inl.h"
#include "src/objects/js-objects.h"
#include "src/objects/objects-inl.h"
#include "src/objects/slots.h"
#include "src/snapshot/serializer-deserializer.h"
#include "src/snapshot/startup-serializer.h"
namespace v8 {
namespace internal {
namespace {
class V8_NODISCARD SanitizeNativeContextScope final { … };
}
ContextSerializer::ContextSerializer(Isolate* isolate,
Snapshot::SerializerFlags flags,
StartupSerializer* startup_serializer,
SerializeEmbedderFieldsCallback callback)
: … { … }
ContextSerializer::~ContextSerializer() { … }
void ContextSerializer::Serialize(Tagged<Context>* o,
const DisallowGarbageCollection& no_gc) { … }
v8::StartupData InternalFieldSerializeWrapper(
int index, bool field_is_nullptr,
v8::SerializeInternalFieldsCallback user_callback,
v8::Local<v8::Object> api_obj) { … }
v8::StartupData ContextDataSerializeWrapper(
int index, bool field_is_nullptr,
v8::SerializeContextDataCallback user_callback,
v8::Local<v8::Context> api_obj) { … }
void ContextSerializer::SerializeObjectImpl(Handle<HeapObject> obj,
SlotType slot_type) { … }
bool ContextSerializer::ShouldBeInTheStartupObjectCache(Tagged<HeapObject> o) { … }
bool ContextSerializer::ShouldBeInTheSharedObjectCache(Tagged<HeapObject> o) { … }
namespace {
bool DataIsEmpty(const StartupData& data) { … }
}
void ContextSerializer::SerializeApiWrapperFields(Handle<JSObject> js_object) { … }
template <typename V8Type, typename UserSerializerWrapper,
typename UserCallback, typename ApiObjectType>
void ContextSerializer::SerializeObjectWithEmbedderFields(
Handle<V8Type> data_holder, int embedder_fields_count,
UserSerializerWrapper wrapper, UserCallback user_callback,
ApiObjectType api_obj) { … }
void ContextSerializer::CheckRehashability(Tagged<HeapObject> obj) { … }
}
}