Object pool allocator for JavaScript