Add unimplemented collection functions

There were a bunch of collection-related functions (e.g. collectionSet()) that
FrozenVector didn't implement. Fix that.

Reviewed By: @paroski

Differential Revision: D1066321
Always spill the stack before conditional jumps

This enables more opportunities to smash the jump in 'a', thus
avoiding going through astubs.

Reviewed By: @swtaarrs

Differential Revision: D1095483
Stop being an error() clown.

@ptarjan's cronjob brought about an error that looked like this:

HipHop Warning: error() expects exactly 1 parameter, 0 given in /data/users/ptarjan/fbcode/hphp/tools/command_line_lib.php on line 16
HipHop Fatal error: Argument 1 passed to error() must be an instance of string, null given in /data/users/ptarjan/fbcode/hphp/tools/command_line_lib.php on line 16

Well, that is because error() requires a string as a parameter and there were cases in --csv where I called error() without a string.

Why the error is happening, we can hopefully find out after this fix too.

Fixed that. Actually re-did the erorr handling just a tad.

Reviewed By: @alexmalyshev

Differential Revision: D1096625
The PHP code model uses sourceLocation rather than location for the name of the source location property

Fixed the VM AST to Code Model serializer to use "sourceLocation" rather than "location". Also fixed the serialization of constant expressions to use "variableName" rather than just name and to use the original name field for its value. Also fixed serialization of closure expressions to check for the case where there are no captured variables.

Reviewed By: duv

Differential Revision: D1095904
Fix bogus asserts in c_Map's implementation

There were two erroneous asserts in c_Map's implementation that were failing
in some cases when elements in a Map were unset. This diff removes the bogus
asserts.

Reviewed By: @dariorussi

Differential Revision: D1096926
Misc cleanup

Simplify some IRTrace creation logic and clean up some type
smart::unique_ptr code now that we're on gcc >=4.7.

Reviewed By: @jdelong

Differential Revision: D1079241
XLS support for SIMD registers.

Adds a simd field to Abi, plus code to have allow & prefer
sets for each interval.  We try to allocate from the prefer
set, but always at least take from the allow set.  Doubles
always prefer simd.  In addition, instructions that load and
store Cells, prefer simd.  This mimics the existing policy in
linear-scan.cpp.

Also changes linear-scan.cpp to not prefer GPRs for a tmp
that is an XMM candidate but which crosses a native call,
when HHIREnableCalleeSavedOpt==false (since prefering GPRs
in that case is part of the optimization).

Add support for XMM registers to PhysRegSaver.  If we had
a live XMM (double or TypedValue) that spanned a call, it
wasn't getting saved.

Reviewed By: @ottoni

Differential Revision: D1091845
Mark variable as unused

It's even called _unused...

Reviewed By: @jdelong

Differential Revision: D1096686
Add request-based override for HHProf profile mode

Adds the ability to override the runtime option specifying
allocation vs. heap profile on a per-request basis by adding profileType=foo to
the query string specified in the HHProf start request.

Reviewed By: @edwinsmith

Differential Revision: D1096216
Account for other libelf implementations

Turns out that there's at least two implementations of libelf,
one at http://www.mr511.de/software/english.html, and the other at
https://fedorahosted.org/elfutils/. One of them has elf_getshstrndx
return 0 on success, and the other returns 1.

Reviewed By: @scannell

Differential Revision: D1095441
Fix incorrect condition in libmagic

File::seek returns true/false as a success status, so don't compare it
against a size_t.

Clang also doesn't like using an assignment in the condition of a
for-loop, wrapping it in parens silences the warning.

Reviewed By: @scannell

Differential Revision: D1096987
Always log soft/nullable type failures.

At this point, we want a way to always log these type warnings in the runtime (instead of the current 1/100 sampling). The next
step is to convert the nullable warnings into exceptions (see 83c970e1d8c01fd6e20c2cdb32d6a047c79edc4d).

Reviewed By: @paroski

Differential Revision: D1068880
Fix bug in side exit code

The code to detect a side exit to the first instruction in the
tracelet was broken for inlining, if the offset of the side-exiting
instruction just happened to be the same as the offset of the start
of the tracelet.

If we're inlining, we know they're not the same though, so skip the
check in that case.

Reviewed By: @jdelong

Differential Revision: D1096829
Rewrite reg-algorithms.h to not use PhysReg(int)

I'm trying to break dependencies on PhysReg's internal representation
(regnum for GP regs; regnum + constant offset for SIMD regs). This is
necessary to use it for ARM registers. This means forbidding direct
conversion between int and PhysReg, and this file is one of the worst
offenders.

I rewrote it to use PhysRegs everywhere (this doesn't ruin the compiled
code; PhysReg's only member is an int so passing it around by value
and copying it isn't a big deal), and in the process introduced
PhysReg::Map, which uses the convenient underlying representation to be
compact, but hides that detail behind an STL-like container interface.

The next step will be to flush out other places where implicit
int-PhysReg conversion happens, and squish it. Once it's all gone, we
can freely mess around with the internal representation of PhysReg, and
it will all be contained in PhysReg, PhysReg::Map, and RegSet.

Reviewed By: @edwinsmith

Differential Revision: D1095930
Avoid post test fatals from getting in the way of stats

This diff should hopefully help the cronjob run better.

The cronjob and my local runs were getting errors like this:

The stats file for joomla is corrupt! It should only have test names and statuses in it.

We were getting this because of hhvm cleanup core dumps, etc. after a test was run. Instead of printing stats in the stats file, we were printing this fatal information, which corrupted the stats file.

So, I captured this fatal information and directed it to the fatals file instead.

Reviewed By: @ptarjan

Differential Revision: D1097602
Append to the _script.errors file during a run of the script

Append to _script.errors during a single run of the script in case different frameworks have script errors during an --all run, for example.

Reviewed By: @ptarjan

Differential Revision: D1097486
Fix Redis typo

Fix redis typo

Closes #1341

Reviewed By: @JoelMarcey

Differential Revision: D1097766
Use ZendParamMode for all HNI methods

Removes method prologue as unnecessary since
we're coercing types during the call anyway.

Fixes fileinfo's HNI declarations to use nullable types.

Reviewed By: @ptarjan

Differential Revision: D1096599
Add ICU's IntlTimeZone and IntlIterator classes

Per zend implementation

Reviewed By: @ptarjan

Differential Revision: D1085605
Make PhysReg(int) private to RegSet

The two register allocators had some remaining offenders. XLS was really
easy to fix (and in fact it made the code nicer), whereas LinearScan
didn't want to go quietly.

There is one substantive difference: in the stress mode where LS has a
reduced number of free registers, the ones at the beginning of the
sequence will be reserved instead of at the end. I could have avoided
that by giving PhysReg::Map a reverse iterator, but I don't think it
matters that much.

Up next: remove PhysReg::operator int().

Reviewed By: @edwinsmith

Differential Revision: D1096303