mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src,build: configure V8_EMBEDDER_DATA_ARRAY_SIZE
Refs: https://issues.chromium.org/issues/570436596 Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
1 parent
0ebe9b2e54
commit
145831dcc4
2 files changed
+16
-5
No files matched your search
@@ -96,6 +96,8 @@
|
||||
'v8_enable_sandbox%': 0,
|
||||
'v8_enable_v8_checks%': 0,
|
||||
'v8_use_perfetto%': 0,
|
||||
# Must be greater than NODE_CONTEXT_TAG in src/node_context_data.h.
|
||||
'v8_embedder_data_array_size%': 40,
|
||||
'tsan%': 0,
|
||||
|
||||
##### end V8 defaults #####
|
||||
@@ -569,6 +571,11 @@
|
||||
['v8_use_perfetto == 1', {
|
||||
'defines': ['V8_USE_PERFETTO',],
|
||||
}],
|
||||
['v8_embedder_data_array_size != 0', {
|
||||
'defines': [
|
||||
'V8_EMBEDDER_DATA_ARRAY_SIZE=<(v8_embedder_data_array_size)',
|
||||
],
|
||||
}],
|
||||
['v8_enable_map_packing == 1', {
|
||||
'defines': ['V8_MAP_PACKING',],
|
||||
}],
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
namespace node {
|
||||
|
||||
// Pick an index that's hopefully out of the way when we're embedded inside
|
||||
// another application. Performance-wise or memory-wise it doesn't matter:
|
||||
// Context::SetAlignedPointerInEmbedderData() is backed by a FixedArray,
|
||||
// worst case we pay a one-time penalty for resizing the array.
|
||||
// another application. V8 allocates the context embedder data array with a
|
||||
// fixed size of V8_EMBEDDER_DATA_ARRAY_SIZE, which must cover every index
|
||||
// below.
|
||||
#ifndef NODE_CONTEXT_EMBEDDER_DATA_INDEX
|
||||
#define NODE_CONTEXT_EMBEDDER_DATA_INDEX 32
|
||||
#endif
|
||||
@@ -48,10 +48,14 @@ namespace node {
|
||||
#define NODE_CONTEXT_TAG 39
|
||||
#endif
|
||||
|
||||
static_assert(NODE_CONTEXT_TAG < V8_EMBEDDER_DATA_ARRAY_SIZE,
|
||||
"V8 must be built with v8_embedder_data_array_size greater than "
|
||||
"NODE_CONTEXT_TAG");
|
||||
|
||||
/**
|
||||
* These are indexes used to set Node.js-specific data in the V8 contexts
|
||||
* via v8::Context::SetAlignedPointerInEmbedderData() (for pointers) and
|
||||
* v8::Context::SetEmbedderData() (for v8::Values).
|
||||
* via v8::Context::SetAlignedPointerInEmbedderDataV2() (for pointers) and
|
||||
* v8::Context::SetEmbedderDataV3() (for v8::Values).
|
||||
*
|
||||
* There are five types of contexts in Node.js:
|
||||
* 1. Default V8 context, with nothing Node.js-specific. This is normally only
|
||||
|
||||
Reference in new issue
Block a user