Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/workerd/jsg/setup.c++
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ IsolateWithSnapshotCreator newIsolateWithSnapshotCreator(v8::Isolate::CreatePara
artifact.externalReferences.asPtr().fill(0);
params.external_references = artifact.externalReferences.begin();

auto creator = kj::heap<v8::SnapshotCreator>(params);
v8::Isolate* isolate = creator->GetIsolate();
v8::Isolate* isolate = v8::Isolate::Allocate(group);
auto creator = kj::heap<v8::SnapshotCreator>(isolate, params);
return IsolateWithSnapshotCreator{isolate, kj::mv(creator)};
}
KJ_CASE_ONEOF(finalizedSnapshot, FinalizedSnapshot) {
Expand Down Expand Up @@ -605,16 +605,8 @@ IsolateBase::~IsolateBase() noexcept(false) {
jsg::runInV8Stack([&](jsg::V8StackScope& stackScope) {
// Terminate the v8::platform's task queue associated with this isolate
v8System.shutdownIsolate(ptr);
// When preparing a snapshot the v8::SnapshotCreator owns the isolate and keeps it "entered" by
// the current thread; v8::Isolate::Dispose() refuses to run on an entered isolate. Destroy the
// SnapshotCreator first — its destructor exits and disposes the isolate — and skip
// ptr->Dispose() in that case.
if (isPreparingSnapshot()) {
// Destroying the SnapshotCreator exits and disposes its isolate.
snapshotCreator = kj::none;
} else {
ptr->Dispose();
}
snapshotCreator = kj::none;
ptr->Dispose();
ptr = nullptr;
// TODO(cleanup): meaningless after V8 13.4 is released.
cppHeap.reset();
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/server/server.c++
Original file line number Diff line number Diff line change
Expand Up @@ -5907,7 +5907,7 @@ kj::Own<Worker::Isolate> Server::makeWorkerIsolate(kj::StringPtr name,
auto jsgobserver = kj::atomicRefcounted<JsgIsolateObserver>();
auto observer = kj::atomicRefcounted<IsolateObserver>();
auto limitEnforcer = kj::refcounted<NullIsolateLimitEnforcer>();
auto isolateGroup = v8::IsolateGroup::GetDefault();
auto isolateGroup = jsg::newIsolateGroup();

kj::Array<Worker::Api::InboundListener> listeners;
KJ_IF_SOME(l, inboundListeners.find(inboundListenersKey)) {
Expand Down
Loading