De-hhvmify hhmeasure

Summary: It'd be nice to be able to use hhmeasure as a tool to comparatively
microbenchmark hhvm and other php implementations, so let's get rid of
the hhvm-specific language extensions.

I considered inlining the implementation of idx() at the callsites,
instead of defining my own. I went with this because I have a hunch that
a lot of real codebases probably define their own idx-like thing, so
this is somewhat realistic. Any thoughts?

Reviewed By: @edwinsmith

Differential Revision: D1614251
Fix a tracing bug in hhbbc

Summary: Segfaulted if you have an unnamed local in a member instruction.

Reviewed By: @edwinsmith

Differential Revision: D1605906
Add a utility to hhbbc to increase trace level for specific functions

Summary: I've done this manually many times, so let's make it a feature.

Reviewed By: @markw65

Differential Revision: D1606347
Don't propagate states past noreturn functions or Awaits that throw

Summary: Outside of FPI regions this is pretty easy to do.  Inside of them, the
restrictions on bytecode for FPI regions make this easiest to do by not
eliminating the unreachable code---this means running the abstract interpreter
on it, but we don't want any types it infers to leak into successor blocks.
Handle this by adding a new 'unreachable' flag for states and setting up the
state merge rules to handle it appropriately.  When the optimizer sees
unreachable code, it tries to remove it only if it isn't in an FPI region.

Also, change the cases where this happens to push TBottom, and fix a few bugs
where subtypeOf was being used when we really meant something else.
(TBottom.strictSubtypeOf(TObj) is true, but that doesn't mean it has specific
information about an object.)  There are other cases where we'll do things like
push TTrue if a TBottom is being tested for is_int---these are all harmless
because the code is unreachable if you have a TBottom involved.

Reviewed By: @jano

Differential Revision: D1596487
Fix a bug in how __Memoize sets up FPI regions

Summary: In this case you could have the fpushOff pointing to a non-FPush.

Reviewed By: @jano

Differential Revision: D1614957
Remove MemoryManager::refreshStatsHelper

Summary: It's just a wrapper.  I think the original purpose was to prevent
inlining of refreshStatsImpl, but that's moved to .cpp now anyways, so getting
rid of it should just make this code (marginally) easier to follow.

Reviewed By: @jdelong

Differential Revision: D1612500
Add a few more very simple APC unit tests

Reviewed By: @edwinsmith

Differential Revision: D1594377
Remove APCTypedValue optimization in APCLocalArray

Summary: This doesn't buy anything anymore and it's one less variable for
differences with the new system.  (On its own merit it also would mean we don't
need to have APCTypedValue have the same layout as TypedValue.)

Reviewed By: @bertmaher

Differential Revision: D1606396
Don't throw ints when throwAllErrors is enabled

Summary: Throwing ints is not cool.  But enterVM also just catches them and
turns them into Exception anyway, so anything that was relying on it being an
int would be broken.

Reviewed By: @markw65

Differential Revision: D1611790
Update third party SHA to support 12:0 folly update
Don't re-create singletons

Summary: This forbids singleton creation/re-creation after destroyInstances() was called.
Only after reset() is called singletons can be created again.

registrationComplete() behavior is also slightly change. We disallow singleton registration after registrationComplete() is called even in Relaxed mode. Strict mode now only controlls whether singletons can be constructed before registation is complete.

Reviewed By: @chipturner

Differential Revision: D1605136
Fix a crash in nested file functions

Summary: UrlFile functions correctly chased through multiple actrecs
to find the callsite. ExecutionContext::setVar only went one deep.

The result was that the example crashed because it tried to set a
variable in a frame that didn't have a VarEnv.

Reviewed By: @swtaarrs

Differential Revision: D1614350
Remove the implicit label hack in vasm-xls

Summary: The numbering scheme for positions requires that the first
instruction in a block not have uses, so that we don't end
up with empty lifetime ranges. In XLS, this was acheived by
inserting a DefLabel if the block didn't have one and it
started with an instruction with 1+ uses. In vasm-xls, I
hacked this by leaving an empty position there and
compenstating for it everywhere. But wrongly, because
phidef should be exactly at the block start.

This diff inserts nop instructions similar to the way XLS
originally inserted DefLabel, if a block started with an
instruction with uses. Inserting in vasm requires memcpy,
but blocks tend to be very small on average. I'll measure
JIT speed just in case.

Reviewed By: @swtaarrs

Differential Revision: D1582946
parse require, include, require_once and include_once

Summary: This diff adds require/include/require_once and include_once.
since these constructs are expressions, we allow this but while naming
we treat this as ANY.
In strict mode we only allow these constructs at the top level as statements.

Depends on D1610236

Reviewed By: @int3

Differential Revision: D1613311
typechecker: consolidate reflection hhi's

Summary: Having all the classes for ext_reflection in a single
 file is more representative of the conceptual granularity. It also
 avoids having three-line ##// decl## files

 There are no semantic changes in this code other than file moves.

Reviewed By: @int3

Differential Revision: D1616978
Only call exsltRegisterAll() once

Summary: The extension list in libxslt looks global, and mutex-guarded. There's no reason to call this once per thread.

~ 64% performance boost for hello world

Reviewed By: @oyamauchi

Differential Revision: D1608475
==WIP== Create ArrayTracer to trace array usage in the runtime

Summary: ArrayTracer aims to track the creation and use of arrays throughout the HHVM
runtime. For ease of use it's enabled as a runtime flag -vEval.TraceArrays=true
which defaults to off.

It works by wrapping the functions in the ArrayFunctions g_array_funcs table
with a function that records the ArrayData pointers it sees, classifying them
as either static or request local, and then storing them in their respective
maps from ArrayData* to ArrayUsage. ArrayUsage just records what has happened
to a specific ArrayData, which gets fed information by the intercepted calls
to g_array_funcs. For example, a call to g_array_funcs.setStr will set the
string key flag on the ArrayUsage.

Reviewed By: @edwinsmith

Differential Revision: D1539544
Drop the -m suffix from the store immediate instructions.

Summary: It's implied by it being a store.
Also fixed some indentation in code-gen-x64.cpp,
and unbroke vasm-xls pretty-print.

Reviewed By: @swtaarrs

Differential Revision: D1616232