Support "return;" in generators

Summary: When FB originally built generators for HPHPc way back in the
day, we used `yield break;` to exit from a generator. When PHP picked up
the feature, they just used `return;` -- so return with no value is
legal in a generator (but returning a value is of course not). The
typechecker should understand this behavior.

Reviewed By: @jano

Differential Revision: D1467566
Fix isset on classes extending ArrayObject

Summary: Only ArrayObject::offsetExists should get special treatment.
X::offsetExists, where X extends ArrayObject, and overrides offsetExists
should just trust the result.

Closes #3309
Closes #3315

Reviewed By: @ptarjan

Differential Revision: D1467894
Fixes for Redis extension and associated test suite

Summary: * Fix a couple of tests that were broken by 91b1918 adding two lines to the
  wrong expect file (list.php.expect instead of info.php.expect).
* Fixed hphp/test/slow/ext_redis/watch.php.expect to expect the correct
  behavior. (Tested by verifying with Zend + phpredis.)
* Make the key prefix set by the test suite include the md5 of the file path
  plus UNIX timestamp representing the test suite initialization. This makes
  the tests not break when the path exceeds the redis key length limit and it
  makes repeated test runs not conflict with one another.
* Make Redis::sRandMember apply the key prefix (if one exists).
* Make Redis::get() and Redis::h{m}get() return false rather than null for
  missing keys or fields, matching the behavior of phpredis.

Minimal test case for the false / null behavior:

    <?php
    $redis = new Redis;
    $redis->connect("localhost");
    var_dump($redis->get("nonexistent-key"));
    $redis->hMset('ice_cream', array('flavor' => 'vanilla'));
    var_dump($redi

Closes https://github.com/facebook/hhvm/pull/3318

Reviewed By: bsimmers, ptarjan

Differential Revision: D1467674

Pulled By: svcscm
Implement a basic version of first-class enums in Hack.

Summary: Implement a basic version of first-class enums in Hack. They allow the declaration of enums with a specified underlying type that all of the constants are checked against. The actual type of all of the constants, however, is the name of the enum. Specifying 'as typ' after the enum name will cause the enum to be treated as a subtype of typ (typ must be a supertype of underlying type).

Reviewed By: @jwatzman

Differential Revision: D1428116
Use GNUInstallDirs.cmake

Summary: I don't know if GNU install dirs (e.g. lib64 instead of lib) would be preferred, but here's a PR for changing the install behavior if it is. Thoughts?

Note: This was originally based on HHVM-3.2 branch as [PR #3272](https://github.com/facebook/hhvm/pull/3272)

Closes https://github.com/facebook/hhvm/pull/3323

Reviewed By: ptarjan, kdm

Differential Revision: D1469517

Pulled By: svcscm
Add HHVM hookups for folly::Singleton

Summary: Originally this was part of D1404231, but split out when that
diff was reverted to allow the public folly repo to catch up with the
internal one.

This also converts the AsyncMysql library to use folly::Singleton
instead of a Meyers singleton.

Reviewed By: akhi

Differential Revision: D1457868
typechecker: typing new static() [1/2]

Summary: Adds a boolean to constructor type to track compatibility and
 cleans up surrounding code. This boolean is not yet being used in
 anger to enforce "descendants of this class must have compatible
 __construct declarations", but that's the purpose.

Reviewed By: @jwatzman

Differential Revision: D1466609
More flaky failures

Summary: disable flaky tests

Reviewed By: @ptarjan

Differential Revision: D1469323
use third-party sqlite3 if pkg-config reports version 3.8.5 installed

Summary: - not sure of the actual incompatibility, but HHVM fails to initialize the central repository with sqlite3 version 3.8.5

Closes https://github.com/facebook/hhvm/pull/3270

Reviewed By: @ptarjan

Differential Revision: D1455370

Pulled By: svcscm
Add skipped tests to the result set

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

Reviewed By: @LiraNuna

Differential Revision: D1470614

Pulled By: svcscm
use cmake variable to set linker flags

Summary: Putting static linking in C(XX) flags is total overkill, and CMake
provides a nice variable for these kinds of linker flags.

Closes https://github.com/facebook/hhvm/pull/3311

Reviewed By: @sgolemon

Differential Revision: D1467630

Pulled By: svcscm
Update Travis CI config so it runs ext_redis tests

Summary: * Declare a redis service, per
  <http://docs.travis-ci.com/user/database-setup/#Redis>
* Set the env var REDIS_TEST_HOST so hphp/test/slow/ext_redis/config.skipif
  doesn't skip the tests.

Closes https://github.com/facebook/hhvm/pull/3317

Reviewed By: @sgolemon

Differential Revision: D1467670

Pulled By: svcscm
Remove docs about call_user_func_async

Summary: They has been removed, remove doc about them.

Closes https://github.com/facebook/hhvm/pull/3310

Reviewed By: @sgolemon

Differential Revision: D1467623

Pulled By: svcscm
Move zend xsl test from flaky to bad

Summary: It's legitimately failing

Reviewed By: @LiraNuna

Differential Revision: D1471013
Expose extension API version in output of 'hhvm --version'

Summary: It's useful for packaging and configuration management scripts that want to
determine where dynamic extension files should be placed.

Closes https://github.com/facebook/hhvm/pull/3322

Reviewed By: sgolemon, ptarjan

Differential Revision: D1469518

Pulled By: svcscm
Flaky disk-space zend tests

Summary: Looks like these both create a disk_total_space

Reviewed By: @LiraNuna

Differential Revision: D1471055
Fix IRBuilder::startBlock

Summary: This function was merging the current FrameState with the block that was about to be started, which is only correct when translating traces. This function was also doing other things that didn't seem necessary (clearing CSE stuff and compatibility checks), which I removed. Finally, this function was doing some block-chaining that isn't correct in general and only seems to be needed for inlining. So I moved this to translateRegion. The end result is that IRBuilder::startBlock now only saves the state for the current block and the switches to the new block.

This diff also adds to Translator a pointer to the current region being translated, which is useful for debugging. This helped me find a bug in createBlockMaps that was causing an assert failure in the refcount validation.

Reviewed By: @bertmaher

Differential Revision: D1436362
Spelling errors in documentation

Summary: Title.

Reviewed By: @bertmaher

Differential Revision: D1465806
Prototype of general host health monitor.

Summary: 1. Extended the memory protector to a general system health monitor,
which takes multiple system metrics into account. The metrics that
are considered by the monitor can be added by creating corresponding
classes (implementing the IHealthMonitorMetric interface, see
'hphp/facebook/runtime/health-monitor/health-metrics.h'), and then
registering it to the health monitor.

2. The health monitor will periodically update all metrics and then
calculate a unified current system health level, then broadcast it
to all observers. Objects that implement IHostHealthObserver interface
can subscribe the system health level by registering themselves as
observers of the system health monitor.

3. Health monitor outputs are exposed to external systems by notifying
the "external-clients-shim" proxy. Currently, it is send to stats.kvp
on port 8088.

The display on Phabricator is a little messy:

— "hphp/util/health-monitor-types.h" is newly added, contents in it
(several interfaces) are abstracted out from job-queue.h and
memory-protector.h, but Phabricator recognizes it as “renamed and
modified from protector-policy.h”.

— Similar things happens to “hphp/facebook/runtime/health-monitor/external-clients-shim.h”
and “host-health-monitor.cpp”.

Reviewed By: @bertmaher

Differential Revision: D1458015