Better management of g_context

Summary: Avoid destroying g_context twice per request.
Leave it null between requests.
Verify that there are no smart slabs allocated when a thread is flushed

Reviewed By: @jdelong

Differential Revision: D1559352
Replace calls to is_a with instanceof at IR gen time

Summary: These are equivalent in behavior; the PHP docs for is_a actually say you
should use instanceof instead.

Reviewed By: @edwinsmith

Differential Revision: D1556806
convert mbstring to hni

Summary: fixes #3675

Reviewed By: @ptarjan

Differential Revision: D1543361