Uh oh!
There was an error while loading. Please reload this page.
src: start annotating native code side effect - #21458
Conversation
TimothyGu
commented
Jun 22, 2018
| NewFunctionTemplate(callback, | ||
| v8::Local<v8::Signature>(), | ||
| // TODO(TimothyGu): Investigate if SetMethod is ever | ||
| // used for constructors. |
There was a problem hiding this comment.
That's easy to check, isn't it? Or do you suspect make test will miss instances?
There was a problem hiding this comment.
I'd rather leave that to a separate PR is what I meant.
| env->SetMethod(target, "getHashes", GetHashes); | ||
| env->SetMethod(target, "getCurves", GetCurves); | ||
| env->SetMethod(target, "randomBytes", RandomBytes, | ||
| SideEffectType::kHasNoSideEffect); |
There was a problem hiding this comment.
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.
Hmm, I didn't realize RandomBytes was async. I'll remove this part then.
| Signature::New(env->isolate(), t)); | ||
| Signature::New(env->isolate(), t), | ||
| // TODO(TimothyGu): should be deny | ||
| ConstructorBehavior::kAllow, |
There was a problem hiding this comment.
Should be /* length */ 0, ConstructorBehavior::kAllow,. Likewise on line 3968.
| 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.
Just a thought... but a env->SetSafeMethod(process, ...) variant that sets SideEfectType::kHasNoSideEffect automatically may be worthwhile.
TimothyGu
commented
Jun 23, 2018
bnoordhuis
commented
Jun 23, 2018
We could then later add |
jasnell
commented
Jun 23, 2018
I disagree on |
bnoordhuis
commented
Jun 23, 2018
We have functions such as |
I'm not even remotely interested in debating it so whatever method name folks think is appropriate is fine with me. Having the utility method is what I wanted so I'm good with this. |
addaleax
commented
Jun 23, 2018
@TimothyGu I’d suggest just spelling it out then as |
TimothyGu
commented
Jun 24, 2018
@addaleax Sure, I'll fix that later. |
benjamingr
commented
Jun 24, 2018
For what it's worth |
bnoordhuis
commented
Jun 24, 2018
"Pure" suggests it's safe to collapse multiple calls because the return value depends only on the inputs. That clearly isn't true for functions such as Compare gcc's |
benjamingr
left a comment
There was a problem hiding this comment.
Still looks good after rename
TimothyGu
commented
Jun 26, 2018
TimothyGu
commented
Jun 26, 2018
Landed in 65f6173. |
PR-URL: #21458 Refs: #20977 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
commented
Jun 26, 2018
Depends on #21105 to land on v10.x |
PR-URL: #21458 Refs: #20977 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Allows eager evaluation to take place for many builtin modules.
Refs: #20977
/cc @nodejs/v8-inspector @benjamingr
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes