Fix highlight_string function for proper highlighting - #3160

Summary: This should resolve #3160.
Closes https://github.com/facebook/hhvm/pull/3959

Reviewed By: @fredemmott

Differential Revision: D1624101
Port fixes for EXIF bugs from PHP

Summary: Official fixes PHP bugs 60150 and 65873, plus extra line breaks. This is
just to be prudent, I haven't found an actual security vulnerability in
HHVM. In the case of 65873, reproduction depends on allocator details,
and HHVM's allocator is probably not vulnerable at present.

Submitted on behalf of a third-party: The PHP Group
Source: http://svn.php.net/viewvc/?view=revision&revision=319534
Source: https://github.com/php/php-src/commit/cbcf6e1880e35ed7cd052e127b037eee7cef61c9
License: version 3.01 of the PHP license

Closes: #1154
Closes https://github.com/facebook/hhvm/pull/4020

Reviewed By: @fredemmott

Differential Revision: D1627130

Pulled By: @paulbiss
Add Histogram of NoInfo sizes to ArrayTracer

Reviewed By: @edwinsmith

Differential Revision: D1636990
Add remaining CALL_OPCODEs for ARM

Summary: In theory, anything that's a CALL_OPCODE on x64 should be the same on
ARM and it should work without problems. I just copied the whole
CALL_OPCODE section from code-gen-x64.cpp and it seems to have worked.
(That resulted in a lot of reordering, so the best way to see what's
changed is to concentrate on the removed PUNT_OPCODEs.)

Reviewed By: @edwinsmith

Differential Revision: D1637822
Fix memory leak in WSDL parser

Summary: The document tree for the WSDL and referenced XSD-s was not deleted
after parsing.
Closes https://github.com/facebook/hhvm/pull/4045

Reviewed By: @fredemmott

Differential Revision: D1635060
Special-case idx

Summary: `idx` is pretty easy to type, depending on the number of
arguments. Let's do it.

Reviewed By: @elgenie

Differential Revision: D1606308
Fix some emitPropSpecialized code relating to intermediate property accesses

Summary: It turns out that this code doesn't seem to have been running anymore,
since we weren't getting any appropriate knownCls values through to
getPropertyOffset for intermediate prop operations on nullable object types.
Also, this tweaks needFirstRatchet to avoid some unnecessary control flow on
the first prop dim even if we don't know the type of the property (but know the
type of the base).

Reviewed By: @alexmalyshev

Differential Revision: D1625428
Non-member function organization for simplifier

Summary: Remove member-function-per-opcode design.

Advantages:

  - Adding a new simplify method doesn't involve changing simplifier.h, which
    means it doesn't change ir-builder.h, which means you don't wait 60seconds
    for hhbc-translator.o to build.

  - You can add private helpers without forward declaring them.

  - If simplifier ever gets too big, we can split it easily.  (The state struct
    and helper methods go to some -internal header, and then you can sprinkle
    the simplify routines into several .cpps.)

Disadvantages:

  - You have to say "env" all over the place.  (I got used to this pretty quick
    in hhbbc but it's definitely not an upside.)

I'd like to do this to hhbc-translator, but I thought I'd do simplifier first
because it was small enough to do quickly, and to make sure there's consensus.

Reviewed By: @edwinsmith

Differential Revision: D1632329
Rename simplifier.{h,cpp} to simplify.{h,cpp}

Summary: Assuming we do D1632329 a Simplifier isn't a nouny thing now, it's a
procedure.  So verb the filename.

Reviewed By: @mxw

Differential Revision: D1632525
Remove isRefCounted; fix a bug in simplifier xorBoolImpl

Summary: isRefCounted really means maybeCounted, which we have in Type.  And in
xorImpl we needed to check that the sources can't be doubles, not that they
aren't known to be doubles.  (As alexanderm pointed out in the task.)

Disable it for arrays and objects even though we don't have an example it
breaks, because the burden of proof should be on it being correct.

Reviewed By: @alexmalyshev

Differential Revision: D1633947
Clean up in hhbbc dce module

Summary: Been meaning to do this for a bit: convert the visitation away from
object-with-overload-per-bytecode design.

Reviewed By: @alexmalyshev

Differential Revision: D1633438
Disable xdebug_get_declared_vars in RepoAuthoritative mode

Summary: xdebug functions aren't apparently not generally useful in repo auth
mode, and we don't have this function hooked up to the disallowed dynamic funcs
mechanism.  Since get_defined_vars already exists let's just disable this one
in repo for now.

Reviewed By: @ptarjan

Differential Revision: D1638826
Enable -fglobal-dce and -fremove-unused-locals in hhbbc by default

Summary: For some reason I forgot that I meant to look at doing this when
turning off postOptimize.  The pass was off originally because I wanted to
think about it some more and was worried about the default implementation being
correct for bytecodes that aren't explicitly supported---it really just relies
on the mayReadLocalSet being correct from the normal abstract interpreter,
which I feel pretty confident about now.

This also turns on unused local variable removal, so we don't need to do
-fno-insert-assertions on test/quick/lotsa-locals.php (because hhbbc just
removes all the locals after constant propagating them into var_dump).  Found
and fixed a bug in this---it was willing to remove parameter locals.

Reviewed By: @jano

Differential Revision: D1633779
Support for SetOpL and IncDecL in hhbbc global dce

Reviewed By: @jano

Differential Revision: D1634176
Convert invariant() to return void in the emitter

Reviewed By: @elgenie, @jano

Differential Revision: D1634183
Remove ArraySet and MapSet case from storesCell

Summary: We believe it's bogus.

Reviewed By: @swtaarrs

Differential Revision: D1633881
LookupClsCns should return DCns

Summary: It doesn't matter in practice because the native call incref'd it, and
then the JIt just spills it on the stack before side exiting.  But we should
have the type system reflect what's going on.

Reviewed By: @swtaarrs

Differential Revision: D1633894
Automatically turn a few flags on for --region-mode=method

Summary: This is helpful.

Reviewed By: @mhahnenberg

Differential Revision: D1639787

Signature: t1:1639787:1414274827:8c7754ef6c8ced609e445141ea378c6212cfbe50
Don't include frame-state.h from opt.h

Summary: We can forward declare it.

Reviewed By: @alexmalyshev

Differential Revision: D1634315
Remove an unused hhbc-translator function

Summary: Dead code.

Reviewed By: @alexmalyshev

Differential Revision: D1636692