Skip to content

Commit 6372646

Browse files
Merge branch 'main' into 50649
2 parents 6040046 + 16a5479 commit 6372646

File tree

12 files changed

+69
-42
lines changed

12 files changed

+69
-42
lines changed

benchmark/crypto/hkdf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {
1414
salt: ['', 'salt'],
1515
info: ['', 'info'],
1616
hash: ['sha256', 'sha512'],
17-
n: [1e3],
17+
n: [1e4],
1818
});
1919

2020
function measureSync(n, size, salt, info, hash, key) {

deps/googletest/src/gtest.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <algorithm>
4444
#include <chrono> // NOLINT
4545
#include <cmath>
46+
#include <csignal> // NOLINT: raise(3) is used on some platforms
4647
#include <cstdint>
4748
#include <cstdlib>
4849
#include <cstring>

doc/contributing/maintaining/maintaining-dependencies.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This a list of all the dependencies:
1515
* [c-ares 1.20.1][]
1616
* [cjs-module-lexer 1.2.2][]
1717
* [corepack][]
18-
* [googletest 116b7e5][]
18+
* [googletest 76bb2af][]
1919
* [histogram 0.11.8][]
2020
* [icu-small 74.1][]
2121
* [libuv 1.46.0][]
@@ -190,7 +190,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to
190190
install them - just like what currently happens with npm, which is shipped
191191
by Node.js by default.
192192

193-
### googletest 116b7e5
193+
### googletest 76bb2af
194194

195195
The [googletest](https://github.com/google/googletest) dependency is Google’s
196196
C++ testing and mocking framework.
@@ -332,7 +332,7 @@ performance improvements not currently available in standard zlib.
332332
[cjs-module-lexer 1.2.2]: #cjs-module-lexer-122
333333
[corepack]: #corepack
334334
[dependency-update-action]: ../../../.github/workflows/tools.yml
335-
[googletest 116b7e5]: #googletest-116b7e5
335+
[googletest 76bb2af]: #googletest-76bb2af
336336
[histogram 0.11.8]: #histogram-0118
337337
[icu-small 74.1]: #icu-small-741
338338
[libuv 1.46.0]: #libuv-1460

lib/fs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,6 +2343,8 @@ function writeFileSync(path, data, options) {
23432343

23442344
validateBoolean(flush, 'options.flush');
23452345

2346+
const flag = options.flag || 'w';
2347+
23462348
// C++ fast path for string data and UTF8 encoding
23472349
if (typeof data === 'string' && (options.encoding === 'utf8' || options.encoding === 'utf-8')) {
23482350
if (!isInt32(path)) {
@@ -2351,7 +2353,7 @@ function writeFileSync(path, data, options) {
23512353

23522354
return binding.writeFileUtf8(
23532355
path, data,
2354-
stringToFlags(options.flag),
2356+
stringToFlags(flag),
23552357
parseFileMode(options.mode, 'mode', 0o666),
23562358
);
23572359
}
@@ -2361,8 +2363,6 @@ function writeFileSync(path, data, options) {
23612363
data = Buffer.from(data, options.encoding || 'utf8');
23622364
}
23632365

2364-
const flag = options.flag || 'w';
2365-
23662366
const isUserFd = isFd(path); // File descriptor ownership
23672367
const fd = isUserFd ? path : fs.openSync(path, flag, options.mode);
23682368

src/api/environment.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ Maybe<bool> InitializeContextRuntime(Local<Context> context) {
734734
}
735735
} else if (per_process::cli_options->disable_proto != "") {
736736
// Validated in ProcessGlobalArgs
737-
OnFatalError("InitializeContextRuntime()", "invalid --disable-proto mode");
737+
UNREACHABLE("invalid --disable-proto mode");
738738
}
739739

740740
return Just(true);

src/inspector_agent.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
namespace node {
3737
namespace inspector {
3838
namespace {
39-
40-
using node::OnFatalError;
41-
4239
using v8::Context;
4340
using v8::Function;
4441
using v8::HandleScope;
@@ -917,8 +914,7 @@ void Agent::ToggleAsyncHook(Isolate* isolate, Local<Function> fn) {
917914
USE(fn->Call(context, Undefined(isolate), 0, nullptr));
918915
if (try_catch.HasCaught() && !try_catch.HasTerminated()) {
919916
PrintCaughtException(isolate, context, try_catch);
920-
OnFatalError("\nnode::inspector::Agent::ToggleAsyncHook",
921-
"Cannot toggle Inspector's AsyncHook, please report this.");
917+
UNREACHABLE("Cannot toggle Inspector's AsyncHook, please report this.");
922918
}
923919
}
924920

src/node_errors.cc

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,7 @@ void AppendExceptionLine(Environment* env,
376376
.FromMaybe(false));
377377
}
378378

379-
[[noreturn]] void Abort() {
380-
DumpNativeBacktrace(stderr);
381-
DumpJavaScriptBacktrace(stderr);
382-
fflush(stderr);
383-
ABORT_NO_BACKTRACE();
384-
}
385-
386-
[[noreturn]] void Assert(const AssertionInfo& info) {
379+
void Assert(const AssertionInfo& info) {
387380
std::string name = GetHumanReadableProcessName();
388381

389382
fprintf(stderr,
@@ -396,15 +389,15 @@ void AppendExceptionLine(Environment* env,
396389
info.message);
397390

398391
fflush(stderr);
399-
Abort();
392+
ABORT();
400393
}
401394

402395
enum class EnhanceFatalException { kEnhance, kDontEnhance };
403396

404397
/**
405398
* Report the exception to the inspector, then print it to stderr.
406399
* This should only be used when the Node.js instance is about to exit
407-
* (i.e. this should be followed by a env->Exit() or an Abort()).
400+
* (i.e. this should be followed by a env->Exit() or an ABORT()).
408401
*
409402
* Use enhance_stack = EnhanceFatalException::kDontEnhance
410403
* when it's unsafe to call into JavaScript.
@@ -576,8 +569,7 @@ static void ReportFatalException(Environment* env,
576569
ABORT();
577570
}
578571

579-
[[noreturn]] void OOMErrorHandler(const char* location,
580-
const v8::OOMDetails& details) {
572+
void OOMErrorHandler(const char* location, const v8::OOMDetails& details) {
581573
// We should never recover from this handler so once it's true it's always
582574
// true.
583575
is_in_oom.store(true);
@@ -1063,7 +1055,7 @@ static void TriggerUncaughtException(const FunctionCallbackInfo<Value>& args) {
10631055
if (env != nullptr && env->abort_on_uncaught_exception()) {
10641056
ReportFatalException(
10651057
env, exception, message, EnhanceFatalException::kEnhance);
1066-
Abort();
1058+
ABORT();
10671059
}
10681060
bool from_promise = args[1]->IsTrue();
10691061
errors::TriggerUncaughtException(isolate, exception, message, from_promise);
@@ -1174,7 +1166,7 @@ void TriggerUncaughtException(Isolate* isolate,
11741166
// much we can do, so we just print whatever is useful and crash.
11751167
PrintToStderrAndFlush(
11761168
FormatCaughtException(isolate, context, error, message));
1177-
Abort();
1169+
ABORT();
11781170
}
11791171

11801172
// Invoke process._fatalException() to give user a chance to handle it.

src/node_errors.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ void AppendExceptionLine(Environment* env,
1919
v8::Local<v8::Message> message,
2020
enum ErrorHandlingMode mode);
2121

22+
// This function calls backtrace, it should have not be marked as [[noreturn]].
23+
// But it is a public API, removing the attribute can break.
24+
// Prefer UNREACHABLE() internally instead, it doesn't need manually set
25+
// location.
2226
[[noreturn]] void OnFatalError(const char* location, const char* message);
23-
[[noreturn]] void OOMErrorHandler(const char* location,
24-
const v8::OOMDetails& details);
27+
// This function calls backtrace, do not mark as [[noreturn]]. Read more in the
28+
// ABORT macro.
29+
void OOMErrorHandler(const char* location, const v8::OOMDetails& details);
2530

2631
// Helpers to construct errors similar to the ones provided by
2732
// lib/internal/errors.js.

src/node_process_methods.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Mutex umask_mutex;
6464
#define NANOS_PER_SEC 1000000000
6565

6666
static void Abort(const FunctionCallbackInfo<Value>& args) {
67-
Abort();
67+
ABORT();
6868
}
6969

7070
// For internal testing only, not exposed to userland.

src/node_watchdog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms, bool* timed_out)
4545
int rc;
4646
rc = uv_loop_init(&loop_);
4747
if (rc != 0) {
48-
OnFatalError("node::Watchdog::Watchdog()", "Failed to initialize uv loop.");
48+
UNREACHABLE("Failed to initialize uv loop.");
4949
}
5050

5151
rc = uv_async_init(&loop_, &async_, [](uv_async_t* signal) {

0 commit comments

Comments
 (0)