Make new stack_overflow test more tolerant

In contbuild it's failing on line 5 instead of 6.

Differential Revision: D937472
Improve error message for post-try blocks which are not finally

Currently, hhvm interprets post-try blocks not necessarily
beginning with an actual finally token as finally blocks, and thus
produces an error message to the user telling them finally blocks
are disabled even if they misspelled something, for example.

This moves things so the "finally disabled" message only comes up
if you enter a syntactically valid finally block.

Differential Revision: D918867
Add DataTypeProfiler

You can use this anywhere to sample the DataTypes at a particular
point in the code, for example calls to JIT helpers.

Differential Revision: D925193
Prerequisites for eager execution of async functions

Here's a few minor changes in emitter that will be needed later for
eager execution of async functions. Just to make the upcoming diff
sipmler.

Differential Revision: D935301
Rename VectorTranslator to MInstrTranslator

Vector has become too overloaded in this codebase. MInstrTranslator is
more accurate anyway; we have multiple different types of hhbc opcodes with
immediate vectors that aren't m-instrs.

Differential Revision: D935859
Implement ReflectionParameter::IsCallable()

The Facebook SDK unit tests fataled because ReflectionParameter::IsCallable() was not implemented. So, this implements it. Now the unit tests pass. Bad zend test now passes!

closes #931

Differential Revision: D938769
Optimize string same() and hitStringKey()

Most strings used as keys are either small or not shared, where the
data pointers cannot be equal.  Of the rest (shared), most could have
been small.

This diff copies small SharedVariant strings, so they don't refer
back to the SharedVariant, and don't need to be enlisted.  Then,
this changes hitStringKey() to not check data pointers, making it
equivalent to StringData::same().  Lastly, hand-write the comparison
loop in StringData::same() so we compare words at a time, and the
loop can be inlined.

Differential Revision: D937233
Parser refactorings: onFunction/onMethod/onClosure

We have separate methods for parsing functions and methods
(onFunction/onMethod), which have a lot in common. On the other
hand, onClosure just calls onFunction with a special parameter
that modifies its behavior. Lets make this more consistent and
remove the duplicated code.

Differential Revision: D934034
fixed serialize/unserialize for SplObjectStorage

added error handling for bad serialized strings according to zend tests.
We cannot move the actual tests from "bad" to "good" because ATM they
rely on the internal serialized string format of SplObjectStorage, which
is not yet reimplemented.

Closes #969

Differential Revision: D935251
Remove some dead profiling code

This profiling path was unused after D894723. Removing it.

Differential Revision: D934477
multiple simplexml fixes

- multiple fixes for simplexml required by magento

Closes #790
Closes #819
Closes #955

Differential Revision: D925428
move more helpers out of code-gen

Move more stateless platform dependent and agnostic helpers out of
code-gen.cpp

Differential Revision: D936727
use trigger_error in PHP for Redis user errors

- trigger_error is intended for reporting user errors, not
error_log

Closes #970

Differential Revision: D937921
Reduce bad error spam on too few arguments

function foo($bar, $baz) { }
  foo();

Currently raises two errors:

  foo() expects exactly 2 parameters, 0 given
  foo() expects exactly 2 parameters, 1 given

Only the first of these is either meaningful or correct.
Stop reporting once we've raised it.

Differential Revision: D939810
fallback to default separators in number_format

When number_format receives 'null' for one of its separator parameters,
we must pass it back to t_number_format so it can decide whether or not
it should fallback to its default separators.

Currently, when passing NULL to a parameter that is defined as String,
it is implicitly converted to an empty string, and subsequently
str.isNull() will return false.

Instead, we use a Variant with a default string value.

Closes #982

Differential Revision: D940482
ReflectionProperty(null,null) should throw

ReflectionProperty constructor should reject nulls

Closes #975

Differential Revision: D939337
Support "(new Vector {..})->method()" style syntax

This diff adds support for calling methods directly on collection literal
expressions (as long as the collection literal is wrapped in parentheses).

Differential Revision: D940562
Move util/zend (which defines zend.a) up one level.

And rename _ to - while we're at it.

Differential Revision: D925182
HHVM should compile with libmemcached 1.0.9+

libmemcached 1.0.8 broke the memcache/memcached extensions. It
is also missing some API support we need, so this should unbreak us as
of 1.0.9+. 1.0.8 plain won't work but earlier and later will.

Closes #934
Closes #973

Differential Revision: D939850
Fix generator-related errors in PHProf output

Fire EventHook::FunctionExit() in the correct places for generators. This was happening during Continuation destruction, which is quite a while after we exit the continuation, and causing double notifications for continuation exits. Also fire the event when unwinding out of a generator, since that one was missing.

Differential Revision: D939893