-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
build: enable -DV8_ENABLE_CHECKS flag #61327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| #include "quic/guard.h" | ||
| #include "simdutf.h" | ||
| #include "util-inl.h" | ||
| #include "v8-value.h" | ||
|
|
||
| namespace node { | ||
| namespace builtins { | ||
|
|
@@ -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>(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| new_cached_data.reset(ScriptCompiler::CreateCodeCacheForFunction(fun)); | ||
| } | ||
| CHECK_NOT_NULL(new_cached_data); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| #ifndef SRC_UTIL_INL_H_ | ||
| #define SRC_UTIL_INL_H_ | ||
|
|
||
| #include "v8-isolate.h" | ||
| #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS | ||
|
|
||
| #include <cmath> | ||
|
|
@@ -678,10 +679,15 @@ T FromV8Value(v8::Local<v8::Value> value) { | |
| "Type is out of unsigned integer range"); | ||
| if constexpr (!loose) { | ||
| CHECK(value->IsUint32()); | ||
| return static_cast<T>(value.As<v8::Uint32>()->Value()); | ||
| } 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); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in line 684 why don't you just check for IsUint32?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| CHECK(!maybe.IsNothing()); | ||
| return static_cast<T>(maybe.FromJust()); | ||
| } | ||
| return static_cast<T>(value.As<v8::Uint32>()->Value()); | ||
| } else if constexpr (std::is_integral_v<T> && std::is_signed_v<T>) { | ||
| static_assert( | ||
| std::numeric_limits<T>::max() <= std::numeric_limits<int32_t>::max() && | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://github.com/nodejs/gyp-next/blob/main/docs/InputFormatReference.md#processing-order, I think there is no way for us to generate a single
config.gypisupporting two configurations at the same time, with variable expansions based on configurations, since the variables are expanded before merging the configuration objects.So I'd suggest updating this to be a simple way: instead of
node/configure.py
Lines 2499 to 2503 in e1fc3dc
we could do: