Check for unbalanced arrays only when growing

Summary: Do the checks only when the array grows beyond 100 elements.

Reviewed By: @edwinsmith

Differential Revision: D1310806
Remove constrainBase assertion when HHBBC infers more precise type

Summary: This assertion was failing in a prod-repo debug build for me,
and the reason is that HHBBC has inferred that the base is PtrToInit
(which is neither isBoxed nor notBoxed).

Reviewed By: @swtaarrs

Differential Revision: D1310534
Move the rest of LdObjMethod's constants to ExtraData

Summary: We put "fatal" in extra data, but the opcode signature mostly
predates that (it's old enough that it was even taking the context
class as an argument, which we stopped doing).  Also make a few things
const, remove some C-style casts, and update the spec for "fatal".

Reviewed By: @edwinsmith

Differential Revision: D1310648
Convert SpillFrame to deal with Nullptr instead of InitNull

Summary: We now make a distinction between InitNull (PHP null values,
subtypes of Cell), and internal null pointers (unrelated to the Cell
type).  Make this opcode do it too.

Reviewed By: @edwinsmith

Differential Revision: D1310659
Some cleanup on the IR Call instruction

Summary: I was looking at how hard it would be to leave the things on
the stack instead of popping them (I think it is doable---I will try
in a little bit), but I did this separately in case that change
doesn't work.  This diff moves the compile time constants to extra
data, (finally) hooks it into the type assertion pass, and fixes the
docs a bit (a bit misleading about the meaning of S3, and still
referred to Type::None wrt a broken optimization we deleted a while
ago).

Reviewed By: @edwinsmith

Differential Revision: D1310673
Remove dead references to Type::None in the ir.spec

Summary: It died a little while ago.

Reviewed By: @edwinsmith

Differential Revision: D1310674
Make Call not require loading everything from the stack

Reviewed By: @edwinsmith

Differential Revision: D1310702
Change TransKind into an enum class

Summary: And remove redundant getTransKindName function.  (Split this
into its own diff for reviewability.)

Reviewed By: @bertmaher

Differential Revision: D1311798
Add an API for profiling arbitrary things to use during PGO translations

Summary: Adds a TargetProfile<> utility that lets you record
information during a profiling translation, and query the results
during an optimized translation.  Also adds a new RDS mode called
"Local", which is data that is thread local but not-zero'd on every
request (we may also find a different use for this).

Nothing uses this yet, but there are few more ideas we can try before
giving up, so @ottoni and I were thinking it's worth putting up a diff
for the API on its own.  (I'm going to try to use it to profile for
array kinds today.)

Reviewed By: @ottoni

Differential Revision: D1312058
Implemented PHP5.6's use const feature

Summary: This diff implements `use const` sementics from PHP5.6 (RFC https://wiki.php.net/rfc/use_function).

Reviewed By: @elgenie

Differential Revision: D1309132
auto import 'this'

Summary: HHVM was qualifying `this` to `my\namespace\this` then complaining when the return type didn't work.

Closes #2428
Closes #2442

Reviewed By: @paroski

Differential Revision: D1290082

Pulled By: @LiraNuna
Test case for htmlentities() on UTF-8 strings.

Summary: Closes #2266
Closes #2551

Reviewed By: @ptarjan

Differential Revision: D1305987

Pulled By: @JoelMarcey
Remove vsize check/call from ConvArrToBool

Summary: See the comment. This will add a known incompatibility, but in a case
that will never arise in practical code.

Reviewed By: @edwinsmith

Differential Revision: D1312929
Fix some issues with Func::setFullName

Summary: When Eval.PerfDataMap is true, we need the number of parameters in
Func::setFullName, but its no longer available in m_numParams at the time
we call it due to variadic parameter changes.

Pass it in instead.

Reviewed By: @edwinsmith

Differential Revision: D1314506
Make stream URI detection match PHP5

Summary: - Brings assetic back to 100%
- Guzzle3 sticks at 100%
- Guzzle4 goes back up to 93.03% (dropped at same time as assetic)

Implementation taken from PHP5

fixes facebook/hhvm#2621

Reviewed By: @ptarjan

Differential Revision: D1313842
Add json_last_error()

Summary: I added this to www but wasn't sure what magic syncs this.

Reviewed By: @ptarjan

Differential Revision: D1315247
reflection perf: implement ReflectionFunction/Method using HNI

Summary: One of the reasons HHVM reflection has been rather slower
 than it needs to be because it's been doing oodles more work than it
 is being asked. When queried to determine whether a function is
 private or protected, there would be massive amount of data
 allocation going towards the creation of an oracle array that would
 be able to answer questions about, e.g. the php code used for the
 default values of the parameters.

 This diff replaces the oracle array for ReflectionFunction/Method
 with native data holding a ## Func* ##. The ## Func* ## is then used
 to directly answer the vast majority of questions asked of reflection.

 Interesting elements:
  - Previous impls of ReflectionFunctionAbstract, ReflectionMethod, and ReflectionFunction
    have been renamed with a ##Bak## suffix for ease of review
  - A few reflection tests that relied on ##var_dump## containing the oracle array
    have been rewritten to call the methods that (I think) they're interested in
  - ReflectionFunction for closures is much cleaner compared to the wrapping of
    hphp_get_closure_info
  - UserAttribute methods are less repetitive than before.

Reviewed By: @dariorussi

Differential Revision: D1313542
reflection: remove old impls of ReflectionFunction/Method

Summary: In the wake of {D1313542}, these implementation built around
 the oracle array are no longer needed

Reviewed By: @ptarjan

Differential Revision: D1315305
reflection: remove hphp_get_{closure|method|function}_info builtins

Summary: These internal builtins are no longer needed in the wake of
 {D1313542} -- Func info for reflection now comes from a ##Func*##,
 rather than from an array of holding calculated from a
 Func. ##closure_info## is completely deleted here; ##method_info##
 and ##function_info## will need to stick around for a while because
 they're used for the debugger info command ... but that doesn't need
 them to be available to PHP code.

Reviewed By: @ptarjan

Differential Revision: D1315383
introduce DebuggerReflection, speed up ReflectionClass method calc

Summary: The builtin supporting ##ReflectionClass## was doing some
 work and allocation for each method, then throwing that work away to
 create a new ##ReflectionMethod## using just the name of the
 method. The only place where those pieces of method info are used is
 in the debugger.

Reviewed By: @ptarjan

Differential Revision: D1315445