Replace IRTranslator::translate* with macros for nullary opcodes

Summary: This is totally straightforward: macro-generate calls to
HhbcTranslator::translateBlah() that don't have arguments.

Reviewed By: @edwinsmith

Differential Revision: D1285296
Remove legacy webserver from non-X64 Linux

Summary: The legacy webserver hasn't been working on platforms that
aren't X64 Linux. Since it requires custom libevent, remove the
unneeded dependency on that where it's not going to work.

Reviewed By: @fredemmott

Differential Revision: D1286634
Make hack javascript work with js_of_ocaml 2.0

Summary: Looks like js_of_ocaml 2.0 changed two things:
-Added some sort of scoping where we were exporting functions
-Made new MlString break.

Changes:
-Add self. where it was needed to make the stuff we were exporting global. self works in a window or a webworker. Tested that.
-instead of using new MlString, I exported the function that converts js strings to MlStrings and used it where we used to.

ihavenoideawhatimdoing
but it works ok now

Reviewed By: @jwatzman

Differential Revision: D1274773
Add NativeDataInfo Sweep mechanism

Summary: DestructFunc will be called when an
object goes out of scope during a request and
is responsible for all cleanup.

SweepFunc will be called at the end of a
request during sweep.  Sweep functions should
not try to clean up any smart allocated resources
since they may have been already swept.

In practice for NDI Classes this translates into
a `void sweep()` magic method.

If your NDI class DOES NOT have sweep() on it,
then the destructor will be called for either case.
This is fine if you do not have any sweepable resources.

If your NDI class DOES have a dispose() method,
it will be called during sweep, while the destructor
will be called for in-request cleanup.

The normal pattern for this looks like:

  class MyNativeData {
   public:
    MyNativeData() { /* new MyNativeData() */ }
    MyNativeData& operator=(const MyNativeData& other) { /* clone $mnd */ }
    ~MyNativeData() {
      /* unset($mnd); */
      // Clean up sweepable resources (if needed, generally not)

      // Chain through to clean up non-sweepables
      sweep();
    }

    void sweep() {
      /* sweeping */
      // Clean up non-sweepable resources
      fclose(m_fp);
    }
  private:
    // Gets cleaned up with ~MyNativeData() in-request, but is ignored for sweep
    String m_path;

    // Must be manually cleaned up, even during sweep
    FILE *m_fp;
  };

Reviewed By: @edwinsmith

Differential Revision: D1270365
Change AssertType and AssertStk to refine their source type through typeParam

Summary: This diff changes the semantics these instructions to match their
corresponding Check versions.

Reviewed By: @edwinsmith

Differential Revision: D1197194
Disregard presence of init methods for LdClsPropAddrKnown

Summary: I don't think this check is actually necessary; we need to initialize
static props per-request regardless of whether it has any non-scalar
init methods.  My guess is that we only had this check because we had
nothing like `findSProp()` which gave us accessibility and visibility
without actually initializing some static properties.

This, along with deleting the early-success pass in ldClsPropAddr()
where we checked only the class name, was causing us to take the slow
path in many places for static properties on self (and probably in
general).

Now we have an extra bit in Class to fill with all sorts of fun things
(or at least one fun thing).

Reviewed By: @jdelong

Differential Revision: D1286416
Close a memory leak when uploading a file

Summary: When uploading a file, the server uses `strdup` to allocate a string for the temporary file name that is being uploaded conditionally.
However, that string is not always being cleaned up in the loop. This diff frees the string to avoid the memory leak.

Reviewed By: @scannell

Differential Revision: D1285325
Add hash_equals() from PHP 5.6

Summary: Function for comparing strings in constant time to
avoid attacks based on short-circuit comparison.

Reviewed By: @ptarjan

Differential Revision: D1155443