Implement missing stream metadata for chmod, chown and chgrp, lchown and lchgrp

Summary: PHP added stream metadata in PHP 5.4 for chmod, chown, chgrp, lchmod and lchgrp.
http://php.net/manual/en/streamwrapper.stream-metadata.php

Closes #3687. Closes #4027.
Closes https://github.com/facebook/hhvm/pull/4031

Reviewed By: @ptarjan

Differential Revision: D1629484

Signature: t1:1629484:1414509316:a2f3ceafa61520133dc25f6d58689e156d1fdad3
Fix bug in reffiness checks

Summary: If the mask was all 0s for the second set of 64 parameters, the
nParams SSATmp would be wrong in the following 64-parameter sets.

Reviewed By: @markw65

Differential Revision: D1642597

Signature: t1:1642597:1414504664:f403a7da0170c8a1b83599ef4aef39e7d34590bc
Add a runtime option to limit the maximum number of bytecode instructions in a region

Summary: And enforce it in the region selectors.  The goal of this is to
prevent forming very large regions that are too expensive to JIT.

Reviewed By: @markw65

Differential Revision: D1640217
Shrink collection type field to 8 bits.

Summary: Preparing to either combine it, or overlap it, with ArrayKind.

Reviewed By: @jdelong

Differential Revision: D1641901
Add OSS support for benchy

Summary: This diff adds the ability for open source HHVM to run benchy.
There were a number of build system fixes that needed to be made to
enable out-of-source CMake builds.

Reviewed By: @jdelong

Differential Revision: D1640037
Make autocomplete work with nullsafe operator

Summary: The issue is that the nullsafe operator doesn't work for properties.

$thing->AUTO332 (the autocomplete token) looks like a property.

We were stopping in naming if we had ?-> accessing a property. This makes it add the error, but now it also keeps going now, so that autocomplete works.

As a side effect, we'll get more errors now if accessing a property also produces a typing error.

In a future diff, I'll make the nullsafe operator autocomplete not include properties.

Reviewed By: @jwatzman

Differential Revision: D1630608
Fixes soap memory leak

Summary: Uses unordered_sets instead of vectors for SoapData collections m_sdls, m_typemaps, and m_encodings. This way when the same pointer is added to the collection multiple times, the collection doesn't unnecessarily consume memory.

Closes #2828
Closes https://github.com/facebook/hhvm/pull/4082

Reviewed By: @ptarjan

Differential Revision: D1643094

Signature: t1:1643094:1414526521:1de5fa33624adc69b0aa37b6c5e2f5c67b2d15cb
Load Offset->line number mappings on demand

Summary: We don't use all the line number we store, since it's only used for
backtraces, warnings, and the like.  To save space, pull the line table out of
the repo when needed, and then cache the specific (Offset,line#) pairs that
were needed

Reviewed By: @jdelong

Differential Revision: D1616637
Only initialze sweepables on new threads

Summary: Closes #3999
Closes https://github.com/facebook/hhvm/pull/4000

Reviewed By: @markw65

Differential Revision: D1621173

Signature: t1:1621173:1414527028:89442e970ddb2c067ff9855dfb275ec40a4c3450
Allow vxls to allocate vmsp during traces

Summary: The rest of the summary is a bit of a lie: everything works just fine if we let
vmsp float freely but that's still disabled for performance reasons. See the
comment in reg-alloc.cpp for details.

%rbx is no longer a reserved register, freeing it up for general
use. vmsp still lives in %rbx between tracelets, so it's copied from %rbx to a
Vreg at the beginning of a tracelet and synced back to %rbx when
appropriate. Most of the Vregs will end up assigned to %rbx anyway due to
vxls's copy hinting. All instructions that leave the current trace for another
one (as opposed to leaving by throwing) now have a RegSet of uses, ensuring
that the value in %rbx is never clobbered between when it's written and the end
of the trace.

We now need to create phis for vmsp when it differs between predecessors rather
than just creating a new one with DefSP. I briefly considered just using an lea
off of %rbp in those situations but that wouldn't work for resumables and would
always generate some code, as opposed to only sometimes generating code for the
jmp/phis. I'm expecting this to have little to no effect on the generated code
due to copy hinting in vxls.

Reviewed By: @edwinsmith

Differential Revision: D1622952
Fixed iconv() error behaviour.

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

Reviewed By: @ptarjan

Differential Revision: D1638836

Signature: t1:1638836:1414531884:8088697d400e0484115b8bc67c3b3dc1dea92f78
Add placement new without null check

Summary: Placement new is a convenient way to initialize new objects
using a pre-existing chunk of memory. Unfortunately, the default
placement new does a null check. Ain't nobody got time for that. This
diff adds a new version of placement new that avoids this extra check.

Reviewed By: @markw65

Differential Revision: D1635935
Replace use of MAX macro with std::max in ZendPack

Summary: This has randomly bitten me in open source builds. I intermittently get
an error saying that MAX isn't defined.

Instead of trying to figure out what's going on, I'm just gonna switch
it to std::max.

Reviewed By: @paulbiss

Differential Revision: D1636740
Use the time in default xdebug output file

Summary: Rather than using the PID, which doesn't change except over restarts, use the current time so that profiler runs end up in different files.

Fixes #3433
Closes https://github.com/facebook/hhvm/pull/4079

Reviewed By: @ptarjan

Differential Revision: D1643090

Signature: t1:1643090:1414541102:877ca8f9e6c21989017a4c31e4a7ab990b6e3e73
Update the typechecker's auto-import list for the "HH" namespace

Summary: Ari encountered a bug when trying to declare an async function with a
return typehint inside a namespace. The typechecker did not recognize that
"Awaitable" was auto-imported from the HH namespace, and this was causing
problems.

This diff brings the typechecker's auto-import list up to date, excluding
"IMemoizeParam" which has issues that will be investigated later.

Reviewed By: @jwatzman

Differential Revision: D1643034

Signature: t1:1643034:1414539326:9597edc165f9b1a11087ab5ddc7f53390465bbc7
relax array restraint on array_sum() and array_product()

Summary: allow collections for array_sum() and array_product()

Reviewed By: @elgenie

Differential Revision: D1628124
Fix assert related to async return typehints

Reviewed By: @markw65

Differential Revision: D1644719
Remove HhbcTranslator::BcState, add TransContext::srcKey()

Summary: It's just SrcKey in disguise.

Reviewed By: @swtaarrs

Differential Revision: D1643878

Signature: t1:1643878:1414529334:2f0820622a27487cae667ec4c58cb47bacae8409
Convert built-in PDO class to HNI

Summary: **Motivation**
The Doctrine libary used by Symfony defines a class that extends the built-in PDO and implements their custom interface. That interface declares the `prepare(..)` method with one parameter, while `PDO`'s version has two, the second having a default value.
With the class defined via IDL, the semantic check in `class.cpp` was failing to see the presense of the default value and reporting an error.

One of Symfony's test that were failing:
  Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListCompositeIdTest.php

Reviewed By: @ptarjan

Differential Revision: D1612690
Relax parameter declaration check for built-in functions

Summary: In certain cases we can't have our built-ins act as those of PHP5 because the latter don't have type hints.
For example, consider the following case:

  // Built-in PDO (HHVM)
  class PDO {
   . . .
   function query(string $sql, ...$argv): mixed;
   . . .
  }

  // Built-in PDO(PHP5)
  class PDO {
   . . .
   function query();
   . . .
  }

  interface I {
   function query();
  }

  class C extends PDO implements I {
  }

This code works in PHP5, but doesn't in HHVM, because our parameters check fail.

The proposed solution is to disable parameter checks for built-in classes when not running in HipHop-syntax mode.

Reviewed By: @markw65

Differential Revision: D1623635