Throw exceptions through the TC instead of using EXCEPTION_GATEs

Registers information with gcc so we can throw exceptions
through TC frames.  Changes EMIT_CALL to only clean caller-saved
regs---the unwinder will let us clean dirty callee-saved regs during
an exception so the interpreter-based stack unwinding will work.
Fix trimExtraArgs to register frame information

We might re-enter, and it will SEGV if tl_regState is DIRTY
and there's no fixup.
fix socket error messages

Fix a couple error messages that contained "[%d] %s" in a string that
wasn't a printf-style format message.
Streamline SmartAllocatorImpl::alloc()

* move common fields to beginning of SmartAllocatorImpl
* move body of overflow check out-of-line
Dont crash on incorrect type assertions

Given something like:

  if ($this instanceof foo) {
  }

We can infer the type of this inside the if block to be foo, assuming
that foo is stronger than the known type of $this.

But if foo is a completely unrelated class, we shouldnt do that, because
we could generate incorrect code at compile time (of course, we could also
optimize out the if entirely - but currently dont).

The code to reconcile an actual type with an asserted type assumed the
actual type was passed first, but in one place, we passed the asserted
type first. This was only a problem if the assertion was impossible.
Make sure the TranslatorX64 is fully initialized

Parts of the runtime call TranslatorX64::Get(), which allocates
a TranslatorX64, but doesnt fully initialize it. Bad things happen
when we then delete it later.

This gets rid of the processInit call (which is kind of a misnomer
now anyway), and moves the code into the constructor.
Raise warning when null, false, or empty string is promoted to a stdClass

Zend PHP 5.4 raises a warning when code such as "$x = null; $x->foo = 1;"
causes a null, false, or empty string value to be promoted to a stdClass.

This diff updates HipHop to raise this warning as well.
Fix COW bug with foreach by reference

There are some cases involving foreach by reference loops where COW is not
triggered when it should be. Here is an example:

  <?php
  function foo() {
    $arr = array(0,10,20,30);
    foreach ($arr as $k => &$v) {
      $v += 100;
      if ($k == 1 && !isset($arr2)) { $arr2 = $arr; }
    }
    unset($v);
    var_dump($arr2);
  }
  foo();

  === Current output under HipHop ===
  array(4) {
    [0]=>
    int(100)
    [1]=>
    int(110)
    [2]=>
    int(120)
    [3]=>
    int(130)
  }

In the example above, the 3rd and 4th elements of $arr2 were incorrectly
modified by the foreach by reference loop. The problem is that the strong
iterator only checks if the array's refcount is greater than 1 before the
first iteration of the loop, but it doesn't check the array's refcount for
subsequent iterations.

I fixed this by making the strong iterator check the array's refcount each
time the iterator is advanced. If the refcount is greater than 1, a copy is
made and the strong iterators are migrated from the original array to the
copy.

In the course of implementing this fix, I made VectorArray escalate to
ZendArray whenever it is used with foreach by reference. This helped avoid
complications in cases where a VectorArray would need to escalate to
ZendArray while a foreach by reference loop is iterating over it. I also
took the opportunity to clean up some of the logic that deals with
escalating an array when a foreach by reference loop begins.
Use a stack-like allocation scheme for VarEnvs

Adds support for frames to ArenaImpl<>, which allows it to act
like a stack, and use them for the VarEnv, ExtraArgs, and associated
VarEnv allocations.
Use setbuffer to allocate stdio buffer

glibc's stdio routines use mmap directly to allocate BUFSIZ
bytes to manage internal buffering of data, but this causes contention
on the shared address space in the kernel.  Instead, use setbuffer to
provide an already malloc'd buffer for the buffered-io stdio routines.
Fix a segfault in get_declared_classes()

In rare circumstances, it could attempt to read an invalid iterator.
The problematic case is where a function or class has a name that
puts it at the "end" of the NamedEntityTable (the order of which is
undefined to start with) - and if its a class, its definition must
have been seen, but it must not have been declared yet.
Unit::getClassesInfo() was returning interfaces and traits

After a rewrite to use iterator style, the checks for
interfaces and traits were apparently dropped.
Cache res_ninit per-thread

res_ninit will read /etc/resolv.conf using stdio, which will
mmap 4k worth of data each time res_ninit is called, causing contention
in the kernel.  Cache this per-thread.
Fix conversion to usec

to_usec needs to know if we're dealing with cpu-time, and only
do the conversion to usec from nsec when using the fast clock_gettime
for cpu time only.
Fix return value in mysql_query

When a query timed out fetching the result, we would return true,
rather than false. Note that queries that return data should only
return false, or a valid MySQLResult resource. The queries that
are allowed to return true have already been weeded out by the
"mysql->status != MYSQL_STATUS_GET_RESULT" above.
Sync generated ext_hhvm files
Add CMake rule to find new dependency libunwind
Remove unused str union member from TypedValue and Variant.
Type prediction clean-up.
Cache compiled pcre's in a global cache, fix some other issues

We want to spend less memory on these, so we'll put them in a
tbb::concurrent_hash_map and share across threads.  Also fixes various
memory leaks in some early-return and exception cases in various preg_
functions.  Also removes the HAVE_SETLOCALE stuff, since it wasn't
working anyway (and zend53 doesn't handle it in preg_match after
setlocale either in a quick test).