-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
lib: use more primordials #35838
lib: use more primordials #35838
Conversation
Review requested:
|
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.
Instead of FunctionPrototypeApply
, this should use ReflectApply
, which doesn’t go through the uncurryThis
closure:
node/lib/internal/per_context/primordials.js
Lines 22 to 24 in 802c98d
function uncurryThis(func) { | |
return (thisArg, ...args) => ReflectApply(func, thisArg, args); | |
} |
3b56f87
to
57c325a
Compare
This comment has been minimized.
This comment has been minimized.
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 just realized there are some unnecessary whitespace changes.
Needs a rebase. |
7ec460c
to
8c2c47a
Compare
This comment has been minimized.
This comment has been minimized.
8c2c47a
to
a3d70cd
Compare
This replaces all Function.prototype.apply, Function.prototype.bind, Function.prototype.call to their primordials alter ego.
a3d70cd
to
882e66e
Compare
I'm going to split it into smaller PRs, that's too many files to review for a single PR of that kind. |
This replaces all instances of
Function.prototype.apply
,Function.prototype.bind
, andFunction.prototype.call
to their primordials alter ego.I've used search and replace to make this PR, I've excluded changes in files that are already covered by other PRs (#35885, #35875, #35734). No test is being affected by this PR.
ReflectApply
is used to replaceFunction.prototype.apply
because it has less overhead (see #35838 (review)). There is an argument to be made that allFunction.prototype.call
calls could also be replaced byReflectApply
, but that's not done in this PR.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes