Merge changes from jorendorff
authorbenjamin@smedbergs.us
Wed, 12 Dec 2007 11:54:22 -0500
changeset 22 0ca31a2285356f7802d7a2ecda77ba7591f833cc
parent 20 458babdaa518471a7a2e4b09f514955c86b7c60f (current diff)
parent 21 ed155007d2cd37876539f30bb6e2d35b34f80b94 (diff)
child 26 9b49c7cbe92c06169695cd824b1582d4ceb86591
push id1
push userbsmedberg@mozilla.com
push dateMon, 21 Apr 2008 01:54:18 +0000
Merge changes from jorendorff
--- a/mmgc-threadsafe-gctests
+++ b/mmgc-threadsafe-gctests
@@ -12,16 +12,30 @@ diff --git a/MMgc/GCTests.cpp b/MMgc/GCT
 +#else
 +		gc->Collect();
 +#endif
 +	}
 +
  	GCWeakRef* createWeakRef(int extra = 0)
  	{
  		// Bogusly use up some extra stack.
+@@ -65,11 +74,11 @@ namespace MMgc
+ 		// pointer there causes the temporary to be marked, and not collected,
+ 		// which causes tests to fail with assertions.
+ 		///
+-		// The extra 32 bytes here causes the temporary to end up higher on
++		// The extra 64 bytes here causes the temporary to end up higher on
+ 		// the stack (numerically lesser address, on Intel at least) where
+ 		// CleanStack will clobber it.
+ 		//
+-		char buf[32];
++		char buf[64];
+ 		sprintf(buf, "%d", extra);  // don't optimize away buf
+ 
+ 		return (new (gc, extra) GCObject())->GetWeakRef();
 @@ -78,9 +87,9 @@ namespace MMgc
  	void weakRefSweepSmall()
  	{
  		GCWeakRef *ref = createWeakRef();
 -		gc->Collect();
 +		collect();
  		gc->CleanStack(true);
 -		gc->Collect();
@@ -36,22 +50,26 @@ diff --git a/MMgc/GCTests.cpp b/MMgc/GCT
 -		gc->Collect();
 +		collect();
  		gc->CleanStack(true);
 -		gc->Collect();
 +		collect();
  		(void)ref;
  		GCAssert(ref->get() == NULL);
  	}
-@@ -166,11 +175,13 @@ namespace MMgc
+@@ -166,11 +175,17 @@ namespace MMgc
  	void RunGCTests(GC *g)
  	{
  		gc = g;
-+		gc->OnEnterRequest();
++#ifdef MMGC_THREADSAFE
++		g->OnEnterRequest();
++#endif
  		weakRefSweepSmall();
  		weakRefSweepLarge();
  		weakRefFreeSmall();
  		weakRefFreeLarge();
  		drcApolloTest();
-+		gc->OnLeaveRequest();
++#ifdef MMGC_THREADSAFE
++		g->OnLeaveRequest();
++#endif
  	}
  }