joyent/node — pull request #6228 by bnoordhuis (2013-09-13 21:41:46+00:00)
Title: vm: revert contextify/vm2 patches

The new contextify-based vm2 implementation has some teething issues,
notably that it leaks persistent handles and is prone to segmentation
faults and/or debug build V8 assertions because it doesn't manage the
lifecycle of persistent handles correctly.

After some deliberation, I've come to the conclusion that the issues
are pretty fundamental to how the vm2 module is structured and that
fixing them properly will require a fair amount of rework.

With v0.12 around the corner, there is probably not enough time to get
things right. That's why this commit reverts or partially reverts the
following commits, in reverse chronological order:

3d4c663 contextify: dealloc only after global and sandbox
b89b97d src: fix multi-base class ObjectWrap::Unwrap()
756b622 src: add multi-context support
fd36576 vm: update API to use options argument
9c110d8 vm: add isContext; prevent double-contextifying
a3bf3d1 vm: use MakeWeak to fix leaking contexts
a54f65c vm: rip out ObjectWrap from ContextifyContext
9fc0066 src: fix up unused/unordered imports
48976d2 vm: fix Persistent leak
2891790 vm: remove unnecessary Persistent
eef5527 vm: Put back display_errors flag
7afdba6 vm, core, module: re-do vm to fix known issues

Some fix-ups were applied to the restored src/node_script.cc to make it
work with changed internal APIs. It still needs to be made fully
compatible with the multi-context work from commit 756b622.

Conflicts:
src/node_contextify.cc
lib/repl.js

/cc @domenic @isaacs @indutny