Create hhi for ext_icu_num_fmt

Summary: Creating a hhi file for NumberFormatter.

Reviewed By: @ptarjan

Differential Revision: D1582010
Refactor coloring code.

Summary: Delete unused syntax types, and refactor stuff in preparation
for the coverage metric

Reviewed By: @jwatzman

Differential Revision: D1583292
Add support for testing --color output.

Reviewed By: @pikatchu, @jwatzman

Differential Revision: D1585049
Implement per-file coverage metric.

Summary: I will handle directory-level coverage in a later diff. Most of the coverage code has been implemented on the server so we can parallelize that easily.

Reviewed By: @jwatzman

Differential Revision: D1583293
Fixes edge case involving bool args

Summary: If it's possible that the result of a memoize call can be null, we emit an array_key_exists check to see if the result is already cached. For boolean arguments, it would warn and always return false. So this casts the boolean arg to make the scenario work properly.

In order to make the code a little easier, this diff takes ?bool out of the fast path and makes it use the serialiation function. Since I can't actually find a use of ?bool as a typehint in tbgs, I think it's a reasonable choice.

Reviewed By: @elgenie, @jano

Differential Revision: D1598744
Disallow <<__Memoize>> on interfaces

Summary: One of the points of <<__Memoize>> is that it can be applied per function only where it makes sense. Interfaces shouldn't be able to require it. See the attached task for other reasons <<__Memoize>> on interfaces causes problems

Reviewed By: @jano

Differential Revision: D1599002
Don't crash on uncounted property initializers with AttrDeepInit set

Summary: The property initialization expression in the new test was causing
EmitterVisitor::requiresDeepInit to return true. This is bad for performance
because the value doesn't really need deep initialization, but more
importantly, we had code in the runtime that was assuming AttrDeepInit
properties were always refcounted. The change in emitter.cpp fixes the first
problem, which might help perf a little, and the change in object-data.cpp
protects us against any other expressions that could produce an uncounted
value.

Reviewed By: @markw65

Differential Revision: D1587716
Implement directory-level coverage stats.

Summary: Now you can do either `hh_client --coverage filename.php` or
`hh_client --coverage somedir/`. We will output a JSON representation of the
directory tree in the following format:

Directories are represented by

{ "type": "directory", "result": result, "children": {directory_or_file: result} }

Files are represented by

{ "type": "file", "result": result }

Coverage result types are represented by

{ "counts": { "checked": int, "unchecked": int, "partial": int }, "percentage": float }

where percentage = (checked + partial * 0.5) / (checked + partial + unchecked)

Reviewed By: @jwatzman

Differential Revision: D1588577
Take HH_FIXMEs into account in --color.

Summary: This required a refactor to move more of the coloring code
from the client to the server, because HH_FIXMEs are stored in the
ParserHeap which are only available server-side.

Reviewed By: @jwatzman

Differential Revision: D1589761
Use a map instead of an assoc list for coverage counts.

Reviewed By: @elgenie, @jwatzman

Differential Revision: D1596223
improve perf.php --help

Summary: ```
[fredemmott@devbig076 ~/fbcode/hphp/test/frameworks/perf] hhvm ./perf.php --help
Usage: ./perf.php \
  --<php5=/path/to/php-cgi|hhvm=/path/to/hhvm>\
  --<toys|wordpress|sugarcrm-login-page>

Options:
  --help
  --verbose
  --php5:
  --hhvm:
  --siege:
  --nginx:
  --toys
  --wordpress
  --sugarcrm-login-page
  --i-am-not-benchmarking
  --hhvm-extra-arguments:
  --skip-sanity-check
  --skip-version-checks
  --skip-database-install
  --trace
  --delay-nginx-startup:
  --delay-php-startup:
  --delay-process-launch:
  --delay-check-health:
  --max-delay-unfreeze:
  --max-delay-admin-request:
  --max-delay-nginx-keepalive:
  --max-delay-nginx-fastcgi:
  --daemon-files
  --temp-dir:
```

Reviewed By: @oyamauchi

Differential Revision: D1597196
Remove reflection hack for "HH\this"

Reviewed By: @elgenie

Differential Revision: D1512593
Get rid of mangle map stuff

Summary: This diff eliminates the need for using 'objdump' and making a map of
mangled C++ symbol names during the build. ext_hhvm was changed to instead
generate extern declarations for all the native functions defined in the
.idl files, and to use function pointer casts instead of using
"asm(<mangled-name>)" declarations.

Measurements on my dev machine show that this diff decreases hhvm build
times by 5% - 9%.

Reviewed By: @ptarjan

Differential Revision: D1556958
Autocomplete - fix bugs where locals show up multiple times in results in a for loop

Summary: When for loops are typechecked, our hooks get called multiple times.

All the hooks had protection from this except for the locals hook because it was checking a position instead of using is_autocomplete. (is_autocomplete for locals happens in naming because the var names are dropped there)

This makes it so we only get a single pass's worth of locals in the results.

I also noticed the types weren't printing well in this case with a fake environment, so I changed the code to use the stored one.

Reviewed By: @jwatzman

Differential Revision: D1597855
Remove runtime option and check for number of allocated cloned closures

Summary: This hasn't caught any real issues, and in sandbox mode we can legitimately create a lot more functions than in prod.

Reviewed By: @mclarkelauer

Differential Revision: D1598989
array_filter improvement

Summary: Sorry for going back and forth with that, but after working with this new typing in www I revised my views and would like to propose a slight improvement to typing (which I think we discussed and there wasn't any strong voices against, except it being "technically" incorrect).

So:

  function test(array<int, ?string> $a) {
    $a = array_filter($a);
    $a[] = 'test';
  }

should remain an error - that's the important distinction between hashtable arrays and vector arrays. BUT, there is no good (beyond "vectors are intended to have contiguous keys", which nobody adheres to) for this to be an error:

  function test(array<?string> $a): array<string> {
    $a = array_filter($a);
    return $a;
  }

which is currently the case.

Reviewed By: @elgenie

Differential Revision: D1584945
Fix symbolizing of OOM stack when text is mapped huge

Summary: When we map out part of .text and re-map it with huge pages, we lose
the address range -> filename mapping in /proc/self/maps, which
folly::symbolizer uses to figure out which file to search for symbols.  This
adds a pass to symbolize using /proc/self/exe, assuming no relocation.

Reviewed By: @markw65

Differential Revision: D1580689
import_zend_test.py now executes CLEAN sections properly

Summary: php-src is inconsistent with test's CLEAN section. Sometimes it starts with php open tags sometimes it doesn't.
e.g. https://github.com/facebook/hhvm/blob/master/hphp/test/zend/bad/ext/gd/tests/imagegd_nullbyte_injection.php

Also, php-src doesn't execute the CLEAN section when the test is executed. So all errors will be ignored. set error_reporting to 0 when the CLEAN section begins to ignore all errors as well.

Talked to ptarjan on IRC because my reimport will do stupid things and maybe a really nice oncall will do me the favor and reimport the whole thing? :)

Also PHP 5.6.1 is out, I don't know if it makes sense to start the import of the new version without importing 5.6.0 again.

From what I see from my import this should fix a bunch of bad tests :)
Closes https://github.com/facebook/hhvm/pull/3910

Reviewed By: @ptarjan, @JoelMarcey

Differential Revision: D1597942
hh_ide - output js objects instead of json

Summary: Instead of using out custom json pretty printing library, we'll now turn those same objects into javascript objects using js_of_ocaml's library functions.

Then, if we want json, we can use the native javascript's JSON.stringify to turn it into perfect json, instead of our hacky thing. (This'll be faster too.)

Also, this will let callers simply look inside the object instead of having it serialized and then deserialized for no reason (faster).

Reviewed By: @jwatzman

Differential Revision: D1598170
Update news for Ultramagnetic

Reviewed By: @bertmaher

Differential Revision: D1600431