Bug 1612799 - JITFrameInfo carries its own FailureLatchSource - r=canaltinova

Because JITFrameInfo objects are creating *during* profiling, they need to have
their own fallible FailureLatchSource, so that any error can be safely handled
even before we know which FailureLatch will be used in the final JSON
generation work.

Differential Revision: https://phabricator.services.mozilla.com/D155655
This commit is contained in:
Gerald Squelart 2022-09-05 01:19:30 +00:00
Родитель 892f66577e
Коммит 001b0d4ec0
2 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -268,7 +268,7 @@ JITFrameInfoForBufferRange JITFrameInfoForBufferRange::Clone() const {
JITFrameInfo::JITFrameInfo(const JITFrameInfo& aOther,
mozilla::ProgressLogger aProgressLogger)
: mUniqueStrings(MakeUnique<UniqueJSONStrings>(
FailureLatchInfallibleSource::Singleton(), *aOther.mUniqueStrings,
mLocalFailureLatchSource, *aOther.mUniqueStrings,
aProgressLogger.CreateSubLoggerFromTo(
0_pc, "Creating JIT frame info unique strings...", 49_pc,
"Created JIT frame info unique strings"))) {
@ -516,7 +516,7 @@ static nsCString JSONForJITFrame(JSContext* aContext,
UniqueJSONStrings& aUniqueStrings) {
nsCString json;
JSONStringRefWriteFunc jw(json);
SpliceableJSONWriter writer(jw, FailureLatchInfallibleSource::Singleton());
SpliceableJSONWriter writer(jw, aUniqueStrings.SourceFailureLatch());
StreamJITFrame(aContext, writer, aUniqueStrings, aJITFrame);
return json;
}

Просмотреть файл

@ -144,8 +144,8 @@ struct JITFrameInfoForBufferRange final {
class JITFrameInfo final {
public:
JITFrameInfo()
: mUniqueStrings(mozilla::MakeUnique<UniqueJSONStrings>(
mozilla::FailureLatchInfallibleSource::Singleton())) {}
: mUniqueStrings(
mozilla::MakeUnique<UniqueJSONStrings>(mLocalFailureLatchSource)) {}
MOZ_IMPLICIT JITFrameInfo(const JITFrameInfo& aOther,
mozilla::ProgressLogger aProgressLogger);
@ -174,6 +174,10 @@ class JITFrameInfo final {
return mRanges.back().mRangeEnd <= aCurrentBufferRangeStart;
}
mozilla::FailureLatch& LocalFailureLatchSource() {
return mLocalFailureLatchSource;
}
mozilla::Vector<JITFrameInfoForBufferRange>&& MoveRanges() && {
return std::move(mRanges);
}
@ -182,6 +186,11 @@ class JITFrameInfo final {
}
private:
// JITFrameInfo's may exist during profiling, so it carries its own fallible
// FailureLatch. If&when the data below is finally extracted, any error is
// forwarded to the caller.
mozilla::FailureLatchSource mLocalFailureLatchSource;
// The array of ranges of JIT frame information, sorted by buffer position.
// Ranges are non-overlapping.
// The JSON of the cached frames can contain string indexes, which refer