Bug 877473 - Expose tools to help fuzz generational GC; r=billm

--HG--
extra : rebase_source : 46dd430429e31ab380b61ef8b0019fc20a411961
This commit is contained in:
Terrence Cole 2013-05-30 10:55:15 -07:00
parent 429053fc39
commit 302cbbbed5
2 changed files with 23 additions and 4 deletions

View File

@ -224,6 +224,20 @@ GC(JSContext *cx, unsigned argc, jsval *vp)
return true;
}
static JSBool
MinorGC(JSContext *cx, unsigned argc, jsval *vp)
{
#ifdef JSGC_GENERATIONAL
CallArgs args = CallArgsFromVp(argc, vp);
if (args.get(0) == BooleanValue(true))
cx->runtime()->gcStoreBuffer.setOverflowed();
MinorGC(cx->runtime(), gcreason::API);
#endif
return true;
}
static const struct ParamPair {
const char *name;
JSGCParamKey param;
@ -993,6 +1007,11 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
" If 'compartment' is given, GC any compartments that were scheduled for\n"
" GC via schedulegc."),
JS_FN_HELP("minorgc", ::MinorGC, 0, 0,
"minorgc([overflow])",
" Run a minor collector on the Nursery. When overflow is true, marks the\n"
" store buffer as overflowed before collecting."),
JS_FN_HELP("gcparam", GCParameter, 2, 0,
"gcparam(name [, value])",
" Wrapper for JS_[GS]etGCParameter. The name is either maxBytes,\n"

View File

@ -433,10 +433,6 @@ class StoreBuffer
RelocValueBufferSize + RelocCellBufferSize +
GenericBufferSize;
/* For use by our owned buffers. */
void setAboutToOverflow();
void setOverflowed();
public:
explicit StoreBuffer(JSRuntime *rt)
: bufferVal(this), bufferCell(this), bufferSlot(this), bufferWholeObject(this),
@ -496,6 +492,10 @@ class StoreBuffer
bool coalesceForVerification();
void releaseVerificationData();
bool containsEdgeAt(void *loc) const;
/* For use by our owned buffers and for testing. */
void setAboutToOverflow();
void setOverflowed();
};
} /* namespace gc */