GeezerVison is showing github.com — deps: V8: cherry-pick 1a782f6543ae · nodejs/node@d91b0fd
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: common.gypi +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
36 | 36 |
|
37 | 37 | # Reset this number to 0 on major V8 upgrades. |
38 | 38 | # Increment by one for each non-official patch applied to deps/v8. |
39 | | - 'v8_embedder_string': '-node.9', |
| 39 | + 'v8_embedder_string': '-node.10', |
40 | 40 |
|
41 | 41 | ##### V8 defaults for Node.js ##### |
42 | 42 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: deps/v8/BUILD.gn +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -83,6 +83,17 @@ declare_args() { |
83 | 83 | # Sets -dENABLE_HUGEPAGE |
84 | 84 | v8_enable_hugepage = false |
85 | 85 |
|
| 86 | + # Sets -dV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION. |
| 87 | + # |
| 88 | + # This flag speeds up the performance of fork/execve on Linux systems for |
| 89 | + # embedders which use it (like Node.js). It works by marking the pages that |
| 90 | + # V8 allocates as MADV_DONTFORK. Without MADV_DONTFORK, the Linux kernel |
| 91 | + # spends a long time manipulating page mappings on fork and exec which the |
| 92 | + # child process doesn't generally need to access. |
| 93 | + # |
| 94 | + # See v8:7381 for more details. |
| 95 | + v8_enable_private_mapping_fork_optimization = false |
| 96 | + |
86 | 97 | # Sets -dENABLE_HANDLE_ZAPPING. |
87 | 98 | v8_enable_handle_zapping = is_asan || is_debug |
88 | 99 |
|
@@ -971,6 +982,9 @@ config("features") { |
971 | 982 | if (v8_enable_hugepage) { |
972 | 983 | defines += [ "ENABLE_HUGEPAGE" ] |
973 | 984 | } |
| 985 | + if (v8_enable_private_mapping_fork_optimization) { |
| 986 | + defines += [ "V8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION" ] |
| 987 | + } |
974 | 988 | if (v8_enable_object_print) { |
975 | 989 | defines += [ "OBJECT_PRINT" ] |
976 | 990 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: deps/v8/src/base/platform/platform-posix.cc +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -158,6 +158,12 @@ void* Allocate(void* hint, size_t size, OS::MemoryPermission access, |
158 | 158 | int flags = GetFlagsForMemoryPermission(access, page_type); |
159 | 159 | void* result = mmap(hint, size, prot, flags, kMmapFd, kMmapFdOffset); |
160 | 160 | if (result == MAP_FAILED) return nullptr; |
| 161 | + |
| 162 | +#if V8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION |
| 163 | + // This is advisory, so we ignore errors. |
| 164 | + madvise(result, size, MADV_DONTFORK); |
| 165 | +#endif |
| 166 | + |
161 | 167 | #if ENABLE_HUGEPAGE |
162 | 168 | if (result != nullptr && size >= kHugePageSize) { |
163 | 169 | const uintptr_t huge_start = |
|