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 334e702cae9ea874cc9f08f47b88af7fa60dd13b..87076ea0f7a16f1db57e574d7e4d51b1d32b7d02 100644
--- a/gin/public/v8_platform.h
+++ b/gin/public/v8_platform.h
@@ -30,6 +30,7 @@ class GIN_EXPORT V8Platform : public v8::Platform {
   // enabling Arm's Branch Target Instructions for executable pages. This is
   // verified in the tests for gin::PageAllocator.
   PageAllocator* GetPageAllocator() override;
+  static PageAllocator* PageAllocator();
   void OnCriticalMemoryPressure() override;
   v8::ZoneBackingAllocator* GetZoneBackingAllocator() override;
 #endif
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc
index 0e03069bfd06a418caef6e26d074b3fbe5aed4e7..46264c21239b5ed10e10bb23ec081713627d7da8 100644
--- a/gin/v8_platform.cc
+++ b/gin/v8_platform.cc
@@ -367,6 +367,10 @@ PageAllocator* V8Platform::GetPageAllocator() {
   return g_page_allocator.Pointer();
 }
 
+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.
