forked from mirrors/gecko-dev
Bug 1783397 - Part 10: Add {JSString,JS::Symbol,JS::PropertyKey}::dumpStringContent methods. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D199825
This commit is contained in:
parent
f2aef3b087
commit
25753781a7
6 changed files with 31 additions and 0 deletions
|
|
@ -216,6 +216,7 @@ class PropertyKey {
|
||||||
|
|
||||||
void dumpFields(js::JSONPrinter& json) const;
|
void dumpFields(js::JSONPrinter& json) const;
|
||||||
void dumpPropertyName(js::GenericPrinter& out) const;
|
void dumpPropertyName(js::GenericPrinter& out) const;
|
||||||
|
void dumpStringContent(js::GenericPrinter& out) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -101,4 +101,18 @@ void JS::PropertyKey::dumpPropertyName(js::GenericPrinter& out) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JS::PropertyKey::dumpStringContent(js::GenericPrinter& out) const {
|
||||||
|
if (isAtom()) {
|
||||||
|
toAtom()->dumpStringContent(out);
|
||||||
|
} else if (isInt()) {
|
||||||
|
out.printf("%d", toInt());
|
||||||
|
} else if (isSymbol()) {
|
||||||
|
toSymbol()->dumpStringContent(out);
|
||||||
|
} else if (isVoid()) {
|
||||||
|
out.put("(void)");
|
||||||
|
} else {
|
||||||
|
out.printf("Unknown(%zx)", size_t(asRawBits()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* defined(DEBUG) || defined(JS_JITSPEW) */
|
#endif /* defined(DEBUG) || defined(JS_JITSPEW) */
|
||||||
|
|
|
||||||
|
|
@ -534,6 +534,12 @@ void JSString::dumpRepresentationFields(js::JSONPrinter& json) const {
|
||||||
dumpCharsFields(json);
|
dumpCharsFields(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JSString::dumpStringContent(js::GenericPrinter& out) const {
|
||||||
|
dumpCharsSingleQuote(out);
|
||||||
|
|
||||||
|
out.printf(" @ (%s*)0x%p", RepresentationToString(this), this);
|
||||||
|
}
|
||||||
|
|
||||||
void JSString::dumpPropertyName(js::GenericPrinter& out) const {
|
void JSString::dumpPropertyName(js::GenericPrinter& out) const {
|
||||||
dumpCharsNoQuote(out);
|
dumpCharsNoQuote(out);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -748,6 +748,7 @@ class JSString : public js::gc::CellWithLengthAndFlags {
|
||||||
void dumpCharsFields(js::JSONPrinter& json) const;
|
void dumpCharsFields(js::JSONPrinter& json) const;
|
||||||
|
|
||||||
void dumpFields(js::JSONPrinter& json) const;
|
void dumpFields(js::JSONPrinter& json) const;
|
||||||
|
void dumpStringContent(js::GenericPrinter& out) const;
|
||||||
void dumpPropertyName(js::GenericPrinter& out) const;
|
void dumpPropertyName(js::GenericPrinter& out) const;
|
||||||
|
|
||||||
void dumpChars(js::GenericPrinter& out) const;
|
void dumpChars(js::GenericPrinter& out) const;
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,14 @@ void Symbol::dumpFields(js::JSONPrinter& json) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Symbol::dumpStringContent(js::GenericPrinter& out) const {
|
||||||
|
dumpPropertyName(out);
|
||||||
|
|
||||||
|
if (!isWellKnownSymbol()) {
|
||||||
|
out.printf(" @ (JS::Symbol*)0x%p", this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Symbol::dumpPropertyName(js::GenericPrinter& out) const {
|
void Symbol::dumpPropertyName(js::GenericPrinter& out) const {
|
||||||
if (isWellKnownSymbol()) {
|
if (isWellKnownSymbol()) {
|
||||||
// All the well-known symbol names are ASCII.
|
// All the well-known symbol names are ASCII.
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ class Symbol
|
||||||
void dump(js::JSONPrinter& json) const;
|
void dump(js::JSONPrinter& json) const;
|
||||||
|
|
||||||
void dumpFields(js::JSONPrinter& json) const;
|
void dumpFields(js::JSONPrinter& json) const;
|
||||||
|
void dumpStringContent(js::GenericPrinter& out) const;
|
||||||
void dumpPropertyName(js::GenericPrinter& out) const;
|
void dumpPropertyName(js::GenericPrinter& out) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue