From acbec089757b3a95d56b3fc457de7c72787ccaeb Mon Sep 17 00:00:00 2001
From: Peter Marshall
Date: Thu, 14 Sep 2017 12:51:54 +0200
Subject: [PATCH] build: replace runtime flag with compiler option
V8 changed the typed array threshold option from a runtime flag to a
compile-time option.
PR-URL: https://github.com/nodejs/node/pull/16271
Reviewed-By: Ben Noordhuis
Reviewed-By: Myles Borins
(cherry picked from commit 2c75b52af88961e15563ddf452ba1c199ad0ef53)
Conflicts:
src/node.cc
---
configure | 4 ++++
src/node.cc | 6 ------
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index 9e04b03d4fe..afb49ef55a2 100755
--- a/configure
+++ b/configure
@@ -1001,6 +1001,10 @@ def configure_v8(o):
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
o['variables']['force_dynamic_crt'] = 1 if options.shared else 0
o['variables']['node_enable_d8'] = b(options.enable_d8)
+ # Unconditionally force typed arrays to allocate outside the v8 heap. This
+ # is to prevent memory pointers from being moved around that are returned by
+ # Buffer::Data().
+ o['variables']['v8_typed_array_max_size_in_heap'] = 0
if options.enable_d8:
o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp.
if options.without_bundled_v8 and options.enable_d8:
diff --git a/src/node.cc b/src/node.cc
index 2a18582aeba..c53819b49de 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -4676,12 +4676,6 @@ void Init(int* argc,
#endif
} // g_upstream_node_mode
- // Unconditionally force typed arrays to allocate outside the v8 heap. This
- // is to prevent memory pointers from being moved around that are returned by
- // Buffer::Data().
- const char no_typed_array_heap[] = "--typed_array_max_size_in_heap=0";
- V8::SetFlagsFromString(no_typed_array_heap, sizeof(no_typed_array_heap) - 1);
-
// We should set node_is_initialized here instead of in node::Start,
// otherwise embedders using node::Init to initialize everything will not be
// able to set it and native modules will not load for them.