Reuse service request stubs
Don't lock when touching already-defined constants.

Some vtune output showed that we were piling up on targetCache's
lock when running wordpress. Since this failure mode could plausibly occur
during warmup of the translator, and if we were falling back to the
interpreter for defines, avoid the lock when doing successful named
lookups.
Skip the tv_release_X middlemen for destruction.

This was showing up in production icache load miss profiles.
We only had tv_release_X because we were too lazy to implement C++
linkage, so get one extra cache line out of our working set by skipping
them.
Speed up InstanceOfD's translation

- Don't use UnlikelyIfBlock since the thing it was checking is
  actually pretty likely.
- Call different slow path helpers based on whether or not the
  candidate class is probably an interface.
- If the candidate class is unique and not an interface/trait, use
  Class::m_classVec in an inlined fast path.
- Fuse all the branches when applicable.
Get rid of alignment gaps between test and jcc

Put some more test and jcc instructions next to each other.

I discovered this oddness with emitCondJmp: it emits a jcc immediately followed
by a jmp, and it forces them to both be on the same cacheline. This could result
in more alignment gap than we need, maybe. Is this necessary for correctness, or
is it OK if the jcc and jmp have a cacheline boundary between them? We already
overwrite them separately and non-atomically anyway.
Move thread prefixed logging inside mutex

This is probably what it was supposed to be.
Add nv* virtual methods to ArrayData.

Adding implementations of the nv* virtual methods to ArrayData
lets us remove the IsHphpArray branches along the hot path in
various helpers.  They're implemented genericly in ArrayData.

Of the various ArrayData subclasses, only SharedMap and
NameValueTableWrapper are accessed frequently enough to deserve
specialized implementations (especially SharedMap).

This diff also factors out the calls to raise_notice() into
helpers in ArrayData that the various subclasses can all share.

IsHphpArray() is now only used in a few ASSERTs, so I reimplemented
it in terms of dynamic_cast.  I think we can rip it out in a future
diff, although the JIT still needs a fast is-hphp-array check to
guard inlined nvGet operations.
Clean up emitInterceptPrologue

This new version uses two fewer bytes and should be more
branch predictor friendly. I don't expect it to affect production
performance but I started an experiment to approximate its effect when
intercepts are turned on.
Debugging helpers, type assertions, a little cleanup

- Add some more functions to print information about the current state
  of things
- Add some more assertions about types
- Move the translation for VGetG back to translator-x64.cpp (it's not
  a vector instruction)
Use InstanceOfD's inline fast path in VerifyParamType

VerifyParamTypeSlow was one of the most frequently called
helpers. Its fast path is mostly the same as InstanceOfD's fast path,
so let's use that code here as well.
Ugly fix to the grammar to accept (string) when we want a (type)

This case can happen when a function takes a function as input:

function f1((function (string): int) $f): int {
  return $f("hello");
}

I talked to pad about "fixing" the lexer and having grammar rules for the casts. At the
end, it's going to be more work and just as ugly since we have methods called
"string" or "int".

A possible solution to these ambiguities would be to force constants to be capitalized, variable names
to start with a lower case letter, etc. I don't think such rules would play well with our goals to
be php-compatible.
Don't treat tvScratch as a Variant in member_operations.h

tvScratch often contains garbage, so it's not supposed to be
decreffed or treated as a Variant. IssetEmptyElem was using
tvAsVariant on it, causing a bunch of crashes.
Compute live and dirty ranges for program locations.

Tx64 has always been a purely greedy register allocator, hoarding
as much program state as it can in registers. This makes our occasional
trips off the main trace more expensive; they must save all dirty state,
and restore all live state.

So, let's finally cave and implement live and dirty range tracking. At
instruction boundaries, shoot down any dead registers.
Fix sp when FCallArray target is intercepted

If the target of an FCallArray was intercepted, and the
intercept handler decided to skip the original function,
we didnt update $rbx, leaving an actrec and the parameter
array on the stack.

The whole system was surprisingly robust against this. If an
exception was thrown, and the register state was dirty (the
usual case) we would recover. But if, eg, we re-entered and
threw an exception we would double free the array, and attempt
to free the ActRec as if it were Cells.
Add lz4compress to hphp

LZ4 seems to have better compression & decompression speed than qlz/etc
- http://code.google.com/p/lz4/.
Inline wouldCall into the only site that uses it.

wouldCall turned up on radar for icache misses. Since it's only
called from one, hot site, its body might as well be inlined there.
Trace past jmps.

A fair number of jmps from try blocks, if's, ?:'s, etc.
artificially break tracelets. We might as well keep tracing through them.
Some fixes for running under Pin.
Clean up outLocal handling in vector translator
Emit better mid-tracelet guards when possible

Mid-tracelet variant guards account for some nontrivial
amount of our branches to astubs. If we need to take a side exit
because of one of these and there are no dirty registers, we can emit
a very compact inline side exit. And if the current instruction
doesn't have a stack offset we can just emit a single jnz straight to
the destination.