Move loadClassCtor to translator-runtime where it belongs

Reviewed By: @jdelong

Differential Revision: D1360740
Check in exchangeArray() as in ctor whether to store an array

Summary: __construct() checks if it's an instance of ArrayObject or ArrayIterator and then saves an array copy
exchangeArray() is supposed to follow the same behaviour

Resolves #2791

The segfault however might still be there somewhere.
Closes #2814

Reviewed By: @ptarjan

Differential Revision: D1359493

Pulled By: @JoelMarcey
Fix tracelet selector jump traversing

Summary: - The logic to only trace through a backwards JmpNS was just wrong: I
wrote the conditions incorrectly and they disagreed with the comment and my
intent.
- I originally set it up to always trace through conditional jumps with a const
source, but this differs from analyze() and isn't strictly better. I changed it
to only do so while inlining.

Reviewed By: @jdelong

Differential Revision: D1360207
Add option to explicitly turn on tracing

Summary: Sometimes it is useful to be able to use tracing without using a debug build. Clearly somebody already thought of this, since there is a `USE_TRACE` define already floating around. This adds an option to CMake so you can pass `-DENABLE_TRACE=1` to `cmake` and get tracing.

Good for initially debugging things without having to do a full debug build.
Closes #2836

Reviewed By: @fredemmott

Differential Revision: D1361091

Pulled By: @JoelMarcey
DOMNode::lookupNamespaceUri should return default namespace when null is passed

Summary: `null` was casted to a `string` because of a wrong IDL config. This diff allows `null` to be passed and returns the correct result including type checking.

Reviewed By: @ptarjan

Differential Revision: D1357983
Fix TransBCMapping

Summary: We weren't updating it after relocation. D1356644
attempted to fix it by using mcg->code.*, but that doesn't
work either, since those code blocks aren't being updated
at all.

Reviewed By: @ottoni

Differential Revision: D1359096
FNon-class properties of ArrayObject are now actually serialized.

Summary: Fixed a bug with the serialization of ArrayObjects so they are now actually serialized and unserialized with the rest of the object.

Reviewed By: @ptarjan

Differential Revision: D1359953
Require gcc 4.8 for the open source build

Summary: We wanted to kill 4.7 with fire anyway, but now we actually have to or we will break the build.

For example, D1356667 will actually not compile with 4.7 since functions like `is_trivially_destructible` are not available in the `type_traits.h` header there.

Reviewed By: @scannell

Differential Revision: D1361595
Don't rename closures many times

Summary: If two threads are emitting the same closure, they both will rename it and only the second name will be used when defining the closures so the first name won't even exist. Instead, lets just not save the name and name it locally.

Reviewed By: @markw65

Differential Revision: D1361287
Merge tearDownAsyncFrame() into tearDownFrame()

Summary: After recent removal of multiple hacks related to function exit, the
implementation of tearDownFrame() is almost the same as
tearDownAsyncFrame(). Let's merge them together.

Reviewed By: @jdelong

Differential Revision: D1360328
Move async function error handling to the unwinder

Summary: Mark AsyncFunctionWaitHandle as finished from the unwinder and simplify
resume() further.

Reviewed By: @jdelong

Differential Revision: D1360492
Fix the OSX build

Summary: Variable-sized INI/HDF settings don't work well cross-platform.
Since these are all easily convertible to fixed size types, do so.

Reviewed By: @ptarjan

Differential Revision: D1361576
Move refcounting from AsioContext to AsyncFunctionWaitHandle

Summary: Move responsibility for AsyncFunctionWaitHandle to stay alive while
scheduled in AsioContext from AsioContext to AsyncFunctionWaitHandle.

Reviewed By: @jdelong

Differential Revision: D1361026
Move refcounting from BlockableWaitHandle to concrete WaitHandles

Summary: Move responsibility to stay alive while being blocked from BlockableWaitHandle to the actual subclass of BlockableWaitHandle.

Reviewed By: @jdelong

Differential Revision: D1358802
Move responsibility to DecRef on async function exit to the Ret/Await opcodes

Summary: Currently, the responsibility to drop DecRef once execution of async
function is finished is on the scheduler. Let's move it to the opcodes
and eliminate unnecessary IncRef/DecRef pair on blocking await.

Reviewed By: @jdelong

Differential Revision: D1355734
Fix stackSlackUsedForInlining logic

Summary: Brett noticed that it was only correct for one level of
inlining, because we never accumulated the value.

Reviewed By: @swtaarrs

Differential Revision: D1359408
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