mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset fbf1b0195d80 (bug 1127156)
This commit is contained in:
parent
0817af87b0
commit
eaa3233440
@ -1875,7 +1875,8 @@ JS::ProfilingFrameIterator::extractStack(Frame *frames, uint32_t offset, uint32_
|
||||
// Look up an entry for the return address.
|
||||
jit::JitcodeGlobalTable *table = rt_->jitRuntime()->getJitcodeGlobalTable();
|
||||
jit::JitcodeGlobalEntry entry;
|
||||
table->lookupInfallible(returnAddr, &entry, rt_);
|
||||
mozilla::DebugOnly<bool> result = table->lookup(returnAddr, &entry, rt_);
|
||||
MOZ_ASSERT(result);
|
||||
|
||||
MOZ_ASSERT(entry.isIon() || entry.isIonCache() || entry.isBaseline() || entry.isDummy());
|
||||
|
||||
@ -1897,25 +1898,7 @@ JS::ProfilingFrameIterator::extractStack(Frame *frames, uint32_t offset, uint32_
|
||||
frames[offset + i].returnAddress = returnAddr;
|
||||
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
|
||||
// store it on the youngest frame. All inlined frames will have the same
|
||||
// optimization information by virtue of sharing the JitcodeGlobalEntry,
|
||||
// but such information is only interpretable on the youngest frame.
|
||||
//
|
||||
// FIXMEshu: disabled until we can ensure the optimization info is live
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
|
@ -150,20 +150,6 @@ JSStreamWriter::Value(int aValue)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
JSStreamWriter::Value(unsigned aValue)
|
||||
{
|
||||
MOZ_ASSERT(!mNeedsName);
|
||||
if (mNeedsComma && mStack.Peek() == ARRAY) {
|
||||
mStream << ",";
|
||||
}
|
||||
mStream << aValue;
|
||||
mNeedsComma = true;
|
||||
if (mStack.Peek() == OBJECT) {
|
||||
mNeedsName = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
JSStreamWriter::Value(double aValue)
|
||||
{
|
||||
|
@ -22,7 +22,6 @@ public:
|
||||
void EndArray();
|
||||
void Name(const char *name);
|
||||
void Value(int value);
|
||||
void Value(unsigned value);
|
||||
void Value(double value);
|
||||
void Value(const char *value, size_t valueLength);
|
||||
void Value(const char *value);
|
||||
|
@ -8,10 +8,7 @@
|
||||
#include "platform.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
// JS
|
||||
#include "jsapi.h"
|
||||
#include "js/TrackedOptimizationInfo.h"
|
||||
|
||||
// JSON
|
||||
#include "JSStreamWriter.h"
|
||||
@ -96,9 +93,8 @@ void ProfileEntry::log()
|
||||
// by looking through all the use points of TableTicker.cpp.
|
||||
// mTagMarker (ProfilerMarker*) m
|
||||
// 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)
|
||||
// mTagPtr (void*) d,l,L,B (immediate backtrace), S(start-of-stack)
|
||||
// mTagInt (int) n,f,y,T (thread id)
|
||||
// mTagChar (char) h
|
||||
// mTagFloat (double) r,t,p,R (resident memory), U (unshared memory)
|
||||
switch (mTagName) {
|
||||
@ -106,9 +102,9 @@ void ProfileEntry::log()
|
||||
LOGF("%c \"%s\"", mTagName, mTagMarker->GetMarkerName()); break;
|
||||
case 'c': case 's':
|
||||
LOGF("%c \"%s\"", mTagName, mTagData); break;
|
||||
case 'd': case 'l': case 'L': case 'J': case 'B': case 'S':
|
||||
case 'd': case 'l': case 'L': 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;
|
||||
@ -249,72 +245,7 @@ void ProfileBuffer::IterateTagsForThread(IterateTagsCallback aCallback, int aThr
|
||||
}
|
||||
}
|
||||
|
||||
class StreamOptimizationTypeInfoOp : public JS::ForEachTrackedOptimizationTypeInfoOp
|
||||
{
|
||||
JSStreamWriter& mWriter;
|
||||
bool mStartedTypeList;
|
||||
|
||||
public:
|
||||
explicit StreamOptimizationTypeInfoOp(JSStreamWriter& b)
|
||||
: mWriter(b)
|
||||
, mStartedTypeList(false)
|
||||
{ }
|
||||
|
||||
void readType(const char *keyedBy, const char *name,
|
||||
const char *location, unsigned lineno) MOZ_OVERRIDE {
|
||||
if (!mStartedTypeList) {
|
||||
mStartedTypeList = true;
|
||||
mWriter.BeginObject();
|
||||
mWriter.Name("types");
|
||||
mWriter.BeginArray();
|
||||
}
|
||||
|
||||
mWriter.BeginObject();
|
||||
mWriter.NameValue("keyedBy", keyedBy);
|
||||
mWriter.NameValue("name", name);
|
||||
if (location) {
|
||||
mWriter.NameValue("location", location);
|
||||
mWriter.NameValue("line", lineno);
|
||||
}
|
||||
mWriter.EndObject();
|
||||
}
|
||||
|
||||
void operator()(JS::TrackedTypeSite site, const char *mirType) MOZ_OVERRIDE {
|
||||
if (mStartedTypeList) {
|
||||
mWriter.EndArray();
|
||||
mStartedTypeList = false;
|
||||
} else {
|
||||
mWriter.BeginObject();
|
||||
}
|
||||
|
||||
mWriter.NameValue("site", JS::TrackedTypeSiteString(site));
|
||||
mWriter.NameValue("mirType", mirType);
|
||||
mWriter.EndObject();
|
||||
}
|
||||
};
|
||||
|
||||
class StreamOptimizationAttemptsOp : public JS::ForEachTrackedOptimizationAttemptOp
|
||||
{
|
||||
JSStreamWriter& mWriter;
|
||||
|
||||
public:
|
||||
explicit StreamOptimizationAttemptsOp(JSStreamWriter& b)
|
||||
: mWriter(b)
|
||||
{ }
|
||||
|
||||
void operator()(JS::TrackedStrategy strategy, JS::TrackedOutcome outcome) MOZ_OVERRIDE {
|
||||
mWriter.BeginObject();
|
||||
{
|
||||
// Stringify the reasons for now; could stream enum values in the future
|
||||
// to save space.
|
||||
mWriter.NameValue("strategy", JS::TrackedStrategyString(strategy));
|
||||
mWriter.NameValue("outcome", JS::TrackedOutcomeString(outcome));
|
||||
}
|
||||
mWriter.EndObject();
|
||||
}
|
||||
};
|
||||
|
||||
void ProfileBuffer::StreamSamplesToJSObject(JSStreamWriter& b, int aThreadId, JSRuntime* rt)
|
||||
void ProfileBuffer::StreamSamplesToJSObject(JSStreamWriter& b, int aThreadId)
|
||||
{
|
||||
b.BeginArray();
|
||||
|
||||
@ -437,28 +368,6 @@ void ProfileBuffer::StreamSamplesToJSObject(JSStreamWriter& b, int aThreadId, JS
|
||||
b.NameValue("category", mEntries[readAheadPos].mTagInt);
|
||||
incBy++;
|
||||
}
|
||||
readAheadPos = (framePos + incBy) % mEntrySize;
|
||||
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.
|
||||
if (rt) {
|
||||
b.Name("opts");
|
||||
b.BeginArray();
|
||||
StreamOptimizationTypeInfoOp typeInfoOp(b);
|
||||
JS::ForEachTrackedOptimizationTypeInfo(rt, pc, index, typeInfoOp);
|
||||
StreamOptimizationAttemptsOp attemptOp(b);
|
||||
JS::ForEachTrackedOptimizationAttempt(rt, pc, index, attemptOp);
|
||||
b.EndArray();
|
||||
}
|
||||
}
|
||||
b.EndObject();
|
||||
}
|
||||
framePos = (framePos + incBy) % mEntrySize;
|
||||
@ -633,7 +542,7 @@ void ThreadProfile::StreamJSObject(JSStreamWriter& b)
|
||||
b.NameValue("tid", static_cast<int>(mThreadId));
|
||||
|
||||
b.Name("samples");
|
||||
mBuffer->StreamSamplesToJSObject(b, mThreadId, mPseudoStack->mRuntime);
|
||||
mBuffer->StreamSamplesToJSObject(b, mThreadId);
|
||||
|
||||
b.Name("markers");
|
||||
mBuffer->StreamMarkersToJSObject(b, mThreadId);
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
|
||||
void addTag(const ProfileEntry& aTag);
|
||||
void IterateTagsForThread(IterateTagsCallback aCallback, int aThreadId);
|
||||
void StreamSamplesToJSObject(JSStreamWriter& b, int aThreadId, JSRuntime* rt);
|
||||
void StreamSamplesToJSObject(JSStreamWriter& b, int aThreadId);
|
||||
void StreamMarkersToJSObject(JSStreamWriter& b, int aThreadId);
|
||||
void DuplicateLastSample(int aThreadId);
|
||||
|
||||
@ -184,8 +184,6 @@ public:
|
||||
int64_t mRssMemory;
|
||||
int64_t mUssMemory;
|
||||
#endif
|
||||
|
||||
void StreamTrackedOptimizations(JSStreamWriter& b, void* addr, uint8_t index);
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const ThreadProfile& profile);
|
||||
|
@ -582,16 +582,6 @@ void mergeStacksIntoProfile(ThreadProfile& aProfile, TickSample* aSample, Native
|
||||
if (jsStackAddr > nativeStackAddr) {
|
||||
MOZ_ASSERT(jsIndex >= 0);
|
||||
addDynamicTag(aProfile, 'c', jsFrames[jsIndex].label);
|
||||
|
||||
// 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.
|
||||
if (jsFrames[jsIndex].hasTrackedOptimizations) {
|
||||
aProfile.addTag(ProfileEntry('J', jsFrames[jsIndex].returnAddress));
|
||||
aProfile.addTag(ProfileEntry('o', jsFrames[jsIndex].trackedOptimizationIndex));
|
||||
}
|
||||
|
||||
jsIndex--;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user