From 3424f71cc900ce2bb22615630c37ba236a2060a4 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Tue, 15 May 2018 12:12:09 -0400 Subject: [PATCH] deps: patch V8 to 6.6.346.32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/20748 Refs: https://github.com/v8/v8/compare/6.6.346.31...6.6.346.32 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gus Caplan --- deps/v8/include/v8-version.h | 2 +- deps/v8/src/managed.h | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index dac19fa6213..cdb2c5381e3 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 6 #define V8_BUILD_NUMBER 346 -#define V8_PATCH_LEVEL 31 +#define V8_PATCH_LEVEL 32 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/managed.h b/deps/v8/src/managed.h index 63fefdd480a..d0ccb4e739d 100644 --- a/deps/v8/src/managed.h +++ b/deps/v8/src/managed.h @@ -59,22 +59,30 @@ class Managed : public Foreign { isolate->factory()->NewForeign(reinterpret_cast
(finalizer))); Handle global_handle = isolate->global_handles()->Create(*handle); finalizer->global_handle_location = global_handle.location(); - GlobalHandles::MakeWeak(finalizer->global_handle_location, - handle->GetFinalizer(), &Managed::GCDelete, - v8::WeakCallbackType::kParameter); + GlobalHandles::MakeWeak( + finalizer->global_handle_location, handle->GetFinalizer(), + &ResetWeakAndScheduleGCDelete, v8::WeakCallbackType::kParameter); return handle; } private: + static void ResetWeakAndScheduleGCDelete( + const v8::WeakCallbackInfo& data) { + FinalizerWithHandle* finalizer = + reinterpret_cast(data.GetParameter()); + GlobalHandles::Destroy(finalizer->global_handle_location); + Isolate* isolate = reinterpret_cast(data.GetIsolate()); + isolate->UnregisterFromReleaseAtTeardown(finalizer); + // We need to call GCDelete as a second pass callback because + // it can trigger garbage collection. The first pass callbacks + // are not allowed to invoke V8 API. + data.SetSecondPassCallback(&GCDelete); + } + static void GCDelete(const v8::WeakCallbackInfo& data) { FinalizerWithHandle* finalizer = reinterpret_cast(data.GetParameter()); - - Isolate* isolate = reinterpret_cast(data.GetIsolate()); - isolate->UnregisterFromReleaseAtTeardown(finalizer); - - GlobalHandles::Destroy(finalizer->global_handle_location); NativeDelete(finalizer); }