Bug 1028358; followup fix on a CLOSED TREE; r=sfink

--HG--
extra : rebase_source : c38ad9347fd6100e9275e08823763bccbce54c10
This commit is contained in:
Terrence Cole 2014-06-23 14:36:26 -07:00
parent 25b2238b9f
commit 56f73e4f46

View File

@ -29,20 +29,23 @@ BEGIN_TEST(testGCHeapPostBarriers)
template <typename T>
bool
TestHeapPostBarriers(T initalObj)
TestHeapPostBarriers(T initialObj)
{
CHECK(initalObj != nullptr);
CHECK(js::gc::IsInsideNursery(initalObj));
CHECK(initialObj != nullptr);
CHECK(js::gc::IsInsideNursery(initialObj));
/* Construct Heap<> wrapper. */
JS::Heap<T> *heapData = new JS::Heap<T>();
CHECK(heapData);
CHECK(heapData->get() == nullptr);
heapData->set(initalObj);
heapData->set(initialObj);
/* Store the pointer as an integer so that the hazard analysis will miss it. */
uintptr_t initialObjAsInt = uintptr_t(initialObj);
/* Perform minor GC and check heap wrapper is udated with new pointer. */
js::MinorGC(cx, JS::gcreason::API);
CHECK(heapData->get() != initalObj);
CHECK(uintptr_t(heapData->get()) != initialObjAsInt);
CHECK(!js::gc::IsInsideNursery(heapData->get()));
/* Check object is definitely still alive. */