Add a bunch more backticks
Relax restrictions on the typing of class constant shape field names.

Summary: Relax the restrictions on what types class constants can have when used as shape field names. Previously, they were restricted to being int or string (and not even a type alias for them). We now use the same logic that we use for enum constants, where newtypes are acceptable as long as the actual underlying type is an int or a string. We also have to stop just doing direct structural comparison of types, now that they can be things other than just int and string. We also thread env through more of the related code, now.

Reviewed By: eletuchy, jwatzman

Differential Revision: D1451612
Implemented xdebug profiling/tracing enabling

Summary: This diff implements the hooks required to start profiling and tracing in
xdebug. Actually outputting the collected tracing/profiling data is not
yet implemented.

This diff is huge, I apologize for that. I didn't want to send out
another tracing/profiling diff that didn't include tests, and the
"be able to start profiling/tracing" goal turned out to require a
lot more than anticipated: this relies on D1433761, D1434395, D1437218,
and D1423763.

Both xdebug tracing and profiling can be started automatically via ini
settings or via get/post/cookie triggers. Starting and stopping tracing
be done programatically.

For profiling and tracing, the user can specify an output filename that can
be formatted using xdebug-specific format characters.
A big chunk of this diff implements this, but it's not complicated.

The profiler will also be used for collecting memory usage and start/stop
times for functions, so the profiler can be started/stopped by the
xdebug `collect_memory` and `collect_time` ini settings.

Ensuring that I could meet all of these needs is one of the reasons it was
hard to split this diff up. But if this needs to be split up, I understand.
The easiest thing to do would be to split the file name formatting into
a separate diff.

Reviewed By: @ptarjan

Differential Revision: D1438290
Support typing `->send` for `Generator`

Summary: Pretty easy now that the rest of the machinery is in place.
Most of this diff is just getting the error messages nice :)

Reviewed By: @elgenie

Differential Revision: D1451042
Corrected the var_dump output for Exception class

Summary: The debug dump of Exception was wrong mainly because of cosmetic issues such as extra and instance variable order

Reviewed By: @ptarjan

Differential Revision: D1434164
Have isMainExit() default to the last main block if it can't find an exit.

Summary: Since we can have regions that end in an instruction with a taken edge
to an unlikely block (Jmp, RaiseWarning), we want to scan through all
main blocks first looking for an obvious exit, and then resort to
using the last block if it can't find one.

Reviewed By: @ottoni

Differential Revision: D1445507
Revert "Kill IRBuilder::blockIsIncompatible"

Summary: This reverts commit f378609add8a2a025aed41a68b62b95a45f1cad1.

Reviewed By: bertrand, jdelong

Differential Revision: D1454780
Fix the default ini value for "arg_separator.input" to be "&"

Summary: This fixes #3256

Closes https://github.com/facebook/hhvm/pull/3257

Reviewed By: @JoelMarcey

Differential Revision: D1452078

Pulled By: svcscm
Implement a proper hack-mode for Emacs

Summary: This mostly supercedes the existing `hack-for-hiphop.el` "integration" that already exists. This is my first time doing anything major with Emacs, so it ~~might~~ certainly needs some more work. A few issues I can think of immediately are that it doesn't highlight XHP expressions and it likely won't indent them properly. Indentation is hard though, so I'm leaving that until later.

##Features

* Highlighting of various Hack-specific constructs, including Hack-specific keywords.
* Better integration with the typechecker by *not* setting global keybindings unlike the current integration, instead creating mode-specific bindings.
* Integration with the completion service provided by the typechecker. Includes integration with the `auto-complete` Emacs extension for intellisense-style autocompletion.
* Doesn't depend on an existing `php-mode` of which there are atleast 3 different ones of various completeness and complexity.

Closes https://github.com/facebook/hhvm/pull/3209

Reviewed By: @JoelMarcey

Differential Revision: D1440799

Pulled By: svcscm
Fixed error output for json_encode

Summary: `json_encode` threw a notice instead of setting a json error, this caused several discrepencies including forgotten implementaion of `JSON_PARTIAL_OUTPUT_ON_ERROR`.

Reviewed By: @ptarjan

Differential Revision: D1414389
Fix http headers parsing + Remove unused code + Fix indentation

Summary: This PR does three things:

 - Remove an unused variable in the http-client
 - Fix indentation of one of my previous commit
 - Fix the http headers parsing (Fixes #3241)

Regarding the fix about the http header parsing, the [RFC-2616](http://tools.ietf.org/html/rfc2616#section-4.2) specifies that the field value **MAY** be preceded by any amount of LWS, though a single SP is preferred. So, an header value not preceded by a space is valid.

Closes https://github.com/facebook/hhvm/pull/3248

Reviewed By: @JoelMarcey

Differential Revision: D1447936

Pulled By: svcscm
ifdef checks around headers and template fix

Summary: 1. using _ as a prefix in a template is bad since that's reserved for implementations, in this case though it's hitting a _U define in windows headers

2. execinfo.h is not on windows (even cygwin)

3. compatibility.h will need to be added to a few places that will need wrappers hidden inside

Reviewed By: @sgolemon

Differential Revision: D1420852
Revert "Revert "Fix casting a DateTime to an array""

Summary: An FB test was incorrectly passing before this change; the change made the test correctly fail. Test has been fixed in D1453222.

Reviewed By: @bertmaher

Differential Revision: D1453287
SplFileObject: Don't seek beyond the files size

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

Reviewed By: @ptarjan

Differential Revision: D1435369

Pulled By: @JoelMarcey
Corrected the implementation of ReflectionMethod::invokeArgs

Summary: This diff corrects the implementation of ReflectionMethod::invokeArgs to match that of php5's.

Closes #1721

Reviewed By: @fredemmott

Differential Revision: D1278570
Fix ubuntu (probably newer gcc) folly check

Summary: use cxx check compiles not c check compiles for folly weak symbols check
this is failing on some os/gcc combinations

Reviewed By: @JoelMarcey

Differential Revision: D1456030
Simplify LdObjClass t1:Obj=C to Cls(C).

Summary: In the title. Needed to change emitVerifyCls as it was asserting that
it would never get a const, which isn't true anymore.

Reviewed By: @ottoni

Differential Revision: D1452815
Remove trigger_error() from deprecated lz4 functions

Summary: Too much error spew in prod.

Reviewed By: @bertmaher

Differential Revision: D1456178
Don't select backward edges in WholeCFG mode

Summary: The back end will no longer weasel out of back edges by creating
unasked-for side exits.  This is good in the long term but right now it creates
a lot more hard cases for WholeCFG mode.  So, let's modify the region selector
to only pick acyclic regions.  We'll lift the restriction in the future.

The algorithm is your standard depth-first search cycle detection; we maintain
a stack of things being visited, and any edge to something currently on the
stack is by definition a back edge.  This is much easier to express as a
recursive algorithm than as a worklist algorithm, so I converted it to that
style.

Reviewed By: @ottoni

Differential Revision: D1446071
Optimize calls to get_class($obj) when we know the exact type of $obj.

Summary: Also optimizes get_class(), which is just a non-fataling self::class.

Reviewed By: @elgenie

Differential Revision: D1389240