isolated-vm
Advanced tools
+2
-2
| { | ||
| "name": "isolated-vm", | ||
| "version": "5.0.4", | ||
| "version": "6.0.0", | ||
| "description": "Access to multiple isolates", | ||
@@ -8,3 +8,3 @@ "main": "isolated-vm.js", | ||
| "engines": { | ||
| "node": ">=18.0.0" | ||
| "node": ">=24.0.0" | ||
| }, | ||
@@ -11,0 +11,0 @@ "scripts": { |
@@ -118,13 +118,2 @@ #include "allocator.h" | ||
| auto LimitedAllocator::Reallocate(void* data, size_t old_length, size_t new_length) -> void* { | ||
| auto delta = static_cast<ssize_t>(new_length) - static_cast<ssize_t>(old_length); | ||
| if (delta > 0) { | ||
| if (!Check(delta)) { | ||
| return nullptr; | ||
| } | ||
| } | ||
| env.extra_allocated_memory += delta; | ||
| return ArrayBuffer::Allocator::Reallocate(data, old_length, new_length); | ||
| } | ||
| void LimitedAllocator::AdjustAllocatedSize(ptrdiff_t length) { | ||
@@ -131,0 +120,0 @@ env.extra_allocated_memory += length; |
@@ -16,3 +16,2 @@ #pragma once | ||
| public: | ||
@@ -24,3 +23,2 @@ auto Check(size_t length) -> bool; | ||
| void Free(void* data, size_t length) final; | ||
| auto Reallocate(void* data, size_t old_length, size_t new_length) -> void* final; | ||
@@ -27,0 +25,0 @@ // This is used by ExternalCopy when an ArrayBuffer is transferred. The memory is not freed but |
@@ -95,3 +95,3 @@ #pragma once | ||
| v8::Local<v8::String> name_handle = v8_symbol(name); | ||
| proto->SetAccessor(name_handle, impl.getter.callback, impl.setter.callback); | ||
| proto->SetNativeDataProperty(name_handle, impl.getter.callback, impl.setter.callback); | ||
| Add(args...); | ||
@@ -98,0 +98,0 @@ } |
@@ -43,2 +43,3 @@ #include "environment.h" | ||
| return base; | ||
| } | ||
| #elif defined __FreeBSD__ | ||
@@ -45,0 +46,0 @@ #include <pthread_np.h> |
@@ -111,3 +111,3 @@ #pragma once | ||
| // Copyable traits used to opt into destructor handle reset | ||
| std::deque<v8::Persistent<v8::Promise, v8::CopyablePersistentTraits<v8::Promise>>> unhandled_promise_rejections; | ||
| std::deque<v8::Global<v8::Promise>> unhandled_promise_rejections; | ||
| StringTable string_table; | ||
@@ -114,0 +114,0 @@ |
@@ -66,3 +66,3 @@ #include "holder.h" | ||
| // Methods for v8::TaskRunner | ||
| void IsolateTaskRunner::PostTask(std::unique_ptr<v8::Task> task) { | ||
| void IsolateTaskRunner::PostTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation& /*location*/) { | ||
| auto env = weak_env.lock(); | ||
@@ -74,3 +74,3 @@ if (env) { | ||
| void IsolateTaskRunner::PostDelayedTask(std::unique_ptr<v8::Task> task, double delay_in_seconds) { | ||
| void IsolateTaskRunner::PostDelayedTaskImpl(std::unique_ptr<v8::Task> task, double delay_in_seconds, const v8::SourceLocation& /*location*/) { | ||
| // wait_detached erases the type of the lambda into a std::function which must be | ||
@@ -77,0 +77,0 @@ // copyable. The unique_ptr is stored in a shared pointer so ownership can be handled correctly. |
@@ -55,5 +55,5 @@ #pragma once | ||
| // Methods for v8::TaskRunner | ||
| void PostTask(std::unique_ptr<v8::Task> task) final; | ||
| void PostDelayedTask(std::unique_ptr<v8::Task> task, double delay_in_seconds) final; | ||
| void PostNonNestableTask(std::unique_ptr<v8::Task> task) final { PostTask(std::move(task)); } | ||
| void PostTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation& /*location*/) final; | ||
| void PostDelayedTaskImpl(std::unique_ptr<v8::Task> task, double delay_in_seconds, const v8::SourceLocation& /*location*/) final; | ||
| void PostNonNestableTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation& /*location*/) final { PostTask(std::move(task)); } | ||
@@ -60,0 +60,0 @@ private: |
@@ -15,9 +15,9 @@ #pragma once | ||
| // Methods for v8::TaskRunner | ||
| void PostTask(std::unique_ptr<v8::Task> task) override = 0; | ||
| void PostDelayedTask(std::unique_ptr<v8::Task> task, double delay_in_seconds) override = 0; | ||
| void PostIdleTask(std::unique_ptr<v8::IdleTask> /*task*/) final { std::terminate(); } | ||
| void PostTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation& location) override = 0; | ||
| void PostDelayedTaskImpl(std::unique_ptr<v8::Task> task, double delay_in_seconds, const v8::SourceLocation& location) override = 0; | ||
| void PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> /*task*/, const v8::SourceLocation& /*location*/) final { std::terminate(); } | ||
| // Can't be final because symbol is also used in IsolatePlatformDelegate | ||
| auto IdleTasksEnabled() -> bool override { return false; }; | ||
| auto NonNestableTasksEnabled() const -> bool final { return true; } | ||
| void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> /*task*/, double /*delay_in_seconds*/) final { std::terminate(); } | ||
| // void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> /*task*/, double /*delay_in_seconds*/) final { std::terminate(); } | ||
| auto NonNestableDelayedTasksEnabled() const -> bool final { return false; } | ||
@@ -24,0 +24,0 @@ }; |
@@ -20,3 +20,3 @@ #pragma once | ||
| HandleTupleElement(v8::Isolate* isolate, v8::Local<Type> local) : persistent{isolate, local} {} | ||
| v8::Persistent<Type, v8::NonCopyablePersistentTraits<Type>> persistent; | ||
| v8::Persistent<Type> persistent; | ||
| }; | ||
@@ -23,0 +23,0 @@ |
@@ -103,3 +103,3 @@ #include "stack_trace.h" | ||
| Unmaybe(error->SetPrivate(context, GetPrivateStackSymbol(), data)); | ||
| Unmaybe(error->SetAccessor( | ||
| Unmaybe(error->SetNativeDataProperty( | ||
| context, | ||
@@ -109,3 +109,2 @@ StringTable::Get().stack, | ||
| Local<Value>(), | ||
| AccessControl::DEFAULT, | ||
| PropertyAttribute::DontEnum | ||
@@ -112,0 +111,0 @@ )); |
@@ -16,3 +16,3 @@ #pragma once | ||
| public: | ||
| v8::Persistent<v8::StackTrace, v8::CopyablePersistentTraits<v8::StackTrace>> stack_trace; | ||
| v8::Global<v8::StackTrace> stack_trace; | ||
| explicit StackTraceHolder(v8::Local<v8::StackTrace> stack_handle); | ||
@@ -19,0 +19,0 @@ static auto Definition() -> v8::Local<v8::FunctionTemplate>; |
@@ -30,3 +30,3 @@ #pragma once | ||
| template <typename T> | ||
| auto Deref(const v8::Persistent<T, v8::CopyablePersistentTraits<T>>& handle) -> v8::Local<T> { | ||
| auto Deref(const v8::Global<T>& handle) -> v8::Local<T> { | ||
| return v8::Local<T>::New(v8::Isolate::GetCurrent(), handle); | ||
@@ -33,0 +33,0 @@ } |
@@ -17,3 +17,3 @@ #include "callback.h" | ||
| return Inherit<TransferableHandle>(MakeClass( | ||
| "Callback", ConstructorFunction<decltype(&New), &New>{} | ||
| "Callback", ConstructorFunction<decltype(&CallbackHandle::New), &CallbackHandle::New>{} | ||
| )); | ||
@@ -20,0 +20,0 @@ } |
@@ -24,3 +24,2 @@ #include "isolate/class_handle.h" | ||
| return ScriptOrigin{ | ||
| Isolate::GetCurrent(), | ||
| HandleCast<Local<String>>(filename), | ||
@@ -27,0 +26,0 @@ line_offset, |
@@ -32,3 +32,3 @@ #include "external_copy_handle.h" | ||
| return Inherit<TransferableHandle>(MakeClass( | ||
| "ExternalCopy", ConstructorFunction<decltype(&New), &New>{}, | ||
| "ExternalCopy", ConstructorFunction<decltype(&ExternalCopyHandle::New), &ExternalCopyHandle::New>{}, | ||
| "totalExternalSize", StaticAccessor<decltype(&ExternalCopyHandle::TotalExternalSizeGetter), &ExternalCopyHandle::TotalExternalSizeGetter>{}, | ||
@@ -35,0 +35,0 @@ "copy", MemberFunction<decltype(&ExternalCopyHandle::Copy), &ExternalCopyHandle::Copy>{}, |
@@ -44,3 +44,3 @@ #include "isolate_handle.h" | ||
| return Inherit<TransferableHandle>(MakeClass( | ||
| "Isolate", ConstructorFunction<decltype(&New), &New>{}, | ||
| "Isolate", ConstructorFunction<decltype(&IsolateHandle::New), &IsolateHandle::New>{}, | ||
| "createSnapshot", FreeFunction<decltype(&CreateSnapshot), &CreateSnapshot>{}, | ||
@@ -143,3 +143,3 @@ "compileScript", MemberFunction<decltype(&IsolateHandle::CompileScript<1>), &IsolateHandle::CompileScript<1>>{}, | ||
| struct ContextDeleter { | ||
| void operator() (Persistent<Context>& context) const { | ||
| void operator() (v8::Persistent<Context>& context) const { | ||
| auto& env = IsolateEnvironment::GetCurrent(); | ||
@@ -488,6 +488,6 @@ context.Reset(); | ||
| // Methods for v8::TaskRunner | ||
| void PostTask(std::unique_ptr<v8::Task> task) final { | ||
| void PostTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation& /*location*/) final { | ||
| tasks.write()->push_back(std::move(task)); | ||
| } | ||
| void PostDelayedTask(std::unique_ptr<v8::Task> task, double /*delay_in_seconds*/) final { | ||
| void PostDelayedTaskImpl(std::unique_ptr<v8::Task> task, double /*delay_in_seconds*/, const v8::SourceLocation& /*location*/) final { | ||
| if (!done) { | ||
@@ -497,3 +497,3 @@ PostTask(std::move(task)); | ||
| } | ||
| void PostNonNestableTask(std::unique_ptr<v8::Task> task) final { | ||
| void PostNonNestableTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation& /*location*/) final { | ||
| PostTask(std::move(task)); | ||
@@ -500,0 +500,0 @@ } |
@@ -54,3 +54,3 @@ #include "native_module_handle.h" | ||
| return Inherit<TransferableHandle>(MakeClass( | ||
| "NativeModule", ConstructorFunction<decltype(&New), &New>{}, | ||
| "NativeModule", ConstructorFunction<decltype(&NativeModuleHandle::New), &NativeModuleHandle::New>{}, | ||
| "create", MemberFunction<decltype(&NativeModuleHandle::Create<1>), &NativeModuleHandle::Create<1>>{}, | ||
@@ -57,0 +57,0 @@ "createSync", MemberFunction<decltype(&NativeModuleHandle::Create<0>), &NativeModuleHandle::Create<0>>{} |
@@ -110,3 +110,3 @@ #include "reference_handle.h" | ||
| return Inherit<TransferableHandle>(MakeClass( | ||
| "Reference", ConstructorFunction<decltype(&New), &New>{}, | ||
| "Reference", ConstructorFunction<decltype(&ReferenceHandle::New), &ReferenceHandle::New>{}, | ||
| "deref", MemberFunction<decltype(&ReferenceHandle::Deref), &ReferenceHandle::Deref>{}, | ||
@@ -113,0 +113,0 @@ "derefInto", MemberFunction<decltype(&ReferenceHandle::DerefInto), &ReferenceHandle::DerefInto>{}, |
Sorry, the diff of this file is not supported yet
506637
0