Skip to content

Conversation

@islandryu
Copy link
Member

Fixes: #61301

I’ve made changes so that V8_ENABLE_CHECKS is enabled in debug builds.
In addition, I’ve fixed code that caused errors when V8_ENABLE_CHECKS is enabled.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jan 9, 2026
configure.py Outdated
Comment on lines 1484 to 1492
def set_configuration_variable_and_defines(configs, name, define, release=None, debug=None):
set_configuration_variable(configs, name, release, debug)
if configs['Debug'].get('defines') is None:
configs['Debug']['defines'] = []
if configs['Release'].get('defines') is None:
configs['Release']['defines'] = []
configs['Debug']['defines'].append(define)
configs['Release']['defines'].append(define)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a GYP issue, but it seems that variables defined inside a conditions block are not reflected when evaluating other conditions.
In this case, the value of v8_enable_v8_checks set in configure.py (https://github.com/nodejs/node/blob/main/configure.py#L1530-L1532
) does not appear to be used when evaluating the condition 'v8_enable_v8_checks==1' in tools/v8_gypfiles/features.gypi (https://github.com/nodejs/node/blob/main/tools/v8_gypfiles/features.gypi#L405-L407
).

Therefore, I’m setting the defines directly.

@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.51%. Comparing base (37d9cfc) to head (fef59e5).
⚠️ Report is 156 commits behind head on main.

Files with missing lines Patch % Lines
src/node_util.cc 0.00% 0 Missing and 1 partial ⚠️
src/util-inl.h 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #61327    +/-   ##
========================================
  Coverage   88.51%   88.51%            
========================================
  Files         703      704     +1     
  Lines      208430   208745   +315     
  Branches    40198    40273    +75     
========================================
+ Hits       184491   184780   +289     
- Misses      15951    15969    +18     
- Partials     7988     7996     +8     
Files with missing lines Coverage Δ
lib/util.js 97.98% <100.00%> (+0.01%) ⬆️
src/heap_utils.cc 79.93% <100.00%> (-0.21%) ⬇️
src/node_builtins.cc 76.66% <100.00%> (+0.37%) ⬆️
src/node_util.cc 80.95% <0.00%> (+0.95%) ⬆️
src/util-inl.h 81.87% <83.33%> (-0.04%) ⬇️

... and 78 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

lib/util.js Outdated
Comment on lines 461 to 462
frameCount = MathFloor(frameCount);
return binding.getCallSites(frameCount);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
frameCount = MathFloor(frameCount);
return binding.getCallSites(frameCount);
return binding.getCallSites(MathFloor(frameCount));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is experimental, would it make more sense to switch to validateInteger?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I switched to validateInteger to limit it to integers.

@@ -441,7 +442,7 @@ void BuiltinLoader::SaveCodeCache(const std::string& id, Local<Data> data) {
new_cached_data.reset(
ScriptCompiler::CreateCodeCache(mod->GetUnboundModuleScript()));
} else {
Local<Function> fun = data.As<Function>();
Local<Function> fun = data.As<Value>().As<Function>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When V8_ENABLE_CHECKS is enabled, Local::As() fails because v8::Function only supports Cast(Value*), causing a compile error.
https://github.com/nodejs/node/blob/main/deps/v8/include/v8-local-handle.h#L424.

} else {
CHECK(value->IsNumber());
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Maybe<uint32_t> maybe = value->Uint32Value(context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in line 684 why don't you just check for IsUint32?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we need to accept signed values for some call sites (e.g. fs.chown), not only strict Uint32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gyp build process: configurations mishandling

4 participants