Only rematerialize instructions when its safe to.

Only rematerialize an instruction if its inputs are still live
and in registers at the point we're cloning it, which, given the current state of flux in the register allocator, is restricted for
now to just instructions that consume rVmSp, rVmFp, or immediate constants.
Minor tweaks to StateVector @override-unit-failures

- Move to state_vector.h
- Use smart::vector instead of std::vector
- Make factoryId and count helpers private
- Add const_iterator support
- Make grow() use resize() instead of looping push_back().
- Use assign() in reset().
Add a OpNot to HHIR; remove TraceBuilder::genNot

There's always been a little weirdness in the simplifier with
regard to negation.  Apparently I used to think it could lead to
losing a ConvToBool (I am not 100% sure what the case that comment
refered to was now though).  It definitely lets us avoid some
zero-extending bools to ints though (since our binary arith guys don't
support bools yet), and with this the last "dubious" genFoo is gone.
Move remaining stack optimizations to simplifier

Removes all their genFoo functions and does the corresponding
work in Simplifier, since it requires no state.
Fix trace exit type for IncDecL of boxed values

For accesses to boxed locals, if the inner type changes, we can
retranslate using HHIR: the new translation will inspect the live type
and be able to execute the instruction.  While looking at something
else, I noticed that in such cases IncDecL was taking a slow exit
(which avoids using HHIR).
Improve the Next command to not interpret and single-step ever line under calls from the original source line

This improves both Next and Out to avoid interpreting and stepping everything between when they start and finish. Out now lets the program run free until a pseudo-breakpoint at the return site it hit. Next continues to single-step the source line being stepped over, but now lets the program run free under calls made from that line.

The logic in Next regarding "calls made from that line" is extremely generic. We don't look at, say, call opcodes and decide to do something special. Rather, when we find we're off the original source line and a frame deeper we setup a "step out" operation much like the Out command then let the program run free. When we reach our return point, we continue stepping like normal. This accounts for not just calls, but iterators, and anything else that causes more PHP to run under the original source line.

This change moves the flow control logic down in to the respective cmds: Next, Step, Out, Continue. These cmds get a crack at executing at various points in the interrupt/command processing path. These cmds now own setting up the last location filter, whether they need VM interrupts, and whether they're done or not.
Fix runtime options for tests

My diff to turn the ir on by default missed a few places that
need HHIRDisableTx64=0.
Disable some zend tests reported as flaky
Use traceRelease for Eval.DumpBytecode

This shouldn't be restricted to debug builds.
Streamline exits from HHIR to Interp when Tx64 is off

If Tx64 is disabled, change slow exits to call the interpreter directly.
Minor cleanup in srcdb.h

Mainly gets rid of the need to pass Asm& a and astubs
to all the patching functions.
Add missing macros to timelib_config.h

The absence of HAVE_LIMITS_H caused timelib_structs.h to define LONG_MIN
and LONG_MAX to be 32-bit values, which caused timelib_date_to_int() to
give an error for a date after 2038, which caused the current time to be
returned for e.g. date_create('28 July 2038')->format('r').

The issue was detected by MediaWiki unit tests, and this fix was tested
by the same method.

While I was at it, I also added HAVE_LOCALE_H, which was checked for in
CMakeLists.txt but not used, and I fixed the definition of SIZEOF_INT
(#cmakedefine doesn't work that way). I arranged the macros in
timelib_config.h.cmake in the same order as they are in CMakeLists.txt.
Merge pull request #758 from tstarling/master

Add missing macros to timelib_config.h
proc_open should inherit g_context->m_envs

Some head scratching until I realized that my `putenv()` calls
in my PHP script weren't actually changing the environment for subsequent
`proc_open()` calls.

What I'd like this diff to do (and I fully expect that I'm violating some
referencing rules in hhvm) is to fall back to using our current view of
the environment as maintained in the execution context in the case that
proc_open is not explicitly passed an environment array.

I think I've even added a test to prove that this works, but I haven't
read the manual and fbmake runtests takes too long, so I'm just going
ahead to submit this diff.
Move pretty-printing code into its own file

Pretty-printing the IR is a kind of pass, and definitely a separate
concern, just like rendering IR as machine code.  Put it in its own file.
add hooks to ASIO to allow building of dependency graphs in PHP

In order to build a dependency graph of continuation execution and data-fetching in PHP-land, we need a few instrumentation points in the asio_ext HHVM extension. There are 4 additions required:
   1. Callback when a continuation finishes successfully.
   2. Callback when a continuation blocks on a wait_handle.
   3. Get array of WaitHandles a GenArrayWaitHandle is waiting on.
   4. Get WaitHandle that the SetResultToRefWaitHandle is waiting on.
I don't think this should really affect performance, as in the normal case, nothing has changed, but you never know... I'm also not sure who should be reviewing this, so I've just added @jan for now. If you could pile other people on, that would be cool.

sandcastle appears to be broken.
Eliminate circular dependency in SmartAllocator

SmartAllocator defined and used an enum for each type using smart allocation, thus closing a circular dependency loop. In fact the enum is not necessary and can be replaced with typeid with relative ease. While at it I've also simplified GarbageList a bit.

Also fixed a couple of lint errors.

Perflab completed, looks neutral to good: https://our.intern.facebook.com/intern/perflab/details.php?eq_id=399305
re-enable tests

These were reported (correctly) as crappy and disabled in D801504. I fixed them.
Move m_liveRegs out of IRInstruction

The live regs field in IRInstruction is the result of an analysis
pass which can be better encapsulated by moving the field into
its own StateVector.
Disable some flaky zend tests @override-unit-failures