src: fix up smalloc weak persistent usage
authorBen Noordhuis <info@bnoordhuis.nl>
Sat, 15 Mar 2014 00:12:53 +0000 (01:12 +0100)
committerFedor Indutny <fedor.indutny@gmail.com>
Sun, 16 Mar 2014 12:15:34 +0000 (16:15 +0400)
commite87ceb2b427a9b51a55af5898c2ef24b4cc08af2
tree37e51a84fd1871dc1e636b05d9af44895a1ba2e1
parentad15d75750d4482a752b84f3e599c6c6d16203e9
src: fix up smalloc weak persistent usage

Fix a regression that was introduced in commit ce04c726 after the
upgrade to V8 3.24.

The new weak persistent handle API no longer gives you the original
persistent but still requires that you clear it inside your weak
callback.

Rearrange the code in src/smalloc.cc to keep track of the persistent
handle with the least amount of pain and try hard to share as much
code as possible between the 'just free it' and 'invoke my callback'
versions of the smalloc API.

Fixes #7309.
src/smalloc.cc