Use binary searches in vasm-xls

Summary: Turns several O(N) searches into O(lgN) to improve big-o time
when compiling large units. Also takes advantage of SSA by
only trying to insert one spill-store, at the position of the
exactly-one def of an SSA interval.

Reviewed By: @markw65

Differential Revision: D1586464
Don't keep copying the sourceLocTable

Summary: There doesn't seem to be any point

Reviewed By: @jdelong

Differential Revision: D1596565
Add delay timing knobs to throughput performance benchmark driver.

Summary: Change the plumbing so that the $options are pushed around more uniformly
into the workers' constructors, and use properties from the $options
directly.

Add various knobs to control delays before/after most sub-process
launches, delays waiting for responses from the server, delays on the
fcgi channel, and the like. These knobs are reflected as command line
arguments to perf.php. The chosen default values seem plausible or
are historical.

These knobs have proven necessary to support slower systems, or a hhvm
UUT that is itself compiled for debugging or coverage, or is profiling
the PHP being executed.

Add knobs to:
  * override the temporary directory name;
  * plumb subprocess output to files, as using pipes leads to deadlock;
  * trace the subprocess invocations.

If these delay knobs are used, then issue a warning message that
the timing results are unsuitable for benchmark comparisons.

Make changes for hack style guide:
  * add , at end of all formal parameter lists, and most act
Closes https://github.com/facebook/hhvm/pull/3850

Reviewed By: @ptarjan

Differential Revision: D1578204
Properly shutdown debugger threads on exit

Summary: When the server quit we were leaving the proxies
running. This led to an assertion in dbg builds when the
proxy was destroyed, and random crashes in release builds.

Reviewed By: @jdelong

Differential Revision: D1596601
Fix more hhbbc issues with enums

Summary: Name-only resolutions weren't handled in the last diff.

Reviewed By: @markw65

Differential Revision: D1596483
Fix hphpd crash

Summary: This is a better version of D1591886, which was
release only. It moves the breakpoint filters into
the requestInjectionData, because we have maps
from various things to ThreadInfo, but no maps to
the ExecutionContext.

It makes the DebugHookHandlers singletons, so that
we don't have to delete them racily.

It also fixes the debugger's EventHooks, so that we set/clear
them on the correct threads.

Reviewed By: @jdelong

Differential Revision: D1593790
Suppress OOM logging while loading APC file data

Summary: While loading APC data at start up, the allocator technically exceeds
the memory limit, but we don't actually care about this since it's just a
startup cost.  So, suppress the OOM mechanism during this phase.

Reviewed By: @edwinsmith

Differential Revision: D1593994
Use LowFuncPtr for Class method table

Summary: Probably uses less memory or something.

Reviewed By: @edwinsmith

Differential Revision: D1587099
Shave 32 bytes from Class using LowPtr

Summary: Bytes == bad.

Reviewed By: @jdelong

Differential Revision: D1587563
Offload rarely-used members of Class to Class::ExtraData

Summary: Data members for traits (which are flattened in repo mode), reflection
methods, and builtins don't need to be present for all Classes in the
common case.  Bytes == bad.

Also includes two auxiliary changes:
- Add a range() method to IndexedStringMap.
- Add a DefaultPtr type to shortcut `px ? px->m_f : my_default`.

Reviewed By: @jdelong, @elgenie

Differential Revision: D1591981
Remove duplicate tests.

Summary: Found all these by running a dedup script.

For every fileN.php deleted in this commit, the duplicate file is at file(N-1).php.

Reviewed By: @elgenie

Differential Revision: D1596717
Make solve_todos a utility function.

Summary: Makes it easier to add other types of 'todos'.

Reviewed By: @elgenie

Differential Revision: D1596894
Fix small memory leaks in ext_bcmath.cpp

Summary: Use SCOPE_EXIT to properly release resources, even when the function raises a warning or returns prematurely.

Reviewed By: @jdelong

Differential Revision: D1597156
Forgot to use emitLdLowPtr for Class::m_invoke

Reviewed By: @bertmaher, @markw65

Differential Revision: D1597419
Add 1s by default between starting $php_engine and running sanity check

Summary: php-ng starts up faster - and nginx hasn't finished starting up, so the sanity check fails.

Reviewed By: @oyamauchi

Differential Revision: D1597189
Make hhi for some builtin constants.

Reviewed By: @jwatzman

Differential Revision: D1596887
Fix hack javascript wanting tons of dependencies

Summary: For the test case described in D1567415, 3000 dependencies are pulled in before this change. 200 are pulled in after.

-When we implemented the js version of hack, we needed a way to figure out what dependencies we need.
-On the IDE client, the user would open a file, and we'd try to typecheck it.
-When we finished typechecking, we needed to know what dependencies were missing (so we could pull them in)
-This was accomplished by replacing the Typing_deps module. By replacing the model, we can find out the names of every dependency the client has seen.

Now, say I'm typechecking FileA and FileA has a dependency on FileB. FileB has a dependency on FileC.
When I typecheck FileA, I find out that I need FileB, so I hh_add_dep FileB. When FileB gets named and decled, it adds FileC to our dep set.

However, we don't actually need FileC, unless FileB is inheriting from FileC. This change makes it so that FileC would not be added in this case.

My fix is kind of hacky (using a reference), but seemed like the simplest way to keep the change isolated to the hh_ide javascript stuff.

Reviewed By: @jwatzman

Differential Revision: D1575078
Fix subtyping for enum types with constraints.

Summary: Move the code that handles that case to the end, so we can take
advantage of the other cases that handle the peeling off of Toption,
etc.

Reviewed By: @elgenie

Differential Revision: D1596826
Close a memory leak in hh_server and hh_ide.js

Summary: When we want to get the errors for something, we use Errors.try or Errors.do. However, not all callers of functions that add errors are guaranteed to be within Errors.try or Errors.do (specifically, dev tools stuff doesn't always do this).

This made a list of errors accumulate within the errors module forever, with no way to get to it.

This fix makes it so that if we're not within errors.try, errors.ignore or errors.do, we crash if we add an error instead of leaking them.

Reviewed By: @jwatzman

Differential Revision: D1571225
Align recoverable fatal error's message with PHP

Summary: Unhandled recoverable fatal error's message is not consist with PHP.
Closes https://github.com/facebook/hhvm/pull/3805

Reviewed By: @ptarjan

Differential Revision: D1579435