Repository navigation
Conversation
The loong64, ppc64, riscv64, and s390x fast trampoline emitters each duplicated the signature validation, executable memory allocation, cache flush and mprotect sequence, trampoline release, and (for the fixed-width 32-bit ISAs) the instruction word emitters. Move them into a shared scalar_trampoline.h header so each platform file only contains its architecture-specific instruction encoding. Assisted-by: Claude
The System V and Win64 halves of the x64 fast trampoline emitter each defined identical copies of the register constants, the byte/word emitters, the REX/ModRM, mov, call, jmp, stack adjustment, and ret encoders, and the narrow return normalization helpers. Define them once ahead of the ABI-specific code. Assisted-by: Claude
napi_create_error(), napi_create_type_error(), napi_create_range_error() and node_api_create_syntax_error() differed only in the v8::Exception factory used, as did the corresponding napi_throw_*() functions. Move the bodies into internal CreateError() and ThrowError() helpers that take the factory. The exported functions and their signatures are unchanged, so there is no ABI impact. Assisted-by: Claude
DynamicLibrary::UnregisterCallback(), RefCallback(), and UnrefCallback() each duplicated the closed-library check, pointer argument validation, and callback map lookup. Move them into a shared FindCallback() helper. Assisted-by: Claude
The network and DOM storage agents repeated the same pattern dozens of times: read a property with an ObjectGet*() helper and throw a "Missing <name> in event" TypeError if it was absent. Add ObjectGetRequired() overloads that combine the two, move the duplicated ThrowEventError() into inspector_object_utils, and use them throughout both agents. Error messages are unchanged. Assisted-by: Claude
The SetMethod(), SetFastMethod(), SetMethodNoSideEffect(), SetProtoMethod(), SetInstanceMethod(), and SetProto*Dispose() variants each repeated the same function template construction, internalized name string creation, and installation code, differing only in side effect type, receiver signature, and target. Factor that into a small set of internal helpers. Assisted-by: Claude
When the creation context of the import.meta object has no associated Realm, the getter threw ERR_INVALID_INVOCATION but then fell through and dereferenced the null Realm. Return after throwing, as the other error paths in the getter already do. Assisted-by: Claude
ImportMetaResolveLazyGetter() and PathHelpersLazyGetter() duplicated the code that retrieves the creation context from the holder object. Move it into a shared GetHolderCreationContext() helper. Assisted-by: Claude
All three callers of report::WriteNodeReport() computed the excludeNetwork and excludeEnv options the same way, falling back to the process-wide defaults when there is no Environment. Do that once inside WriteNodeReport() instead. Assisted-by: Claude
FastHas() duplicated the scope parsing in FastHasResource(). Move the shared logic into FastHasImpl(), with FastHas() passing an empty resource. Assisted-by: Claude
StreamBase::WriteBuffer() and WriteString() duplicated the code that creates a request object when needed and attaches the handle being sent over an IPC pipe. Move it into a shared PrepareSendHandle() helper. Assisted-by: Claude
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67496 +/- ##
==========================================
+ Coverage 90.67% 90.69% +0.02%
==========================================
Files 799 799
Lines 280245 280016 -229
Branches 54125 54073 -52
==========================================
- Hits 254100 253968 -132
+ Misses 16280 16194 -86
+ Partials 9865 9854 -11
🚀 New features to boost your workflow:
|
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.
See individual commits. Deduplicate/consolidate multiple bits.