Implemented xdebug remote commands

Summary: This diff implements the following remote commands:
* stop, detach
* stack_get, stack_depth
* context_names, typemap_get
* source
* stdout, stderr
* xcmd_profiler_name_get

The description of each is right above the implementation, so I won't go
into detail here.

These commands were all very simple to implement, which is why they are done
in this diff. The rest are incoming.

Other changes of note:
* XDebugCommand construction is no longer const. This was limiting the use of
  `XDebugCommand::handleImpl` and wasn't really necessary.
* `XDebugCommand::handleImpl` doesn't return a bool any longer, as it was the
  same result for almost all commands

Reviewed By: @ptarjan

Differential Revision: D1511176
Kill some dead emitter code

Reviewed By: @edwinsmith

Differential Revision: D1529862
Implemented xdebug breakpoint commands and slightly refactored xdebug xml api

Summary: This diff implements the following remote debugging commands:
* breakpoint_get
* breakpoint_list
* breakpoint_remove
* breakpoint_update

The descriptions are self-explanatory, but they are also written above each
implementation.

This diff was intended to implement the xdebug breakpoint commands, but I got
fed up with dealing with the xdebug xml code and so I slightly refactored that
as well. The changes go a long way to making it better, but are definitely not
enough in the long run.

Reviewed By: @ptarjan

Differential Revision: D1512977
when decoding numeric HTML entities, check if they're a number

Summary: According to php-src, strtol is pretty lenient with whitespace and other
non-numeric characters at the start of a string. Add the same checks
that exist there before attempting to process the numeric entity.

See:
https://github.com/php/php-src/blob/1e3e9e0bbbe073db4a32627e67e8f5d838852eaf/ext/standard/html.c#L802
Closes https://github.com/facebook/hhvm/pull/3630

Reviewed By: @JoelMarcey

Differential Revision: D1529806
Fix a race initializing static properties

Reviewed By: @swtaarrs

Differential Revision: D1529994
Fix dwarf_producer_init check

Summary: dwarf_producer_init takes 10 arguments, but the checking code only
supplied 5, meaning that the `const char*` check would always fail,
producing the wrong information and preventing compilation.
Closes https://github.com/facebook/hhvm/pull/3636

Reviewed By: @JoelMarcey

Differential Revision: D1530061
Let vasm use all the registers

Summary: Expand the unreserved registers for vasm (when compiling a whole
IRUnit, but not when compiling snippets of code via Vauto) to include
all usable registers (everything except rbx,r12,rsp,rbp).

Add an "args" mask to all the call opcodes to indicate which registers
are used (as register arguments) to the call. vasm-xls marks these used
by the call; prior to the call, there are copies into these registers,
so they are live from the copy to the call.

Reviewed By: @swtaarrs

Differential Revision: D1527672
Fix bogus type assertions from nested arrays

Summary: In the new test case hhbbc correctly figured out that after
the first [], we had an array all of whose keys were intergers,
and all of whose values were array(55). For the second [] it knew
that the base was either null, or array(55). As a result, it gave up
on trying to update the known value of the array - but didn't discard
what it already knew.

When we iterated the array, it then thought the value had to be null, or
array(55). We eliminate the null by the if/continue, and so it asserted
that it was an array of one element (it doesn't bother to assert the types).

There are two fixes. The first was to improve the type of the base. If the
base of an array is known to be null or array(55), and we push somthing onto
it, we should promote it to empty|array(55), and then do the push (the existing
code converted it to null|empty|array(55)). The second was to drop any
specialized information from the base type when we don't know how to update it.

Reviewed By: @edwinsmith

Differential Revision: D1529980
Fix APC test giving more time between add and fetch to make sure expiration takes place

Summary: Make sure there is enough time for expiration to take place

Reviewed By: @bertmaher

Differential Revision: D1508686
Update NEWS for "Snoop Dogg"

Reviewed By: @markw65

Differential Revision: D1530250
Rename namespace ARM and X64 to arm and x64

Summary: This is purely for aesthetics and seemed good in the wake
of s/JIT/jit/. Not planning any more churn after this.

Reviewed By: @markw65

Differential Revision: D1519347
CMake: use bundled PCRE if system PCRE doesn't jit

Summary: PCRE comes with its own CMakeLists.txt, fortunately, so all we have to
do is run it.

Caution: I have very little idea what I'm doing when it comes to CMake
-- there's a lot of hidden magic going on -- but I think this is some
approximation of correct.

Reviewed By: @ptarjan

Differential Revision: D1523103
Implemented important remote debugging commands and other fixes necessary for phpstorm

Summary: @jlreyes: This diff gets phpstorm working with xdebug. Everything should work but I haven't had time to cleanup
or write tests.
@paulbiss: added test coverage, fixed broken tests, implemented symbol parsing

Reviewed By: @ptarjan

Differential Revision: D1515484
Fix crash due to hash collisions in POST data

Summary: Too many hash collisions in the POST data resulted in
a warnUnbalanced fatal, which was only caught by the "last resort"
catch in HttpRequestHandler::handleRequest.

This revealed a few bugs: sourceRootInfo and reqURI both contain
smart allocated Strings, but their destructors run after
hphp_session_exit() has destroyed the memory manager. Its not
clear to me why this isn't a problem when we don't fatal, but
I fixed it by splitting handleRequest to ensure the
destructors are called earlier.

This still left us with a problem where we didn't correctly
close the connection, so I fixed that too.

Reviewed By: @dariorussi

Differential Revision: D1496904
XDEBUG_PROFILE should enable profiling

Summary: Closes https://github.com/facebook/hhvm/pull/3641

Reviewed By: @JoelMarcey

Differential Revision: D1530783
Fix assert crash when autocompleting with the same thing defined twice in a file

Summary: We were hitting an assert when the same class/func name was defined twice in the same file.

This was because we were oldifying the same name twice, so the second time, it fail with:
hh_server: hphp/hack/src/heap/hh_shared.c:682: hh_move: Assertion `hashtbl[slot2].addr == ((void *)0)' failed.
@emiraga found a bunch of logs of the same error message. This should fix anything to do with the ide utils stuff. If we still see it in the logs after, it might be a bug in Typing_redecl_service.

Reviewed By: @jwatzman

Differential Revision: D1528258
Add OSS benchmarking suite

Summary: Facebook: moving out from facebook/

Reviewed By: @ptarjan

Differential Revision: D1531518
Fix PDO::bindColumn

Summary: when we call Variant.unset() all refs get lost, use Variant.setNull() instead

Fixes #2914
Closes https://github.com/facebook/hhvm/pull/3638

Reviewed By: @JoelMarcey

Differential Revision: D1530475
Set resumed flag before suspending VarEnv

Summary: Recent cleanup changed the order of operations, causing assertion checks
to fail. Make sure the resumed flag is set before attempting to suspend
VarEnv.

Reviewed By: @​aravind

Differential Revision: D1531325
typechecker: allow static:: for private members of final classes

Summary: Might have been forgotten when adding the check. On the one
 hand, this makes more `<?php` code hackify directly. On the other hand,
 `self::` is safer long-term practice.

Reviewed By: @jwatzman

Differential Revision: D1529377