-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
src: start annotating native code side effect #21458
Changes from 1 commit
7132853
c5f4cb5
d418bb8
a129a6f
c43658d
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 |
---|---|---|
|
@@ -159,6 +159,7 @@ using v8::Promise; | |
using v8::PropertyCallbackInfo; | ||
using v8::ScriptOrigin; | ||
using v8::SealHandleScope; | ||
using v8::SideEffectType; | ||
using v8::String; | ||
using v8::TryCatch; | ||
using v8::Undefined; | ||
|
@@ -1947,7 +1948,10 @@ void SetupProcessObject(Environment* env, | |
title_string, | ||
ProcessTitleGetter, | ||
env->is_main_thread() ? ProcessTitleSetter : nullptr, | ||
env->as_external()).FromJust()); | ||
env->as_external(), | ||
v8::DEFAULT, | ||
v8::None, | ||
SideEffectType::kHasNoSideEffect).FromJust()); | ||
|
||
// process.version | ||
READONLY_PROPERTY(process, | ||
|
@@ -2252,17 +2256,24 @@ void SetupProcessObject(Environment* env, | |
env->SetMethod(process, "_getActiveHandles", GetActiveHandles); | ||
env->SetMethod(process, "_kill", Kill); | ||
|
||
env->SetMethod(process, "cwd", Cwd); | ||
env->SetMethod(process, "cwd", Cwd, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(process, "dlopen", DLOpen); | ||
env->SetMethod(process, "reallyExit", Exit); | ||
env->SetMethod(process, "uptime", Uptime); | ||
env->SetMethod(process, "uptime", Uptime, | ||
SideEffectType::kHasNoSideEffect); | ||
|
||
#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) | ||
env->SetMethod(process, "getuid", GetUid); | ||
env->SetMethod(process, "geteuid", GetEUid); | ||
env->SetMethod(process, "getgid", GetGid); | ||
env->SetMethod(process, "getegid", GetEGid); | ||
env->SetMethod(process, "getgroups", GetGroups); | ||
env->SetMethod(process, "getuid", GetUid, | ||
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. Just a thought... but a |
||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(process, "geteuid", GetEUid, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(process, "getgid", GetGid, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(process, "getegid", GetEGid, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(process, "getgroups", GetGroups, | ||
SideEffectType::kHasNoSideEffect); | ||
#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,7 @@ using v8::Null; | |
using v8::Object; | ||
using v8::PropertyAttribute; | ||
using v8::ReadOnly; | ||
using v8::SideEffectType; | ||
using v8::Signature; | ||
using v8::String; | ||
using v8::Uint32; | ||
|
@@ -5193,12 +5194,18 @@ void Initialize(Local<Object> target, | |
#endif | ||
|
||
env->SetMethod(target, "pbkdf2", PBKDF2); | ||
env->SetMethod(target, "randomBytes", RandomBytes); | ||
env->SetMethod(target, "timingSafeEqual", TimingSafeEqual); | ||
env->SetMethod(target, "getSSLCiphers", GetSSLCiphers); | ||
env->SetMethod(target, "getCiphers", GetCiphers); | ||
env->SetMethod(target, "getHashes", GetHashes); | ||
env->SetMethod(target, "getCurves", GetCurves); | ||
env->SetMethod(target, "randomBytes", RandomBytes, | ||
SideEffectType::kHasNoSideEffect); | ||
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. Is there a reason you annotated randomBytes but not pbkdf2 and scrypt? They all use the thread pool. 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. Hmm, I didn't realize |
||
env->SetMethod(target, "timingSafeEqual", TimingSafeEqual, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(target, "getSSLCiphers", GetSSLCiphers, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(target, "getCiphers", GetCiphers, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(target, "getHashes", GetHashes, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(target, "getCurves", GetCurves, | ||
SideEffectType::kHasNoSideEffect); | ||
env->SetMethod(target, "publicEncrypt", | ||
PublicKeyCipher::Cipher<PublicKeyCipher::kPublic, | ||
EVP_PKEY_encrypt_init, | ||
|
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.
That's easy to check, isn't it? Or do you suspect
make test
will miss instances?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.
I'd rather leave that to a separate PR is what I meant.