Backed out 2 changesets (bug 1148069) for devtools-2 leaks

CLOSED TREE

Backed out changeset d1e9b787eaeb (bug 1148069)
Backed out changeset c68a6ebe6083 (bug 1148069)
This commit is contained in:
Phil Ringnalda 2015-03-27 19:58:29 -07:00
parent 583981ecbc
commit deb6a77305
3 changed files with 7 additions and 19 deletions

View File

@ -112,7 +112,7 @@ ProfileBuffer::ProfileBuffer(int aEntrySize)
ProfileBuffer::~ProfileBuffer()
{
mGeneration = UINT32_MAX;
mGeneration = INT_MAX;
deleteExpiredStoredMarkers();
}
@ -121,11 +121,6 @@ void ProfileBuffer::addTag(const ProfileEntry& aTag)
{
mEntries[mWritePos++] = aTag;
if (mWritePos == mEntrySize) {
// Wrapping around may result in things referenced in the buffer (e.g.,
// JIT code addresses and markers) being incorrectly collected. 2 is
// subtracted to assert that we do not leak stored markers in
// ~ProfileBuffer.
MOZ_ASSERT(mGeneration != UINT32_MAX - 2);
mGeneration++;
mWritePos = 0;
}

View File

@ -131,7 +131,7 @@ public:
int mEntrySize;
// How many times mWritePos has wrapped around.
uint32_t mGeneration;
int mGeneration;
// Markers that marker entries in the buffer might refer to.
ProfilerMarkerLinkedList mStoredMarkers;
@ -178,6 +178,7 @@ public:
}
uint32_t bufferGeneration() const {
MOZ_ASSERT(mBuffer->mGeneration >= 0);
return mBuffer->mGeneration;
}

View File

@ -486,16 +486,7 @@ void mergeStacksIntoProfile(ThreadProfile& aProfile, TickSample* aSample, Native
// like the native stack, the JS stack is iterated youngest-to-oldest and we
// need to iterate oldest-to-youngest when adding entries to aProfile.
// Synchronous sampling reports an invalid buffer generation to
// ProfilingFrameIterator to avoid incorrectly resetting the generation of
// sampled JIT entries inside the JS engine. See note below concerning 'J'
// entries.
uint32_t startBufferGen;
if (aSample->isSamplingCurrentThread) {
startBufferGen = UINT32_MAX;
} else {
startBufferGen = aProfile.bufferGeneration();
}
uint32_t startBufferGen = aProfile.bufferGeneration();
uint32_t jsCount = 0;
JS::ProfilingFrameIterator::Frame jsFrames[1000];
// Only walk jit stack if profiling frame iterator is turned on.
@ -644,13 +635,14 @@ void mergeStacksIntoProfile(ThreadProfile& aProfile, TickSample* aSample, Native
nativeIndex--;
}
MOZ_ASSERT(aProfile.bufferGeneration() >= startBufferGen);
uint32_t lapCount = aProfile.bufferGeneration() - startBufferGen;
// Update the JS runtime with the current profile sample buffer generation.
//
// Do not do this for synchronous sampling, which create their own
// ProfileBuffers.
if (!aSample->isSamplingCurrentThread && pseudoStack->mRuntime) {
MOZ_ASSERT(aProfile.bufferGeneration() >= startBufferGen);
uint32_t lapCount = aProfile.bufferGeneration() - startBufferGen;
JS::UpdateJSRuntimeProfilerSampleBufferGen(pseudoStack->mRuntime,
aProfile.bufferGeneration(),
lapCount);