Replace macros in Simplifier with templates

Replaces SIMPLIFY_{CONST,COMMUTATIVE,DISTRIBUTIVE} with templated
functions instead.

Reviewed By: @jdelong

Differential Revision: D1104151
Replace NoSurprise metadata with a JmpNS instruction

Just is easier to manipulate bytecode than metadata.  This
doesn't hook it up in hhbbc yet.  Also I removed surprise flag checks
from IterBreak: they aren't ever going to jump to loop heads.

Reviewed By: @markw65

Differential Revision: D1103402
Hook Op::JmpNS up to pass through in HHBBC

For now did it the easy way.

Reviewed By: @edwinsmith

Differential Revision: D1103613
Fix bugs relating to Uninits in the control-flow local type updates

locAsCell behaves like CGetL: it returns a subtype of
TInitCell (uninits become init nulls, and it dereferences TRef).
Since in these grouping functions we're about to set the loc back
"unchanged", we want something that does the deref but not the
conversion of uninit to init.

Reviewed By: @edwinsmith

Differential Revision: D1109766
Teach prediction optimization about no-dest IncRefs

The type prediction optimization checks for a specific pattern, which
changed once we dropped the dest operand of IncRefs.  This diff fixes
it.

Reviewed By: @jdelong

Differential Revision: D1110700
Default StatCache to off

We're turning it off in all of our configs, but we left it on
in the example OSS configs.  There's some sort of race-issue reported
on github, so let's turn the default to the tested configuration.

Closes #1402 (not the underlying problem, but we're not really
planning to make StatCache better any time soon).

Reviewed By: @edwinsmith

Differential Revision: D1108713
trait requires: thread into preclass [2/4]

traits should be able to state what they require of their
 subclasses:

  require implements SomeInterface
  require extends SuperClass

 This will aid hack in being able to typecheck trait bodies as well as
 allowing more disciplined trait coding (tying traits to class
 hierarchies, as happens in practice).

 This diff moves the trait requirement declarations into the preClass,
 but doesn't yet check them

Reviewed By: @jdelong

Differential Revision: D1101621
trait requires: check traits constraints at use time [3/4]

traits should be able to state what they require of their
 subclasses:

  require implements SomeInterface
  require extends SuperClass

 This will aid hack in being able to typecheck trait bodies as well as
 allowing more disciplined trait coding (tying traits to class
 hierarchies, as happens in practice).

 This diff introduces the checking of implements and extends
 constraints on the using class, and (less importantly) enforces that
 we're dealing with the right kind of class on traits.

Reviewed By: @jdelong

Differential Revision: D1101637
trait requires: check trait constraints on recursive traits [4/4]

traits should be able to state what they require of their
 subclasses:

  require implements SomeInterface
  require extends SuperClass

 This will aid hack in being able to typecheck trait bodies as
 well as allowing more disciplined trait coding (tying traits to
 class hierarchies, as happens in practice).

 This diff checks implements and extends requirements on recusively
 used traits (class uses trait that itself uses another trait that has
 requirements). The approach chosen is to walk the trait hierarchy for
 each Class instantiation; an alternative approach would be to keep a
 list of requirements in each trait Class and add to it.

 Note that nothing is done in repo mode, since traits end up flattened
 into using classes.

Reviewed By: @jdelong

Differential Revision: D1101640
use writeBE instead of append for fastcgi

Reviewed By: @simpkins

Differential Revision: D1111292
Refactor ext icu a bit

* Reduce copypasta by inheriting from a common IntlRequestData
  * Move some stuff into headers for interop between intl components

Reviewed By: @ptarjan

Differential Revision: D1107269
Only generate profiling translations after JitProfileRequests for functions that are already being profiled

Otherwise, for functions that we never saw during the first
Eval.JitProfileRequest requests, we'll generate profiling translations
that never get retranslated.

Reviewed By: aravind

Differential Revision: D1104276
Only consider classes that are final for specialization

That's a requirement from how we generate specialized guards, so don't
even let non-final classes enter into the type system.

Reviewed By: aravind

Differential Revision: D1109309
Move next edge from Block to IRInstruction

It's more precise to put the next edge on IRInstrution than on Block.
The current setup made it easier to add edges into the IR in general,
but this finally puts them where they should go.  This diff also
cleans a few things up: Edge now has an instruction field, which
avoids the need to set Edge.m_from whenever an instruction's block
changes; Edges are allocated separately, and only for instructions
that need them, which reduces sizeof IRInstruction by 16 bytes.
Every block must now end with a control flow instruction, even if it's
just a jmp to a next block.  Unnecessary jumps should already be
removed at code-gen time.

This diff also adds a Branch flag.  Any instruction that could have
an edge must have either the Branch flag or MayRaiseError flag, in
which case m_edges is never null (but Edge::to could be null).
Other instructions must have m_edges == null.  Because of this, it
was necessary to factor the compare instructions into the ones that
throw, with MayRaiseError set plus a catch edge, and ones that don't,
with no edges.

Reviewed By: @jdelong

Differential Revision: D1109820
Fix redis' zRange and zRevRange

The commands zRange and zRevRange on redis weren't working. Since its
arguments are being passed to the command as an array, we must call
`processArrayCommand()` instead of `processCommand()`.

Reviewed By: @ptarjan

Differential Revision: D1111425
actually send the response code

Closes #1416

Reviewed By: @sgolemon

Differential Revision: D1111910
Fix bugs in serialization of HHVM parse trees as PHP Code Model.

Remove left parentheses that survived edits and evolution. Fix the serialization of a simple function call to use the original function name. Make printExpressionVector treat a null list as an empty list. Use the original (scanned) string value when serializing scalar values. Make StaticClassName::outputCodeModel produce properly serialized strings (i.e. with headers). Use printStatementVector instead of just serializing each element of the vector in sequence. Adjust property counts to take into account null values. Tweak serialization of if statements to better deal with empty true blocks.

Reviewed By: duv

Differential Revision: D1097296
Fix preg_match returning false instead of null

preg_match/preg_match_all should return NULL not FALSE when invalid flags are passed.

Closes #1442

Reviewed By: @alexmalyshev

Differential Revision: D1111983

Pulled By: @scannell
Fix INI file typo

Fix INI file typo

Closes #1450

Reviewed By: @alexmalyshev

Differential Revision: D1112190
Fix OOM while compiling mongo extension

gcc using all memory when compiling mongo/cursor.cpp

Closes #1414
Closes #1427

Reviewed By: @elgenie

Differential Revision: D1110301

Pulled By: @scannell