mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 18:26:15 +00:00
Bug 1206594: Pass SavedStacks::chooseSamplingProbability its JSCompartment directly. r=fitzgen
--HG-- extra : rebase_source : 5555867b3cc1baa6f1a4b9ff9d0cc811a365125d
This commit is contained in:
parent
cd209ab0b5
commit
0ee8c8ee9b
@ -374,6 +374,12 @@ struct JSCompartment
|
||||
js::NewObjectMetadataState objectMetadataState;
|
||||
|
||||
public:
|
||||
// Recompute the probability with which this compartment should record
|
||||
// profiling data (stack traces, allocations log, etc.) about each
|
||||
// allocation. We consult the probabilities requested by the Debugger
|
||||
// instances observing us, if any.
|
||||
void chooseAllocationSamplingProbability() { savedStacks_.chooseSamplingProbability(this); }
|
||||
|
||||
bool hasObjectPendingMetadata() const { return objectMetadataState.is<js::PendingMetadata>(); }
|
||||
|
||||
void setObjectPendingMetadata(JSContext* cx, JSObject* obj) {
|
||||
|
@ -1326,9 +1326,13 @@ SavedStacks::getLocation(JSContext* cx, const FrameIter& iter, MutableHandleLoca
|
||||
}
|
||||
|
||||
void
|
||||
SavedStacks::chooseSamplingProbability(JSContext* cx)
|
||||
SavedStacks::chooseSamplingProbability(JSCompartment* compartment)
|
||||
{
|
||||
GlobalObject::DebuggerVector* dbgs = cx->global()->getDebuggers();
|
||||
GlobalObject* global = compartment->maybeGlobal();
|
||||
if (!global)
|
||||
return;
|
||||
|
||||
GlobalObject::DebuggerVector* dbgs = global->getDebuggers();
|
||||
if (!dbgs || dbgs->empty())
|
||||
return;
|
||||
|
||||
@ -1361,7 +1365,7 @@ SavedStacksMetadataCallback(JSContext* cx, JSObject* target)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
stacks.chooseSamplingProbability(cx);
|
||||
stacks.chooseSamplingProbability(cx->compartment());
|
||||
if (stacks.allocationSamplingProbability == 0.0)
|
||||
return nullptr;
|
||||
|
||||
|
@ -168,6 +168,7 @@ class SavedStacks {
|
||||
uint32_t count();
|
||||
void clear();
|
||||
void setRNGState(uint64_t state) { rngState = state; }
|
||||
void chooseSamplingProbability(JSCompartment*);
|
||||
|
||||
size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
||||
|
||||
@ -206,7 +207,6 @@ class SavedStacks {
|
||||
unsigned maxFrameCount);
|
||||
SavedFrame* getOrCreateSavedFrame(JSContext* cx, SavedFrame::HandleLookup lookup);
|
||||
SavedFrame* createFrameFromLookup(JSContext* cx, SavedFrame::HandleLookup lookup);
|
||||
void chooseSamplingProbability(JSContext* cx);
|
||||
|
||||
// Cache for memoizing PCToLineNumber lookups.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user