Move PartitionAlloc to js/src/ for testing on the JS engine.

Also remove a few unused headers, and tweak some compat macros.
Use PartitionAlloc for all SpiderMonkey allocations.
Replace use of ScopedFreePtr with UniquePtr in SpiderMonkey.

ScopedFreePtr is deprecated and uses |free| directly, as opposed to
UniquePtr, which can be made to use js_free.
Use js_calloc for allocating ArrayBufferContents objects.
Copy sandbox option strings instead of adopting them.

Strings coming from JS objects are allocated on a separate heap,
but nsCString is unaware of that, and tries to free its underlying
buffer using a regular free(); because of that, we need to copy the
string into a separate buffer allocated from the correct heap.
Use js_realloc in nsXMLHttpRequest::ArrayBufferBuilder.
Handle 0 in countLeadingZerosSizet.

The JS engine will sometimes do allocations of 0 bytes on startup
(see ~JSStructuredCloneWriter > extractBuffer when the buffer is empty),
and it expects the allocator to return a valid pointer in that case.

PartitionAlloc, on the other hand, doesn't handle 0-byte allocations
specially, thus 0 gets eventually passed to countLeadingZerosSizet. On
our implementation, countLeadingZerosSizet just delegates to
countLeadingZeroes{32,64}, which wasn't ready to handle 0, presumably
causing undefined behavior. This makes countLeadingZerosSizet return
sizeof(size_t) * CHAR_BIT when 0 is passed.
Use js_free in ThreadSharedFloatArrayBufferList.

This may be wrong, as the underlying buffer seems to be entirely internal
and not exposed to content (in fact, it is immutable). Perhaps the proper
solution to this would be to copy the buffer in

StealJSArrayDataIntoThreadSharedFloatArrayBufferList

in AudioBuffer.cpp
Expand compat macros inline so we don't conflict with other macros.