Bug 1023035 - Improve checking for whether we are on the main thread when triggering malloc GCs, r=billm.