mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1154997 - Deal with self-hosted builtins when stringifying tracked optimization type info. (r=djvj)
This commit is contained in:
parent
49baba50f0
commit
2761a9b6b4
@ -215,12 +215,12 @@ struct ForEachTrackedOptimizationTypeInfoOp
|
||||
//
|
||||
// The lineno parameter is the line number if the type is keyed by
|
||||
// "constructor", "alloc site", or if the type itself refers to a scripted
|
||||
// function. Otherwise it is UINT32_MAX.
|
||||
// function. Otherwise it is Nothing().
|
||||
//
|
||||
// The location parameter is the only one that may need escaping if being
|
||||
// quoted.
|
||||
virtual void readType(const char* keyedBy, const char* name,
|
||||
const char* location, unsigned lineno) = 0;
|
||||
const char* location, mozilla::Maybe<unsigned> lineno) = 0;
|
||||
|
||||
// Called once per entry.
|
||||
virtual void operator()(TrackedTypeSite site, const char* mirType) = 0;
|
||||
|
@ -1145,17 +1145,19 @@ JS::ForEachTrackedOptimizationAttempt(JSRuntime* rt, void* addr, uint8_t index,
|
||||
}
|
||||
|
||||
static void
|
||||
InterpretedFunctionFilenameAndLineNumber(JSFunction* fun, const char** filename, unsigned* lineno)
|
||||
InterpretedFunctionFilenameAndLineNumber(JSFunction* fun, const char** filename,
|
||||
Maybe<unsigned>* lineno)
|
||||
{
|
||||
ScriptSource* source;
|
||||
if (fun->hasScript()) {
|
||||
source = fun->nonLazyScript()->maybeForwardedScriptSource();
|
||||
*lineno = fun->nonLazyScript()->lineno();
|
||||
*filename = fun->nonLazyScript()->maybeForwardedScriptSource()->filename();
|
||||
*lineno = Some((unsigned) fun->nonLazyScript()->lineno());
|
||||
} else if (fun->lazyScriptOrNull()) {
|
||||
*filename = fun->lazyScript()->maybeForwardedScriptSource()->filename();
|
||||
*lineno = Some((unsigned) fun->lazyScript()->lineno());
|
||||
} else {
|
||||
source = fun->lazyScript()->maybeForwardedScriptSource();
|
||||
*lineno = fun->lazyScript()->lineno();
|
||||
*filename = "(self-hosted builtin)";
|
||||
*lineno = Nothing();
|
||||
}
|
||||
*filename = source->filename();
|
||||
}
|
||||
|
||||
static JSFunction*
|
||||
@ -1180,7 +1182,7 @@ IonTrackedOptimizationsTypeInfo::ForEachOpAdapter::readType(const IonTrackedType
|
||||
TypeSet::Type ty = tracked.type;
|
||||
|
||||
if (ty.isPrimitive() || ty.isUnknown() || ty.isAnyObject()) {
|
||||
op_.readType("primitive", TypeSet::NonObjectTypeString(ty), nullptr, 0);
|
||||
op_.readType("primitive", TypeSet::NonObjectTypeString(ty), nullptr, Nothing());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1221,12 +1223,12 @@ IonTrackedOptimizationsTypeInfo::ForEachOpAdapter::readType(const IonTrackedType
|
||||
uintptr_t addr = JS_FUNC_TO_DATA_PTR(uintptr_t, fun->native());
|
||||
JS_snprintf(locationBuf, mozilla::ArrayLength(locationBuf), "%llx", addr);
|
||||
}
|
||||
op_.readType("native", name, name ? nullptr : locationBuf, UINT32_MAX);
|
||||
op_.readType("native", name, name ? nullptr : locationBuf, Nothing());
|
||||
return;
|
||||
}
|
||||
|
||||
const char* filename;
|
||||
unsigned lineno;
|
||||
Maybe<unsigned> lineno;
|
||||
InterpretedFunctionFilenameAndLineNumber(fun, &filename, &lineno);
|
||||
op_.readType(tracked.constructor ? "constructor" : "function",
|
||||
name, filename, lineno);
|
||||
@ -1240,16 +1242,16 @@ IonTrackedOptimizationsTypeInfo::ForEachOpAdapter::readType(const IonTrackedType
|
||||
JSScript* script = tracked.script;
|
||||
op_.readType("alloc site", buf,
|
||||
script->maybeForwardedScriptSource()->filename(),
|
||||
PCToLineNumber(script, script->offsetToPC(tracked.offset)));
|
||||
Some(PCToLineNumber(script, script->offsetToPC(tracked.offset))));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ty.isGroup()) {
|
||||
op_.readType("prototype", buf, nullptr, UINT32_MAX);
|
||||
op_.readType("prototype", buf, nullptr, Nothing());
|
||||
return;
|
||||
}
|
||||
|
||||
op_.readType("singleton", buf, nullptr, UINT32_MAX);
|
||||
op_.readType("singleton", buf, nullptr, Nothing());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4353,7 +4353,7 @@ class SprintOptimizationTypeInfoOp : public JS::ForEachTrackedOptimizationTypeIn
|
||||
{ }
|
||||
|
||||
void readType(const char* keyedBy, const char* name,
|
||||
const char* location, unsigned lineno) override
|
||||
const char* location, Maybe<unsigned> lineno) override
|
||||
{
|
||||
if (!startedTypes_) {
|
||||
startedTypes_ = true;
|
||||
@ -4367,8 +4367,8 @@ class SprintOptimizationTypeInfoOp : public JS::ForEachTrackedOptimizationTypeIn
|
||||
PutEscapedString(buf, mozilla::ArrayLength(buf), location, strlen(location), '"');
|
||||
Sprint(sp, ",\"location\":%s", buf);
|
||||
}
|
||||
if (lineno != UINT32_MAX)
|
||||
Sprint(sp, ",\"line\":%u", lineno);
|
||||
if (lineno.isSome())
|
||||
Sprint(sp, ",\"line\":%u", *lineno);
|
||||
Sprint(sp, "},");
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ public:
|
||||
{ }
|
||||
|
||||
void readType(const char* keyedBy, const char* name,
|
||||
const char* location, unsigned lineno) override {
|
||||
const char* location, Maybe<unsigned> lineno) override {
|
||||
if (!mStartedTypeList) {
|
||||
mStartedTypeList = true;
|
||||
mWriter.BeginObject();
|
||||
@ -251,8 +251,8 @@ public:
|
||||
if (location) {
|
||||
mWriter.NameValue("location", location);
|
||||
}
|
||||
if (lineno != UINT32_MAX) {
|
||||
mWriter.NameValue("line", lineno);
|
||||
if (lineno.isSome()) {
|
||||
mWriter.NameValue("line", *lineno);
|
||||
}
|
||||
mWriter.EndObject();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user