mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1239314 - Make marking validation a normal zeal mode; r=jonco
--HG-- extra : rebase_source : 7655f1d9237016a3bd0761d16501398e5d1723b3
This commit is contained in:
parent
7c86d14fc7
commit
e74a6f0bb8
@ -733,6 +733,40 @@ DeterministicGC(JSContext* cx, unsigned argc, Value* vp)
|
||||
}
|
||||
#endif /* JS_GC_ZEAL */
|
||||
|
||||
static bool
|
||||
ValidateGC(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (args.length() != 1) {
|
||||
RootedObject callee(cx, &args.callee());
|
||||
ReportUsageError(cx, callee, "Wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef JS_GC_ZEAL
|
||||
RootedObject callee(cx, &args.callee());
|
||||
ReportUsageError(cx, callee, "Called ValidateGC in a build without GC Zeal.");
|
||||
return false;
|
||||
#else
|
||||
uint8_t zeal;
|
||||
uint32_t freq;
|
||||
uint32_t scheduled;
|
||||
cx->runtime()->gc.getZeal(&zeal, &freq, &scheduled);
|
||||
if (zeal != 0 && zeal != js::gc::ZealIncrementalMarkingValidator) {
|
||||
RootedObject callee(cx, &args.callee());
|
||||
ReportUsageError(cx, callee, "Attempting to enter Marking Validation while another Zeal "
|
||||
"mode is set.");
|
||||
return false;
|
||||
}
|
||||
|
||||
int zealMode = ToBoolean(args[0]) ? 11 : 0;
|
||||
JS_SetGCZeal(cx, zealMode, 0);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
#endif // JS_GC_ZEAL
|
||||
}
|
||||
|
||||
static bool
|
||||
StartGC(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
@ -820,22 +854,6 @@ AbortGC(JSContext* cx, unsigned argc, Value* vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
ValidateGC(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
if (args.length() != 1) {
|
||||
RootedObject callee(cx, &args.callee());
|
||||
ReportUsageError(cx, callee, "Wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
cx->runtime()->gc.setValidate(ToBoolean(args[0]));
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
FullCompartmentChecks(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
|
@ -769,7 +769,6 @@ class GCRuntime
|
||||
JS::GCNurseryCollectionCallback setNurseryCollectionCallback(
|
||||
JS::GCNurseryCollectionCallback callback);
|
||||
|
||||
void setValidate(bool enable);
|
||||
void setFullCompartmentChecks(bool enable);
|
||||
|
||||
bool isManipulatingDeadZones() { return manipulatingDeadZones; }
|
||||
@ -1274,7 +1273,6 @@ class GCRuntime
|
||||
js::Vector<JSObject*, 0, js::SystemAllocPolicy> selectedForMarking;
|
||||
#endif
|
||||
|
||||
bool validate;
|
||||
bool fullCompartmentChecks;
|
||||
|
||||
Callback<JSGCCallback> gcCallback;
|
||||
|
@ -11,6 +11,5 @@ function recur(n)
|
||||
var obj = new Object();
|
||||
}
|
||||
|
||||
validategc(false);
|
||||
gcslice(1);
|
||||
recur(10);
|
||||
|
@ -1169,7 +1169,6 @@ GCRuntime::GCRuntime(JSRuntime* rt) :
|
||||
deterministicOnly(false),
|
||||
incrementalLimit(0),
|
||||
#endif
|
||||
validate(true),
|
||||
fullCompartmentChecks(false),
|
||||
mallocBytesUntilGC(0),
|
||||
mallocGCTriggered(false),
|
||||
@ -1208,7 +1207,7 @@ const char* gc::ZealModeHelpText =
|
||||
" 8: Incremental GC in two slices: 1) mark roots 2) finish collection\n"
|
||||
" 9: Incremental GC in two slices: 1) mark all 2) new marking and finish\n"
|
||||
" 10: Incremental GC in multiple slices\n"
|
||||
" 11: unused\n"
|
||||
" 11: Verify incremental marking\n"
|
||||
" 12: unused\n"
|
||||
" 13: Check internal hashtables on minor GC\n"
|
||||
" 14: Perform a shrinking collection every N allocations\n";
|
||||
@ -4261,7 +4260,7 @@ GCRuntime::markAllGrayReferences(gcstats::Phase phase)
|
||||
markGrayReferences<GCZonesIter, GCCompartmentsIter>(phase);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef JS_GC_ZEAL
|
||||
|
||||
struct GCChunkHasher {
|
||||
typedef gc::Chunk* Lookup;
|
||||
@ -4298,10 +4297,6 @@ class js::gc::MarkingValidator
|
||||
BitmapMap map;
|
||||
};
|
||||
|
||||
#endif // DEBUG
|
||||
|
||||
#ifdef JS_GC_MARKING_VALIDATION
|
||||
|
||||
js::gc::MarkingValidator::MarkingValidator(GCRuntime* gc)
|
||||
: gc(gc),
|
||||
initialized(false)
|
||||
@ -4519,14 +4514,14 @@ js::gc::MarkingValidator::validate()
|
||||
}
|
||||
}
|
||||
|
||||
#endif // JS_GC_MARKING_VALIDATION
|
||||
#endif // JS_GC_ZEAL
|
||||
|
||||
void
|
||||
GCRuntime::computeNonIncrementalMarkingForValidation()
|
||||
{
|
||||
#ifdef JS_GC_MARKING_VALIDATION
|
||||
#ifdef JS_GC_ZEAL
|
||||
MOZ_ASSERT(!markingValidator);
|
||||
if (isIncremental && validate)
|
||||
if (isIncremental && zeal() == ZealIncrementalMarkingValidator)
|
||||
markingValidator = js_new<MarkingValidator>(this);
|
||||
if (markingValidator)
|
||||
markingValidator->nonIncrementalMark();
|
||||
@ -4536,7 +4531,7 @@ GCRuntime::computeNonIncrementalMarkingForValidation()
|
||||
void
|
||||
GCRuntime::validateIncrementalMarking()
|
||||
{
|
||||
#ifdef JS_GC_MARKING_VALIDATION
|
||||
#ifdef JS_GC_ZEAL
|
||||
if (markingValidator)
|
||||
markingValidator->validate();
|
||||
#endif
|
||||
@ -4545,7 +4540,7 @@ GCRuntime::validateIncrementalMarking()
|
||||
void
|
||||
GCRuntime::finishMarkingValidation()
|
||||
{
|
||||
#ifdef JS_GC_MARKING_VALIDATION
|
||||
#ifdef JS_GC_ZEAL
|
||||
js_delete(markingValidator);
|
||||
markingValidator = nullptr;
|
||||
#endif
|
||||
@ -7007,13 +7002,6 @@ GCRuntime::runDebugGC()
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
GCRuntime::setValidate(bool enabled)
|
||||
{
|
||||
MOZ_ASSERT(!rt->isHeapMajorCollecting());
|
||||
validate = enabled;
|
||||
}
|
||||
|
||||
void
|
||||
GCRuntime::setFullCompartmentChecks(bool enabled)
|
||||
{
|
||||
|
@ -1306,6 +1306,7 @@ const int ZealGenerationalGCValue = 7;
|
||||
const int ZealIncrementalRootsThenFinish = 8;
|
||||
const int ZealIncrementalMarkAllThenFinish = 9;
|
||||
const int ZealIncrementalMultipleSlices = 10;
|
||||
const int ZealIncrementalMarkingValidator = 11;
|
||||
const int ZealCheckHashTablesOnMinorGC = 13;
|
||||
const int ZealCompactValue = 14;
|
||||
const int ZealLimit = 14;
|
||||
|
Loading…
Reference in New Issue
Block a user