smalloc: allow different external array types#5953
smalloc: allow different external array types#5953trevnorris merged 2 commits intonodejs:masterfrom trevnorris:alloc-all-the-types
Conversation
doc/api/smalloc.markdown
Outdated
There was a problem hiding this comment.
s/enum/Enum/ and s/Include/Includes/ (or maybe just "Contains" or "Has the following members".)
|
LGTM, no comments. |
|
I still need to add a few tests. Also getting the following from @indutny anyway we can fix this? the function doesn't have a @isaacs think I have a use case for this in core, and fwiw it causes zero performance regression. |
|
My only objection is feature creep, but this is pretty reasonable. If there's a use for it (either core or userland) then lgtm. |
|
I have half a dozen uses for user land, but I hear you on feature creep. I If I can't find a proper use in core then I'll put it on the back burner |
|
@bnoordhuis Made a few additional changes since you're last review. Also squashed everything. Mind giving it one more look over? |
src/smalloc.cc
Outdated
|
LGTM |
* Moved the ToObject check out of smalloc::Alloc and into JS. Direct usage of that method is for internal use only and so can bypass the possible coercion. * Same has been done with smalloc::SliceOnto. * smalloc::CopyOnto will now throw if passed argument is not an object. * Remove extra TargetFreeCallback function. There was a use for it when it was working with a Local<T>, but that code has been removed making the function superfluous.
smalloc.alloc now accepts an optional third argument which allows specifying the type of array that should be allocated. All available types are now located on smalloc.Types.
Users can specify what type of external array they want using
smalloc.TYPES.