Fix bug in cgStoreTypedValue

Summary: This was introduced by D1401528 but missed because of a sandcastle
bug.

Reviewed By: @dariorussi

Differential Revision: D1407977
Expand documentation on Value::merge in refcount-opts

Summary: Explain why it's ok for the pendingIncs vectors to differ.

Reviewed By: @bertmaher

Differential Revision: D1408000
Added HTML5-PHP test suite

Summary: Closes #3042

Reviewed By: @fredemmott

Differential Revision: D1407665

Pulled By: @JoelMarcey
cellToBool, simplifyConvArrToBool, tvCastToBooleanInPlace don't match on NVTW

Summary: simplifyConvArrToBool and cellToBool call ArrayData::empty(), but
tvCastToBooleanInPlace has a comment saying it is intentionally
calling ArrayData::getSize() and having PHP5-incompatible behavior for
NVTW. This diff changes the first two to match the third.

Reviewed By: @oyamauchi

Differential Revision: D1406933
Fix cgIsScalarType assuming its argument is not const

Summary: Causes a test to fail with the simplifier disabled.

Reviewed By: @bertmaher

Differential Revision: D1406946
Add support for class constant shapes to hhvm.

Summary: Add support for using class constants as field names in shapes to HHVM.

Test failures already present.

Reviewed By: @jdelong

Differential Revision: D1381174
Reduce from four ways to look up Unit*'s to one

Summary: The 'eval' vs. 'lookup' distinction doesn't make
sense---neither of them did any evaluation.  I also didn't know what
an "include root" was or why you'd want to look one up.  Refactor
things so there's just lookupUnit (still on ExecutionContext for now).

Reviewed By: @bertmaher

Differential Revision: D1384187
Don't use FileRepository to find systemlib md5s

Summary: There's no need to do this---we can just ask the repo.

Reviewed By: @swtaarrs

Differential Revision: D1386880
Move lookupUnit out of ExecutionContext

Summary: Intermediate refactoring step.

Reviewed By: @alexmalyshev

Differential Revision: D1386881
Break more dependencies on PhpFile* outside of file-repository.cpp

Summary: EvaledFilesMap and debugger stuff still used these, but only
to call getFileName().  After some investigation, it looks like
phpFile->getFileName() is always equivalent to
phpFile->unit()->filepath() (we set the unit's filepath to the same
string we're going to pass the PhpFile constructor), even with
Eval.CheckSymLink on, so we can skip it.  While looking through this I
noticed m_evaledFilesOrder was being added to even if we're doing a
non-initial include of a file we've already included via a different
path, which makes the results of get_included_files not match php5, so
this diff also fixes that.

Reviewed By: @alexmalyshev

Differential Revision: D1386883
Hide the rest of FileRepository guts into its implementation

Summary: A few utility functions are still exported, but the main API
to this module is now just "lookupUnit", which is hopefully
understandable enough that it should be easy to replace the internals
with something more sane now.  (Later diff renames the file, it's a
"FileRepository" isn't a thing anymore.)

Reviewed By: @swtaarrs

Differential Revision: D1386886
Reflow various documentation to 79 columns

Summary: mwang and bsimmers like it better.

Reviewed By: @swtaarrs

Differential Revision: D1386888
Separate RepoAuthoritative Unit caching from the rest of the code

Summary: It's different enough that this seems less complex.  (And it already
made use of an entirely separate ConcurrentHashMap, anyway.)

Reviewed By: @mxw

Differential Revision: D1386891
Rewrite non-repo version of the thing formerly known as FileRepository

Summary: It was buggy, and had evolved poorly.

The main bug related to the ~PhpFile codepaths and the md5 map.  A treadmilled
PhpFile could be reused even though its unit was scheduled to be deleted.  This
diff fixes the race by having clearer ownership, and eliminating the md5 map.

Rationale on not reimplementing the md5-based cache for now: we are including
the file's path into the md5 to avoid sharing the "same" unit for files with
different paths (it would break the "Dir" and "File" opcodes as currently
implemented).  We also already have a cache to avoid starting from scratch if
the contents are the same (the Repo), so this only only can save on duplicating
JIT time/space, and Unit load time.  It also shouldn't be hitting very often: I
think the main case is if you manage to have the mtime change on a file without
the file contents actually changing.  Multiple copies of the "same" file for
different www checkouts on a shared server won't be getting shared Units right
now, and switching branches and then switching back can only reuse the Unit if
it either goes through the buggy code path and reused it even though it was
treadmilled or if the unit wasn't loaded since the time you were on the
previous branch.  So, I'm thinking let's make it simpler now and optimize it
again if we need to later.

Reviewed By: @swtaarrs

Differential Revision: D1386893
Rename file-repository to unit-cache

Summary: This is just a rename diff.  It's on top of everything else so we can
choose different names without me needing to rebase, if anyone has a better
naming idea.  This seems like a reasonable name, although both resolveVmInclude
and mangleUnitMd5 feel slightly out of place now (but resolveVmInclude (and
resolve_include) are pretty convoluted for historical reasons and deserving of
their own cleanup pass anyway, which I'm going to consider out of scope for now
since it's not causing bugs as far as we know ...).

Reviewed By: @mxw

Differential Revision: D1386894
Still use RankedCHM for unit-cache; rename the rank

Summary: I haven't changed anything to stop us from holding these tbb locks for
long periods of time, and these assertions have caught bugs, so they should
stay.  (I forgot about it in D1386893.)

Reviewed By: @elgenie

Differential Revision: D1396824
A few comment tweaks in the file-repository diff stack

Summary: Stuff from some review comments.  (So I don't have to rebase them
through the stack.)

Reviewed By: @swtaarrs

Differential Revision: D1408001
Hack can build on OSX now

Summary: Closes #3051

Reviewed By: @ptarjan

Differential Revision: D1408166

Pulled By: @JoelMarcey
Split off libxml extension and convert to HNI

Summary: The libxml extension was in ext_simplexml.cpp. I don't think we need
multiple extensions per file. Also converted to HNI. Constant
registration was adapted from PHP 5.6.0-dev, using the libxml error
files as a source instead of hard-coding everything as is required by
constants.idl.json.

Moving LibXMLError from IDL to a systemlib fixes the serialization
failure which, despite being included in an expectf file, does not occur
in PHP. Updated the expectf file to match the PHP output.

* Made a header file for libxml_use_internal_error() and
  libxml_add_error() instead of repeating the definitions.
* Cache a Class pointer in a static variable, following
  the example of ReflectionException.
* Rename LibXmlErrors to LibXmlRequestData, since it contains more than
  just errors.

Submitted on behalf of a third-party: The PHP Group
Source: PHP 5.6.0-dev
License: version 3.01 of the PHP license
Closes #3012

Reviewed By: @fredemmott

Differential Revision: D1397523

Pulled By: @JoelMarcey
Use flags from ArrObj/ArrIt when constructed from ArrObj/ArrIt

Summary: Fixes zend test.
I don't include a test, because that zend test is pretty straightforward for this one
Closes #3026

Reviewed By: @fredemmott

Differential Revision: D1400296

Pulled By: @JoelMarcey