Remove assert in FrameState merging

Assert won't hold with user-level control flow.

Reviewed By: @ottoni

Differential Revision: D1163705
Exclude x17 from register allocator since MacroAssembler could use it.

Spotted by inspection.

Reviewed By: @oyamauchi

Differential Revision: D1166234
Add final remaining minstr base cases; make the Base non-Optional

Added BaseLoc tags for "the base lives in $GLOBALS" and
"we've fataled".  Finished some cases in miBase so it never returns
folly::none anymore.

Reviewed By: aravind

Differential Revision: D1146291
Track local base types more precisely; use Obj=stdClass for must-promote cases

Reviewed By: @elgenie

Differential Revision: D1152159
Add a type for "primitive" things (things where the TypedValue isn't a pointer)

Reviewed By: @dariorussi

Differential Revision: D1154321
Use a NameA opcode for implementing ::class

There are no class constants named "class", so either ClsCns
needed a documentation update or it was not behaving as specified.
This should also "fix" the self::class in a pseudo-main to fail the
way parent::class does, matching zend.  static::class still works in
this case, although it doesn't in zend.

Reviewed By: @ptarjan

Differential Revision: D1154554
Add a dot-format printer to hhbbc output

Reviewed By: @edwinsmith

Differential Revision: D1154712
Remove some dead stuff in Index::resolve_class

There was an idea that we'd use the context to be able to
resolve hoistable classes from the same unit, and things like that.
We might do this at some point but the prototypey code about this is
just noise right now so remove it.

Reviewed By: @dariorussi

Differential Revision: D1154734
Add some not-yet-implemented reduce cases in FPI parameter preparation

There are at least some examples where we can determine
parameter reffiness and hphpc can't coming in a later diff, so make
these a little more complete so we'll actually optimize based on it.

Reviewed By: @dariorussi

Differential Revision: D1154999
Don't count assert opcodes against inlining costs

Mark suggested maybe they should even subtract the cost, but
we can try that later if this looks helpful.

Reviewed By: @swtaarrs

Differential Revision: D1156317
Add some place to dump index information in hhbbc_dump

Reviewed By: @elgenie

Differential Revision: D1156925
Support to infer return types and parameter reffiness for overridden methods

Adds a res::Func mode that represents a "FuncFamily", which
is just a set of possible functions it could call.  Return types and
parameter reffiness in this mode turns into loops over the possible
functions.

This code is disabled because it causes a perf regression.

To compute the possible functions in a family, when the index is
initially built, this adds a pass to instantiate all possible
combinations of the classes so we can see all possible subclasses.
This could have other uses later, too.  (This costs about 6 seconds
for create_index on www in dbg so I think it's ok not to parallelize
or whatnot for now.)

Reviewed By: @dariorussi

Differential Revision: D1157919
Only rename builtins that aren't C++ builtins to __builtin_name

It looks like the only case in systemlib that does this
fallback stuff is array_map.  (I believe array_filter used to.)  Since
this function was detecting that situation by trying to look up loaded
functions, it would rename every function if you call it a second time
to create the UnitEmitter again (which I need for HHBBC).  This way
fixes that, but leaves the dependency on the hhas system being loaded
before the native func one.

Reviewed By: @markw65

Differential Revision: D1155030
Fix lookup_param_prep for builtins with AttrVariadicByRef

PHP has some builtins that take non-declared arguments by
reference (which normally you can't do).  HHBBC wasn't handling them
properly, but it doesn't matter until D1155030 fixes its ability to
resolve non-HNI builtin functions.

Reviewed By: @elgenie

Differential Revision: D1155033
Remove throw_oom_only, fix an exception bug in SetN

We don't need to track when things can throw because of OOM,
because it is delayed until the next surprise flag check.  (I was
confused about this earlier and started doing throw_oom_only, but it
would require auditing everything to get it right.)  There was also an
overly optimistic nothrow() in SetN.

Reviewed By: @bertmaher

Differential Revision: D1155041
An initial place for gathering / printing stats in hhbbc

For now it only computes opcode counts.  (Which I want to use
to see how effective AssertT-filtering is.)

Reviewed By: @dariorussi

Differential Revision: D1158625
Fix RemoveDeadBlocks

When HHBBC detects a block is unreachable, it has two
options: either replace it with a Fatal, or make the jumps
unconditional.  The latter mode was off because I had issues with it
in perflab in the past, which looks like it was because it unbalances
the stack.

Reviewed By: @edwinsmith

Differential Revision: D1160731
Improve FilterAssertions in hhbbc

Instead of asserting the type of every local when an
instruction could read locals, track which locals it could read and
only assert their types.  Also, add a list of instructions with
"obvious output types", and don't assert their stack outputs.  This
cuts 36 million assert opcodes (63%) out of the repo hhbbc generates.

Reviewed By: @elgenie

Differential Revision: D1160480
Fix a bug where we set AttrUnique on non-unique classes

Hphpc was ignoring interfaces here, which means we could
decide a Class* is unique when it actually isn't, which could cause
problems.

Reviewed By: @jasone

Differential Revision: D1163158
Fix a unit test that relies on warnings a little harder

D783472 tried to keep this the same in repo and non-repo
mode, but after adding a TPrim type hhbbc is able to optimize some of
these IsType's away.

Reviewed By: @elgenie

Differential Revision: D1163177