Disable flaky test/zend/good/ext/standard/tests/file/fileowner_basic.php

Reviewed By: @dariorussi

Differential Revision: D1059751
Handle UTF-8 chars in string_html_encode like Zend

Changes string_html_decode's behavior with non-ASCII UTF-8 chars to
be more like Zend's.

Reviewed By: ptarjan

Differential Revision: D1055317
Add support for named subpatterns in preg_replace*

It was implemented for preg_match but not others.

Reviewed By: ptarjan

Differential Revision: D1052338
Record the Laravel expect file again after git hash change

We changed the Laravel git has (due to ptarjan getting a pull request accepted). Let's record the expect file again.

Reviewed By: @alexmalyshev

Differential Revision: D1059633
deal with case-insensitivity in get_class_methods

Reviewed By: @jdelong

Differential Revision: D1057571
Implement PDO::sqliteCreateFunction (again)

Need to sync VM state before calling functions that execute
SQL queries, some of which are PDOStatement::{execute,fetch}.

Reviewed By: ptarjan

Differential Revision: D1059768
Remove dead code in hphp/compiler

While working on something else I noticed a bunch of dead code (presumably related to hphpc) so remove it.

Reviewed By: @markw65

Differential Revision: D1059801
Support getShortName and getNamespaceName for ReflectionFunctionAbstract

This diff added two methods getShortName and getNamespaceName to class ReflectionFunctionAbstract,
 so classes ReflectionMethod and ReflectionFunction can use these two methods.

The implementation is compatible with Zend implementation:

https://github.com/php/php-src/blob/0d7a6388663b76ebed6585ac92dfca5ef65fa7af/ext/reflection/php_reflection.c

Reviewed By: ptarjan

Differential Revision: D1058177
Clean up Translator::Get() and stuff, remove TC-cycling logic

Calling through tx(), TranslatorX64::Get(), and Translator::Get() is
utter nonsense. The global tx64 object now doesn't need to be
thread-local; it can just be global, since there really is only ever one
during the entire process lifetime.

The TC-cycling logic isn't used, hasn't been tested in ages, and as such
is likely broken, so I'm removing it.

I also devirtualized a bunch of crap in Translator, and added the
override virt-specifier to the two legit overrides in TranslatorX64.

Reviewed By: @jdelong

Differential Revision: D1059757
Use more ArrayInit

I noticed some unnecessary Array growing when looking at LLC-store-misses,
this fixes a few of the top ones.

Reviewed By: @markw65

Differential Revision: D1057028
Update Assetic hash because they fixed a bug

Assetic fixed a bug that was causing test failures for us.

https://github.com/kriswallsmith/assetic/pull/520

Reviewed By: @alexmalyshev

Differential Revision: D1060621
Unpeel the loops in HphpArray::find() and findForInsert()

This reduces loads and stores but costs a few more ALU instructions
that initialize registers that don't get used when we only probe
one time.

Reviewed By: @jdelong

Differential Revision: D1053987
Remove HphpArray::m_hash; compute it from the this pointer

Now that @edwinsmith has hoisted various redundant computations of
m_hash, this is adds less instructions.  It's still a slight increase
in instructions, but stores are slightly down and loads in the noise.
It seems better in principle to do some extra math rather than some
extra memory accesses, and it saves a small amount of memory.

Reviewed By: @edwinsmith

Differential Revision: D1060836
Hoist the first-byte check out of is_strictly_integer

It turns out that checking the first byte of a string to see if it's in
the range ['0', '9'] is a better early-exit than the isStatic + hash
sign bit check. We can also use the NUL-termination invariant to make
the check slightly more efficient: no need to check the length
separately, but just subtract '0' and use unsigned comparison with 9.

Ad hoc instrumentation with stats counters shows that the first-byte
check bails us out in the vast majority of cases.

Reviewed By: @edwinsmith

Differential Revision: D1060828
Remove CSE flag from GetCtxFwdCall

If this gets CSE'd, we will try to replace it with an IncRef,
which is a type error because it's not a subtype of Gen.

Reviewed By: @edwinsmith

Differential Revision: D1060856
Fix RecursiveIteratorIterator issues

Fix a couple of issues with RecursiveIteratorIterator

Reviewed By: @aryx

Differential Revision: D1060266
New refcount optimization pass

This diff replaces the old DCE-based refcount optimization with one
based on an algorithm we trust a lot more. Both optimizations rely on each
produced reference being consumed exactly once, and this new pass verifies that
fact as it goes along. This caught a number of leaks and other refcounting bugs.

I tried to heavily document the code itself, so for an overview of the
optimization start at the optimizeRefcounts function in refcount-opts.cpp. A
few notes about changes not contained to refcount-opts.cpp:

- IncRef no longer produces a new SSATmp. This allows us to generate IR in more
  straightforward ways without worrying about which IncRefs chain to which
  DecRefs.
- All refcounting instructions are now marked Essential. DCE will leave them
  alone, and only optimizeRefcounts will move or remove them.
- The code in FrameState that knows how each opcode affects the current locals
  has been separated from the code to update the tracked state of those
  locals. This allows the optimization to also take advantage of this
  knowledge.
- OverrideLoc and SmashLocals have been removed, and their behavior has been
  folded into the instructions they used to follow. This was needed so we can
  process each instruction and its effects on locals atomically.

Reviewed By: @ottoni

Differential Revision: D1044602
Differential Revision: D1062844
Differential Revision: D1054603
Add AsyncAwait opcode to speed up await code path

The logic for await expr is:

  - check if expr is null, if so return null
  - if expr is not a WaitHandle, call getWaitHandle

  - if the wait handle is finished, either pull out its result or
    throw its exception
  - else if it's unfinished, either suspend the continuation or if
    we're eagerly executing the async function, wrap it in a result
    wait handle and create an async function that will continue here.

This diff changes the null check to not do reference counting (use an
unnamed local instead of Dup), and makes an opcode to speed up the
logic in the second part, by removing function calls and reference
counting due to another Dup.

Reviewed By: @jano

Differential Revision: D1058415
Don't email anyone since we do bulk pushes

The person who's diff is on top is not necessarily to blame
Add GCC 4.7.x workaround for asio

Summary: asio needs _GLIBCXX_USE_NANOSLEEP to compile on 4.7.x as well.