Skip to content

Commit

Permalink
feat: support node-v19.x (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyj1991 committed Oct 21, 2022
1 parent 333593e commit f4eb960
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
{os: "macos-latest", arch: "x64"},
{os: "ubuntu-latest", arch: "x64"},
]
node-version: [ 12, 14, 16, 18 ]
node-version: [ 12, 14, 16, 18, 19 ]
steps:
- name: Checkout Git Source
uses: actions/checkout@master
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ xprofiler 插件支持三大主流操作系统:
- v16.x
- v17.x
- v18.x
v v19.x

更低的版本因为在此项目创建时已经不在官方 LTS 计划中,故正常情况下不再支持。

Expand Down
4 changes: 2 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
["OS == 'linux'", {
"cflags": [
"-O3",
"-std=c++14",
"-std=c++17",
"-Wno-sign-compare",
"-Wno-cast-function-type",
],
Expand All @@ -80,7 +80,7 @@
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"GCC_OPTIMIZATION_LEVEL": "3",
"OTHER_CFLAGS": [
"-std=c++14",
"-std=c++17",
"-Wconversion",
"-Wno-sign-conversion",
]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"dependencies": {
"@xprofiler/node-pre-gyp": "^1.0.9",
"moment": "^2.29.4",
"nan": "^2.16.0",
"nan": "^2.17.0",
"uuid": "^9.0.0",
"yargs": "^17.5.1"
},
Expand Down
13 changes: 11 additions & 2 deletions src/hooks/fatal_error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,19 @@ void DumpBeforeAbort(const char* location, const char* message) {
}
}

#if (NODE_MODULE_VERSION > NODE_18_0_MODULE_VERSION)
[[noreturn]] void OnOOMError(const char* location,
const v8::OOMDetails& details) {
const char* message =
details.detail != nullptr ? details.detail
: details.is_heap_oom
#else
[[noreturn]] void OnOOMError(const char* location, bool is_heap_oom) {
const char* message =
is_heap_oom ? "Allocation failed - JavaScript heap out of memory"
: "Allocation failed - process out of memory";
is_heap_oom
#endif
? "Allocation failed - JavaScript heap out of memory"
: "Allocation failed - process out of memory";
DumpBeforeAbort(location, message);
Abort();
}
Expand Down
4 changes: 2 additions & 2 deletions src/platform/unix/core/linux/elfcore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,8 @@ static int CreateElfCore(void* handle,
/* We could save the first page of ELF to record the BuildId,
* let the debugger later find the corresponding binary it used.
*/
if (!dontdump && mappings[i].write_size == 0 &&
(mappings[i].flags & PF_X) != 0) {
if (!dontdump && mappings[i].write_size == 0 &&
(mappings[i].flags & PF_X) != 0) {
mappings[i].write_size = pagesize;
}

Expand Down

0 comments on commit f4eb960

Please sign in to comment.