Reduce memory pressure on the JS stack during garbage collection

As the example in QTBUG-42051 demonstrates, QML may produce a lot of binding
objects and each of them produce a QV4::Persistent. During the mark phase we
may run out of JS stack space. One fix (for the future) is to reduce the number
of QV4::Persistent objects, but in the meantime we can also reduce the pressure
on the stack by draining it earlier.

Task-number: QTBUG-42051
Change-Id: Iea73f8a869048ea0bf3f4a64dbd24b6fb8c68f6b
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>

Conflicts:
	src/qml/jsruntime/qv4mm.cpp

MER: We didn't cherry-pick b11ec085703a0b019c8115ff505ee6e2553fd4f1 and related
bits, because it looks a little more invasive than we want to run with given
current limitations, so internalClass is a pointer, not a method.