mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-07 01:01:43 +00:00
Bug 1129781 - Re-lookup JIT code return addr when stringifying optimization info instead of caching the index. (r=djvj)
This saves us some circular buffer space.
This commit is contained in:
parent
b35741135a
commit
aaeea34735
@ -104,7 +104,6 @@ class JS_PUBLIC_API(ProfilingFrameIterator)
|
||||
void *activation;
|
||||
const char *label;
|
||||
bool hasTrackedOptimizations;
|
||||
uint8_t trackedOptimizationIndex;
|
||||
};
|
||||
uint32_t extractStack(Frame *frames, uint32_t offset, uint32_t end) const;
|
||||
|
||||
|
@ -276,7 +276,7 @@ struct ForEachTrackedOptimizationAttemptOp
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
ForEachTrackedOptimizationAttempt(JSRuntime *rt, void *addr, uint8_t index,
|
||||
ForEachTrackedOptimizationAttempt(JSRuntime *rt, void *addr,
|
||||
ForEachTrackedOptimizationAttemptOp &op);
|
||||
|
||||
struct ForEachTrackedOptimizationTypeInfoOp
|
||||
@ -308,7 +308,7 @@ struct ForEachTrackedOptimizationTypeInfoOp
|
||||
};
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
ForEachTrackedOptimizationTypeInfo(JSRuntime *rt, void *addr, uint8_t index,
|
||||
ForEachTrackedOptimizationTypeInfo(JSRuntime *rt, void *addr,
|
||||
ForEachTrackedOptimizationTypeInfoOp &op);
|
||||
|
||||
} // namespace JS
|
||||
|
@ -498,7 +498,7 @@ IonTrackedOptimizationsRegion::findIndex(uint32_t offset) const
|
||||
uint32_t startOffset, endOffset;
|
||||
uint8_t index;
|
||||
iter.readNext(&startOffset, &endOffset, &index);
|
||||
if (startOffset <= offset && offset < endOffset)
|
||||
if (startOffset <= offset && offset <= endOffset)
|
||||
return Some(index);
|
||||
}
|
||||
return Nothing();
|
||||
@ -1113,13 +1113,14 @@ IonBuilder::trackInlineSuccessUnchecked(InliningStatus status)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::ForEachTrackedOptimizationAttempt(JSRuntime *rt, void *addr, uint8_t index,
|
||||
JS::ForEachTrackedOptimizationAttempt(JSRuntime *rt, void *addr,
|
||||
ForEachTrackedOptimizationAttemptOp &op)
|
||||
{
|
||||
JitcodeGlobalTable *table = rt->jitRuntime()->getJitcodeGlobalTable();
|
||||
JitcodeGlobalEntry entry;
|
||||
table->lookupInfallible(addr, &entry, rt);
|
||||
entry.trackedOptimizationAttempts(index).forEach(op);
|
||||
Maybe<uint8_t> index = entry.trackedOptimizationIndexAtAddr(addr);
|
||||
entry.trackedOptimizationAttempts(index.value()).forEach(op);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1203,12 +1204,13 @@ class ForEachTypeInfoAdapter : public IonTrackedOptimizationsTypeInfo::ForEachOp
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::ForEachTrackedOptimizationTypeInfo(JSRuntime *rt, void *addr, uint8_t index,
|
||||
JS::ForEachTrackedOptimizationTypeInfo(JSRuntime *rt, void *addr,
|
||||
ForEachTrackedOptimizationTypeInfoOp &op)
|
||||
{
|
||||
JitcodeGlobalTable *table = rt->jitRuntime()->getJitcodeGlobalTable();
|
||||
JitcodeGlobalEntry entry;
|
||||
table->lookupInfallible(addr, &entry, rt);
|
||||
ForEachTypeInfoAdapter adapter(op);
|
||||
entry.trackedOptimizationTypeInfo(index).forEach(adapter, entry.allTrackedTypes());
|
||||
Maybe<uint8_t> index = entry.trackedOptimizationIndexAtAddr(addr);
|
||||
entry.trackedOptimizationTypeInfo(index.value()).forEach(adapter, entry.allTrackedTypes());
|
||||
}
|
||||
|
@ -291,7 +291,8 @@ class IonTrackedOptimizationsRegion
|
||||
uint32_t startOffset() const { return startOffset_; }
|
||||
uint32_t endOffset() const { return endOffset_; }
|
||||
|
||||
class RangeIterator {
|
||||
class RangeIterator
|
||||
{
|
||||
const uint8_t *cur_;
|
||||
const uint8_t *start_;
|
||||
const uint8_t *end_;
|
||||
|
@ -1867,7 +1867,6 @@ JS::ProfilingFrameIterator::extractStack(Frame *frames, uint32_t offset, uint32_
|
||||
frames[offset].activation = activation_;
|
||||
frames[offset].label = asmJSIter().label();
|
||||
frames[offset].hasTrackedOptimizations = false;
|
||||
frames[offset].trackedOptimizationIndex = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1900,7 +1899,6 @@ JS::ProfilingFrameIterator::extractStack(Frame *frames, uint32_t offset, uint32_
|
||||
frames[offset + i].activation = activation_;
|
||||
frames[offset + i].label = labels[i];
|
||||
frames[offset + i].hasTrackedOptimizations = false;
|
||||
frames[offset + i].trackedOptimizationIndex = 0;
|
||||
}
|
||||
|
||||
// Extract the index into the side table of optimization information and
|
||||
@ -1912,10 +1910,7 @@ JS::ProfilingFrameIterator::extractStack(Frame *frames, uint32_t offset, uint32_
|
||||
// when we write out the JSON stream of the profile.
|
||||
if (false && entry.hasTrackedOptimizations()) {
|
||||
mozilla::Maybe<uint8_t> index = entry.trackedOptimizationIndexAtAddr(returnAddr);
|
||||
if (index.isSome()) {
|
||||
frames[offset].hasTrackedOptimizations = true;
|
||||
frames[offset].trackedOptimizationIndex = index.value();
|
||||
}
|
||||
frames[offset].hasTrackedOptimizations = index.isSome();
|
||||
}
|
||||
|
||||
return depth;
|
||||
|
@ -98,7 +98,7 @@ void ProfileEntry::log()
|
||||
// mTagData (const char*) c,s
|
||||
// mTagPtr (void*) d,l,L,B (immediate backtrace), S(start-of-stack),
|
||||
// J (JIT code addr)
|
||||
// mTagInt (int) n,f,y,o (JIT optimization info index), T (thread id)
|
||||
// mTagInt (int) n,f,y, T (thread id)
|
||||
// mTagChar (char) h
|
||||
// mTagFloat (double) r,t,p,R (resident memory), U (unshared memory)
|
||||
switch (mTagName) {
|
||||
@ -108,7 +108,7 @@ void ProfileEntry::log()
|
||||
LOGF("%c \"%s\"", mTagName, mTagData); break;
|
||||
case 'd': case 'l': case 'L': case 'J': case 'B': case 'S':
|
||||
LOGF("%c %p", mTagName, mTagPtr); break;
|
||||
case 'n': case 'f': case 'y': case 'o': case 'T':
|
||||
case 'n': case 'f': case 'y': case 'T':
|
||||
LOGF("%c %d", mTagName, mTagInt); break;
|
||||
case 'h':
|
||||
LOGF("%c \'%c\'", mTagName, mTagChar); break;
|
||||
@ -441,11 +441,6 @@ void ProfileBuffer::StreamSamplesToJSObject(JSStreamWriter& b, int aThreadId, JS
|
||||
if (readAheadPos != mWritePos &&
|
||||
mEntries[readAheadPos].mTagName == 'J') {
|
||||
void* pc = mEntries[readAheadPos].mTagPtr;
|
||||
incBy++;
|
||||
readAheadPos = (framePos + incBy) % mEntrySize;
|
||||
MOZ_ASSERT(readAheadPos != mWritePos &&
|
||||
mEntries[readAheadPos].mTagName == 'o');
|
||||
uint32_t index = mEntries[readAheadPos].mTagInt;
|
||||
|
||||
// TODOshu: cannot stream tracked optimization info if
|
||||
// the JS engine has already shut down when streaming.
|
||||
@ -453,9 +448,9 @@ void ProfileBuffer::StreamSamplesToJSObject(JSStreamWriter& b, int aThreadId, JS
|
||||
b.Name("opts");
|
||||
b.BeginArray();
|
||||
StreamOptimizationTypeInfoOp typeInfoOp(b);
|
||||
JS::ForEachTrackedOptimizationTypeInfo(rt, pc, index, typeInfoOp);
|
||||
JS::ForEachTrackedOptimizationTypeInfo(rt, pc, typeInfoOp);
|
||||
StreamOptimizationAttemptsOp attemptOp(b);
|
||||
JS::ForEachTrackedOptimizationAttempt(rt, pc, index, attemptOp);
|
||||
JS::ForEachTrackedOptimizationAttempt(rt, pc, attemptOp);
|
||||
b.EndArray();
|
||||
}
|
||||
}
|
||||
|
@ -585,11 +585,9 @@ void mergeStacksIntoProfile(ThreadProfile& aProfile, TickSample* aSample, Native
|
||||
|
||||
// Stringifying optimization information is delayed until streaming
|
||||
// time. To re-lookup the entry in the JitcodeGlobalTable, we need to
|
||||
// store both the the JIT code address ('J') and the tracked
|
||||
// optimization index ('o') in the circular buffer.
|
||||
// store the JIT code address ('J') in the circular buffer.
|
||||
if (jsFrames[jsIndex].hasTrackedOptimizations) {
|
||||
aProfile.addTag(ProfileEntry('J', jsFrames[jsIndex].returnAddress));
|
||||
aProfile.addTag(ProfileEntry('o', jsFrames[jsIndex].trackedOptimizationIndex));
|
||||
}
|
||||
|
||||
jsIndex--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user