From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <samuel.r.attard@gmail.com>
Date: Tue, 3 Nov 2020 16:49:32 -0800
Subject: export gin::V8Platform::PageAllocator for usage outside of the gin
 platform

In order for memory allocation in the main process node environment to be
correctly tagged with MAP_JIT we need to use gins page allocator instead
of the default V8 allocator.  This probably can't be usptreamed.

diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h
index fa0e7faad9296b9be8d662324c52f40e502f2e38..a579b359c684ccd72dcbe43f40b4aa7b4779c36b 100644
--- a/gin/public/v8_platform.h
+++ b/gin/public/v8_platform.h
@@ -25,6 +25,7 @@ class GIN_EXPORT V8Platform : public v8::Platform {
 // Some configurations do not use page_allocator.
 #if BUILDFLAG(USE_PARTITION_ALLOC)
   v8::PageAllocator* GetPageAllocator() override;
+  static v8::PageAllocator* PageAllocator();
   void OnCriticalMemoryPressure() override;
 #endif
   std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
index 60f38b2dd015bea3410e8c69e9cb4a1d092e299b..4f44735c4e841f82091bdab474790d3f1a1a76ad 100644
--- a/gin/v8_platform.cc
+++ b/gin/v8_platform.cc
@@ -465,6 +465,10 @@ v8::PageAllocator* V8Platform::GetPageAllocator() {
   return g_page_allocator.Pointer();
 }
 
+v8::PageAllocator* V8Platform::PageAllocator() {
+  return g_page_allocator.Pointer();
+}
+
 void V8Platform::OnCriticalMemoryPressure() {
 // We only have a reservation on 32-bit Windows systems.
 // TODO(bbudge) Make the #if's in BlinkInitializer match.
