src: lazily load internalBinding('uv') and build the errmap lazily#25143
Closed
joyeecheung wants to merge 2 commits intonodejs:masterfrom
Closed
src: lazily load internalBinding('uv') and build the errmap lazily#25143joyeecheung wants to merge 2 commits intonodejs:masterfrom
joyeecheung wants to merge 2 commits intonodejs:masterfrom
Conversation
Member
Author
|
cc @addaleax |
addaleax
approved these changes
Dec 19, 2018
Member
addaleax
left a comment
There was a problem hiding this comment.
Btw, I’ve also thought about creating a static array from the macro here, instead of generating the full code for each entry… that might make things a bit easier as well?
Member
Author
I don't think I follow..what do you mean by creating a static array? |
Member
|
@joyeecheung This might not compile because I wrote it here in Github, but I think you get the idea: static const struct {
int value;
const char* name;
const char* message;
} errors[] = {
#define V(name, msg) { UV_##name, #name, msg },
UV_ERRNO_MAP(V)
#undef V
{ 0, nullptr, nullptr }
};
for (const auto* error = errors; error->name != nullptr; error++) {
Local<Value> arr[] = {
OneByteString(isolate, error->name),
OneByteString(isolate, error->msg)
};
if (err_map->Set(context,
Integer::New(isolate, error->value),
Array::New(isolate, arr, arraysize(arr))).IsEmpty()) {
return;
}
}
The major advantage would probably be that the code isn’t several kilobytes large in this case. No strong feelings about it, though :) |
danbev
approved these changes
Dec 20, 2018
jasnell
approved these changes
Dec 20, 2018
BridgeAR
approved these changes
Dec 27, 2018
This removes the `internalBinding('uv')` call from the normal
bootstrap for now, and avoids building `errmap` by default which
expands to a lot of calls into V8.
Member
Author
Member
Author
|
Landed in c66c073 |
joyeecheung
added a commit
that referenced
this pull request
Dec 29, 2018
This removes the `internalBinding('uv')` call from the normal
bootstrap for now, and avoids building `errmap` by default which
expands to a lot of calls into V8.
PR-URL: #25143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
targos
pushed a commit
that referenced
this pull request
Jan 1, 2019
This removes the `internalBinding('uv')` call from the normal
bootstrap for now, and avoids building `errmap` by default which
expands to a lot of calls into V8.
PR-URL: #25143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
refack
pushed a commit
to refack/node
that referenced
this pull request
Jan 14, 2019
This removes the `internalBinding('uv')` call from the normal
bootstrap for now, and avoids building `errmap` by default which
expands to a lot of calls into V8.
PR-URL: nodejs#25143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This removes the
internalBinding('uv')call from the normalbootstrap for now, and avoids building
errmapby default whichexpands to a lot of calls into V8.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes