summaryrefslogtreecommitdiff
path: root/deps/v8/src/snapshot/context-deserializer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/snapshot/context-deserializer.cc')
-rw-r--r--deps/v8/src/snapshot/context-deserializer.cc37
1 files changed, 11 insertions, 26 deletions
diff --git a/deps/v8/src/snapshot/context-deserializer.cc b/deps/v8/src/snapshot/context-deserializer.cc
index ae0865ee28..5ae6dcd0eb 100644
--- a/deps/v8/src/snapshot/context-deserializer.cc
+++ b/deps/v8/src/snapshot/context-deserializer.cc
@@ -5,6 +5,7 @@
#include "src/snapshot/context-deserializer.h"
#include "src/api/api-inl.h"
+#include "src/common/assert-scope.h"
#include "src/heap/heap-inl.h"
#include "src/objects/slots.h"
#include "src/snapshot/snapshot.h"
@@ -16,8 +17,7 @@ MaybeHandle<Context> ContextDeserializer::DeserializeContext(
Isolate* isolate, const SnapshotData* data, bool can_rehash,
Handle<JSGlobalProxy> global_proxy,
v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer) {
- ContextDeserializer d(data);
- d.SetRehashability(can_rehash);
+ ContextDeserializer d(isolate, data, can_rehash);
MaybeHandle<Object> maybe_result =
d.Deserialize(isolate, global_proxy, embedder_fields_deserializer);
@@ -30,11 +30,6 @@ MaybeHandle<Context> ContextDeserializer::DeserializeContext(
MaybeHandle<Object> ContextDeserializer::Deserialize(
Isolate* isolate, Handle<JSGlobalProxy> global_proxy,
v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer) {
- Initialize(isolate);
- if (!allocator()->ReserveSpace()) {
- V8::FatalProcessOutOfMemory(isolate, "ContextDeserializer");
- }
-
// Replace serialized references to the global proxy and its map with the
// given global proxy and its map.
AddAttachedObject(global_proxy);
@@ -42,26 +37,17 @@ MaybeHandle<Object> ContextDeserializer::Deserialize(
Handle<Object> result;
{
- DisallowGarbageCollection no_gc;
- // Keep track of the code space start and end pointers in case new
- // code objects were unserialized
- CodeSpace* code_space = isolate->heap()->code_space();
- Address start_address = code_space->top();
- Object root;
- VisitRootPointer(Root::kStartupObjectCache, nullptr, FullObjectSlot(&root));
+ // There's no code deserialized here. If this assert fires then that's
+ // changed and logging should be added to notify the profiler et al. of
+ // the new code, which also has to be flushed from instruction cache.
+ DisallowCodeAllocation no_code_allocation;
+
+ result = ReadObject();
DeserializeDeferredObjects();
DeserializeEmbedderFields(embedder_fields_deserializer);
- allocator()->RegisterDeserializedObjectsForBlackAllocation();
-
- // There's no code deserialized here. If this assert fires then that's
- // changed and logging should be added to notify the profiler et al of the
- // new code, which also has to be flushed from instruction cache.
- CHECK_EQ(start_address, code_space->top());
-
LogNewMapEvents();
-
- result = handle(root, isolate);
+ WeakenDescriptorArrays();
}
if (FLAG_rehash_snapshot && can_rehash()) Rehash();
@@ -74,6 +60,7 @@ void ContextDeserializer::SetupOffHeapArrayBufferBackingStores() {
for (Handle<JSArrayBuffer> buffer : new_off_heap_array_buffers()) {
uint32_t store_index = buffer->GetBackingStoreRefForDeserialization();
auto bs = backing_store(store_index);
+ buffer->AllocateExternalPointerEntries(isolate());
SharedFlag shared =
bs && bs->is_shared() ? SharedFlag::kShared : SharedFlag::kNotShared;
buffer->Setup(shared, bs);
@@ -90,9 +77,7 @@ void ContextDeserializer::DeserializeEmbedderFields(
for (int code = source()->Get(); code != kSynchronize;
code = source()->Get()) {
HandleScope scope(isolate());
- SnapshotSpace space = NewObject::Decode(code);
- Handle<JSObject> obj(JSObject::cast(GetBackReferencedObject(space)),
- isolate());
+ Handle<JSObject> obj = Handle<JSObject>::cast(GetBackReferencedObject());
int index = source()->GetInt();
int size = source()->GetInt();
// TODO(yangguo,jgruber): Turn this into a reusable shared buffer.