Initial support for handling builtins more intelligently in hhbbc

Summary: This supports constant folding them from a whitelist, and adds a place
to write specific handling for builtins at the type level.  (Only one of these
is implemented for now, get_class, because it looked pretty trivial for a test
case (this diff cuts about 20% of the calls to it out).)

For constant folding, this requires the ability to change a C-flavor'd stack
element into an R, which is weird, but this adds it.  Followup diff will
peephole those away.

Reviewed By: @bertmaher

Differential Revision: D1612167
Set up hhbbc peephole opts to easily add simple 1-token lookahead rules

Summary: This diff only implements RGetCNop;UnboxRNop -> Nop, which was the
reason to do this for now.

Reviewed By: @bertmaher

Differential Revision: D1613323
Get region-mode=method to work enough for doing small test cases

Summary: It just needed arcs and not to run on pseudo mains.

Reviewed By: @alexmalyshev

Differential Revision: D1623995
Get rid of s_file_data

Summary: It was a request local holding an int. But the int is always
reset to 0 before being modified and then read, so it can be a thread
local int.

Reviewed By: @jdelong

Differential Revision: D1623063
Fix how ?-> deals with Tunresolved

Summary: The ?-> operator wasn't being conservative enough with Tunresolved, which
caused erroneous "?-> operator is being used but the base cannot be null"
errors.

This diff fixes it so that ?-> is more conservative about Tunresolved.

Reviewed By: @jano

Differential Revision: D1625583
MEMCACHEGlobals doesn't need to be RequestLocal

Summary: Ini settings are auto-reset to their default values
at the end of every request anyway.

Also fixes a bug where the setter for hash_function set
hash_strategy by mistake

Reviewed By: @ptarjan

Differential Revision: D1625606
SessionRequestData shouldn't be RequestLocal

Summary: Its always initialized at the start of every request,
so the lazy initialization is just pointless overhead; and its
shutdown has to be handled specially anyway.

Reviewed By: @ptarjan

Differential Revision: D1625631
Unrevert "Revert various HNI conversions"

Summary: This reverts commit 9073b64e3a15293308c9034143d6d63bd6a7988b (D1601800). Since D1414528 landed, these changes should be safe to unrevert.

Reviewed By: @markw65

Differential Revision: D1614465
add $this to v[ariable] hhvm debugger cmd

Summary: $this does not end up in 'local variables' until referenced.  This diff adds $this to local variables debugger command.

Reviewed By: @jano

Differential Revision: D1624271
SPL object not implementing Traversable is now a recoverable error

Summary: When an argument to a call like `iterator_count()` did not implement `Traversable`, this used to throw a pure `fatal`. Since 5.6, it now throws a `catchable fatal` (i.e. `E_RECOVERABLE_ERROR` in PHP). Let's match.

Reviewed By: @ptarjan

Differential Revision: D1623321
typecheck: include declaration location for 'missing type_params' message

Summary: ... it's much easier to jump to the declaration inside
 editors (e.g in emacs), and more consistent with other "Definition is
 here" error messages we produce

Reviewed By: @int3

Differential Revision: D1625076
Make the rest of the Zend test use %s for catchable fatals

Summary: I did some. Let's do the rest.

Reviewed By: @ptarjan

Differential Revision: D1621884
Revert "Adding doctrine/dbal to framework parity test suite"

Summary: run.php dbal fatals - the test find command does not work.

refs facebook/hhvm#4006

Reviewed By: @paulbiss

Differential Revision: D1626509
Implement incstat in vasm

Summary: Added the addqim instruction to support incstat in vasm, eliminate the
incstat macro instruction.

Also remove the Stats::enabled() check in emitCall(); it was left over
from when we had trampolines. Further, delete the rip-addressing asserts;
one had a bug, and they were only useful before we changed RIPRelativeRef
to take an absolute address.

Remove the pushf/popf; we only emitIncStat() in places where its okay
to clobber flags. And if we make a mistake, vasm-xls will assert about
having two live status flags. And since its vasm, the fix can easily
use scratch registers and lea to avoid modifying flags. (load,lea,store).

Reviewed By: @jasone

Differential Revision: D1620331
Fix some request locals

Summary: icu's default locale can just be thread local.
There's no need to initialize s_signal_handlers on each request;
we can avoid the issues that solved by testing to see if its been
initialized. If not, the thread can't be expecting any signals.

Reviewed By: @bertmaher

Differential Revision: D1625632
Better handling of RequestEventHandlers

Summary: Its possible for a RequestEventHandler to get re-initialized
after its requestShutdown method has been called.

At the end of the request, we destroy the ExecutionContext, and so we
are left with a RequestEventHandler whose inited flag is set, but which
is not in the ExecutionContext. As a result, we never call requestInit
or requestShutdown for that handler ever again.

This tries to prevent the obvious ways that this can happen, and checks
for it when destroying the ExecutionContext.

Reviewed By: @ptarjan

Differential Revision: D1623445
Simple curl change

Summary: This is stemming from issue #4002, but I don't think fixes it.

With code like this:

```
<?php

$file = new CurlFile(__DIR__. '/curl_testdata1.txt');
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => $file));
curl_exec($ch);
var_dump($file->name);
var_dump($file->postname);
```

`$postname` is empty in both PHP 5.6 and HHVM.

It will be tested by the issue raiser though on a real request when it lands to GitHub.

At the very least, this is a consistency fix. At the very best, a miracle happens

The claim is that on requests, HHVM is setting filename empty like this:

```
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream
```

while PHP 5.6 it is:

```
Content-Disposition: form-data; name="file"; filename="/home/vagrant/Sites/poshonpennies.com/app/routes.php"
Content-Type: application/octet-stream
```

Reviewed By: @ptarjan

Differential Revision: D1621800
Use distcc instead of ccache for building in benchy

Summary: This will build folly and stuff slower, but if you are benchying
something with local hphp header changes it'll probably win on build times,
since there'll be better parallelism.

Reviewed By: @mhahnenberg

Differential Revision: D1627193
Fix JSON decode constant

Summary: Fixes #4018

Reviewed By: @JoelMarcey

Differential Revision: D1626488
Have FrameState track in and out states of blocks.

Summary: Currently FrameState uses its map of snapshots to map blocks to their
in-states, except for when we're building, then we map blocks that have
already been processed to their out-state for
IRBuilder::insertLocalPhis.

To clean things up and reduce confusion, lets just store both the in and
out state for each block.

Reviewed By: @swtaarrs

Differential Revision: D1619253