summaryrefslogtreecommitdiff
path: root/lib/smalloc.js
Commit message (Collapse)AuthorAgeFilesLines
* smalloc: update use of ExternalArrayType constantsTrevor Norris2014-10-081-1/+2
| | | | | | | The constants in enum v8::ExternalArrayType have been changed. The old values are there for legacy reasons, but it's best to update anyway. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* smalloc: check if object has external memoryTrevor Norris2013-11-131-0/+1
| | | | | Add HasExternalData API to check if Object has externally allocated memory, and accompanying tests.
* smalloc: allow different external array typesTrevor Norris2013-08-071-7/+34
| | | | | | 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.
* smalloc: cleanup checks/conversionsTrevor Norris2013-08-071-3/+3
| | | | | | | | | | | * 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: fix assertion fails/segfaultTrevor Norris2013-08-021-4/+12
| | | | | | | | | * Numeric values passed to alloc were converted to int32, not uint32 before the range check, which allows wrap around on ToUint32. This would cause massive malloc calls and v8 fatal errors. * dispose would not check if value was an Object, causing segfault if a Primitive was passed. * kMaxLength was not enumerable.
* src: Replace macros with util functionsisaacs2013-08-011-3/+4
|
* lib: macro-ify type checksBen Noordhuis2013-07-241-3/+3
| | | | | Increases the grep factor. Makes it easier to harmonize type checks across the code base.
* smalloc: create separate moduleTrevor Norris2013-07-191-0/+53
It will be confusing if later on we add Buffer#dispose(), and smalloc is its own cpp api anyways. So instead create a new require('smalloc') to expose the previous Buffer.alloc/dispose methods, and expose copyOnto and kMaxLength as well. Other changes: * Added documentation and additional tests. * smalloc::CopyOnto has changed from using assert() to throwing errors on bad argument values because it is not exposed to the user. * Minor style fixes.