Introduce NvGetIntConverted so IntMap array can warn on converted numeric string keys

Summary: IntMap array is an array with only integer keys, that does not support
converting numeric string keys to integer keys. It instead raises a warning
when such a thing occurs. This diff adds to ArrayFunctions a function to
warn on such occurrences, but all other ArrayKinds will just delegate to
NvGetInt without warning.

Reviewed By: @paroski

Differential Revision: D1428302
Turn on numeric string key warnings for IntMap arrays

Summary: IntMap array is an array with only integer keys, that does not support
converting numeric string keys to integer keys. It instead raises a warning.

This diff handles jit code paths that silently convert string keys to integer keys.

Reviewed By: @paroski

Differential Revision: D1427621
Fix lz4uncompress

Summary: the library function lz4_uncompress will keep reading input bytes
until it produces the specified number of output bytes (if it doesn't produce
exactly the right number of output bytes, it returns a failure code).

hphp/test/slow/ext_zlib/ext_zlib.php has a test for invalid input. That was
reading beyond the end of the input string, and, given the right garbage
bytes, could actually succeed.

Switch to lz4_decompress_safe, which specifies how long the input string is, and
a maximum number of output bytes.

Reviewed By: @dariorussi

Differential Revision: D1432804
Fix Map and Set iterator logic

Summary: The iterator logic for Maps and Sets was keeping track of the current
element using byte offsets instead of indicies, which was intended to be a
micro-optimization to make iter_key() and iter_value() slightly faster.
However, it turns out that ArrayIter truncates the upper 32-bits, so the
byte offset scheme won't work for huge collections with more than 178956970
elements.

This diff changes the Map and Set iterator logic to use indices instead of
byte offsets. This has the added advantage that it matches how MixedArray's
iterator logic works.

Reviewed By: @paulcavallaro

Differential Revision: D1428664
Fixed build failed because of incompatible libzip version

Summary: After the commit 3652634dc09bf3d6d533a8c3dc46cd9bd5f6ce4b upgraded libzip, we are required 0.11+ (The version is not updated I proposed another PR for that)

This patch add lipzip version detection and fallback to bundled libzip
when incompatible libzip found.

Closes #3177

Closes #3178
Created from: https://github.com/facebook/hhvm/pull/3178

Reviewed By: @ptarjan

Differential Revision: D1432747
Fix an assertion when iterating collections

Summary: iterInit for collections assumed (and asserted) that valOut was
not KindOfRef, but nothing was enforcing that.

Reviewed By: @dariorussi

Differential Revision: D1431817
Plumb Asm& through to ifThen()'s lambda function

Summary: All the other if-then-else assembler functions pass the Assembler
down to the lambda functions passed in, except this one.  Clean
it up and remove duplicated code.

Reviewed By: @bertmaher

Differential Revision: D1428732
Add ezpublish-kernel to framework tests

Summary: Closes #3119

Reviewed By: @ptarjan

Differential Revision: D1431397

Pulled By: @fredemmott
Optimize APC objects and collections by defining an APCCollection class and increasing the number of APCObject vs serialized objects

Summary: Allow collections in APC to be stored holding an uncounted or APC array. Also extend conditions under which an APCObject is created.

Reviewed By: @elgenie

Differential Revision: D1417525
Add memory protector to hhvm thread scheduler.

Summary: Introduced an outstanding memory checker thread on each proxygen server
instance. This memory protector periodically check the current actual
free memory, once it is lower than some configured threshold, a flag will
be marked so that new coming requests will be quened until that flag is
reset.

Once the free memory amount become back above the threshold, the
protector flag is reset. Meanwhile, the memory protector will
perform some extra "notify"s to the job queue, so that previous
queued jobs can be sweep up shortly.

The following parameters are configurable by hdf:

MemoryThreshold: the threshold of free memory, default as 512MB.

MemoryCheckFreq: the frequency of memory checking, default as 3s

QueuedJobsReleaseRate: the rate of extra "notify"s to release
previous queued jobs, default as 3, which means giving the job queue
3 notifies every secs, here P = QueuedJobsReleaseRate.

Reviewed By: @markw65

Differential Revision: D1396273
packed arrays in asio

Reviewed By: @elgenie

Differential Revision: D1413413
updating hack files

Summary: Adding the `AsyncConnectionPool` class and some functions.

Reviewed By: @jwatzman

Differential Revision: D1429917
Fix crashes related to "new Pair($x, $y)"

Summary: "new Pair" is supposed to throw an exception with any number of arguments,
However, there was a crash when running under hphpd that could happen if
one or more arguments were passed. The problem was that HHVM was raising a
warning and then returning a partially constructed Pair with uninitialized
fields.

This diff fixes the crash by making "new" use a more defensive C++
constructor that initializes all the field, and by making Pair's
__construct() method take any number of args (which ensures that "new Pair"
will always throw an exception no matter how many args are passed).

Reviewed By: @jdelong

Differential Revision: D1432922
Add warnings for numeric string keys when reading from intmap

Reviewed By: @paroski

Differential Revision: D1430008
Add warnings for calls to sort on intmaps

Summary: Change dispatch in g_array_funcs of Sort and Usort to WarnAndSort and
WarnAndUsort respectively. This way we don't incur any overhead for regular
kMixedKind arrays.

Reviewed By: @paroski

Differential Revision: D1429736
don't fail test if intl is too old

Summary: This is failing on cmake builds and anoying me in the oncall email

Reviewed By: @JoelMarcey

Differential Revision: D1432980
Fix build broken on OS X

Summary: Typo fix, rename `dest` to `reg` to match GCC_FAST_TLS version

This closes issue #3145
Closes #3159
Created from: https://github.com/facebook/hhvm/pull/3159

Reviewed By: @markw65

Differential Revision: D1428182
Correct a config key name in debugger.devdocs

Summary: It's "Eval.Debugger.Port", not "Eval.Debugger.DebugggerServerPort".
Closes #3186
Created from: https://github.com/facebook/hhvm/pull/3186

Reviewed By: @ptarjan

Differential Revision: D1435399
Enable sorting for Sets

Summary: Now that Sets retain insertion order it would be handy if Sets could be
sorted using PHP's sort builtin functions. This diff leverages to shared
implementation between Map and Set to enable sorting for Sets.

Reviewed By: ptc, eletuchy

Differential Revision: D1435214
Turn on the rest of the numeric string key warnings

Reviewed By: @paroski

Differential Revision: D1430084