Remove incoherent comment in hhbc-translator

Summary: This comment originally (D773015) referred to a small shuffle
of the return value that we used to do in hhbc-translator to enable a
decref elision.  Now it's sitting in front of code that we always run
when inlining.

Reviewed By: @alexmalyshev

Differential Revision: D1360204
Remove dead Translator::kMaxInlineReturnDecRefs

Summary: This was changed to a runtim option.

Reviewed By: @bertmaher

Differential Revision: D1360189
Fix current()/key() to allow expressions that can't be taken by reference

Summary: Like extract(), the current() and key() functions take their first param by
reference but they allow expressions that can't be taken by reference (such
as an array literal). This diff extends an existing hack for extract() to
also cover current() and key().

Closes #1712

Reviewed By: @JoelMarcey

Differential Revision: D1361298
Fix refcounting bug in Pair::at()

Summary: Pair::at() was not incReffing the value it returned, causing HHVM to free
the value early causing crashes or other bad behavior. This diff fixes the
refcounting bug.

Reviewed By: @elgenie

Differential Revision: D1361339
Spacing nit in offsetUnset()

Summary: A groundbreaking space

Reviewed By: @fredemmott

Differential Revision: D1361520
Revert "libmysql cmake fixes for compilation errors in Gentoo and other distros"

Summary: This reverts commit c8659dec5ae2db8da95badd81583c641c7ac8168.

Reviewed By: @ptarjan

Differential Revision: D1362048
Make Vector use a packed array for its buffer

Summary: This diff changes Vector to use a PackedArray for its buffer instead of
using its own custom buffers.

This diff is based on top of D1337469.

Reviewed By: @elgenie

Differential Revision: D1335725
Fix printir for AFrozen

Summary: With TRACE=printir, code emitted into AFrozen was not getting
printed. Fix this. Also CodeCache::frozen() should always be
m_frozen.

Reviewed By: @swtaarrs

Differential Revision: D1361980
Use more ephemeral service requests

Summary: Use ephemeral service requests for BIND_JCC, BIND_SIDE_EXIT and BIND_ADDR.
BIND_CALL is a little more complex, and I'll do it in a separate diff.

Reviewed By: @jdelong

Differential Revision: D1362410
MySQLi port can now take an int-ish string

Summary: Fixes #2823
See f03f434
Closes #2824

Reviewed By: @fredemmott

Differential Revision: D1359972

Pulled By: @JoelMarcey
Make paramters for mysqli->begin_transaction() optional

Summary: Fixes #2838
Closes #2839

Reviewed By: @WizKid

Differential Revision: D1361612

Pulled By: @JoelMarcey
Do not process sleep / external thread events preemptively

Summary: There's not much point in processing I/O events preemptively. Their
process method just moves them from one queue to another queue, so let's
process them only when the queue of runnable resumables is empty.

Makes it easier to move the loop thru runnable resumables to JIT.

Reviewed By: @jdelong

Differential Revision: D1360684
Fix tc-print's handling of bytecode regions

Summary: tc-print has always treated a translation as a single, continuous
range of bytecode instructions. This was almost never true: we've been tracing
through forward Jmps since before tc-print was born. Inlining and PGO have just
made the problem worse. I hacked in rough inlining support a while ago but this
diff fixes it more.

The TC dump now has a list of bytecode blocks contained in the translation
rather than just a starting and stopping offset. Blocks contain a unit md5 (may
differ due to inlining) and a range of bytecode offsets. This is used to print
the correct bytecodes at the beginning of the translation's disassembly. I also
changed the bytecode that we print inline with the assembly to only print
bytecodes that have code directly assigned to them. The previous logic of
attempting to fill in the gaps didn't work when we had more than one block in a
translation, and as a result it often printed some bytecodes that weren't
actually in the translation.

Two more small improvements: guards are now printed in tc-print, and we
shouldn't falsely attribute time spent in the guards to the first bytecode
instruction of the translation anymore.

Reviewed By: @ottoni

Differential Revision: D1362151
Improve type-arith for bitwise operators.

Summary: When it doesn't get two constants it just returns TInitCell. We can do
better than that. php.net says that &, ^, and | will always return an
int, unless both operands are strings, then they will return a string.

Reviewed By: jdelong, eletuchy

Differential Revision: D1360657
Add a really fast API to fetch a custom bool setting from config

Summary: Add a builtin API to return a custom bool setting from
config.hdf. Since this value is constant during the lifetime of the hhvm
process, we can replace the call with the actual value at JIT time.
Note that I'm planning on adding server_get_custom_int_setting and
server_get_custom_string_setting in a follow up diff.

Reviewed By: @jdelong

Differential Revision: D1358762
Assert that VMFP is forced into rbp

Summary: Trying to catch a potential register allocation bug in action

Reviewed By: @jdelong

Differential Revision: D1359461
MysqlResults that have been mysql_free_result()'d should not be valid

Summary: In particular now

```php
mysql_free_result($result);
assert(is_resource($result) === false);
```
This is tested for in a still-failing-for-other-reasons Zend test.
Closes #1946

Reviewed By: @ptarjan

Differential Revision: D1317868

Pulled By: @fredemmott
Merge adjacent T_INLINE_HTML tokens in `token_get_all`

Summary: The scanner splits inline html into 400 character chunks, presumably to prevent it from looking ahead too far. Since some PHP code relies on these inline html tokens being a single token, merge them together in `token_get_all`.

Fixes #2807 and hopefully fixes #2841
Closes #2847

Reviewed By: @fredemmott

Differential Revision: D1363605

Pulled By: @JoelMarcey
improve performance in simplexml

Summary: When casting a SimpleXML element to boolean, we're only concerned with
the object having an XML node, *or* having attributes. Building
attributes is done by sxe_get_prop_hash that also recursively builds the
entire element tree starting from that element.

We shortcircuit when the object has a valid XML node to prevent excessive
amount of object creation when all your program is doing is loading
XML strings and doing read/toBool operations.

Before: http://i.imgur.com/TFFj97u.gif
After:  http://i.imgur.com/3kNpwIM.gif
Closes #2855

Reviewed By: @scannell

Differential Revision: D1364022

Pulled By: @JoelMarcey
add missing include in gperftools build

Summary: When building with -DUSE_GOOGLE_CPU_PROFILER=1, we end up calling into
FileUtil::mkdir, but file-util.h was never included.
Closes #2853

Reviewed By: @fredemmott

Differential Revision: D1364000

Pulled By: @JoelMarcey