Bug 1569315 - Unify flags access code in FunctionFlags r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D40510

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matthew Gaudet 2019-08-06 21:03:18 +00:00
parent 969004e3aa
commit b8f89aa588
3 changed files with 9 additions and 16 deletions

View File

@ -35,15 +35,6 @@ struct FunctionCreationData {
HandleAtom getAtom(JSContext* cx) const;
bool isNamedLambda() const {
return flags.isLambda() && atom && !flags.hasInferredName() &&
!flags.hasGuessedAtom();
}
JSAtom* explicitName() {
return (flags.hasInferredName() || flags.hasGuessedAtom()) ? nullptr : atom;
}
void trace(JSTracer* trc) {
TraceNullableRoot(trc, &atom, "FunctionCreationData atom");
}

View File

@ -194,9 +194,9 @@ FunctionBox::FunctionBox(JSContext* cx, TraceListNode* traceListHead,
FunctionAsyncKind asyncKind)
: FunctionBox(cx, traceListHead, toStringStart, directives, extraWarnings,
generatorKind, asyncKind, data.get().flags.isArrow(),
data.get().isNamedLambda(), data.get().flags.isGetter(),
data.get().flags.isSetter(), data.get().flags.isMethod(),
data.get().flags.isInterpreted(),
data.get().flags.isNamedLambda(data.get().atom),
data.get().flags.isGetter(), data.get().flags.isSetter(),
data.get().flags.isMethod(), data.get().flags.isInterpreted(),
data.get().flags.isInterpretedLazy(), data.get().flags.kind(),
data.get().atom) {
functionCreationData_.emplace(data);

View File

@ -202,6 +202,10 @@ class FunctionFlags {
bool isLambda() const { return hasFlags(LAMBDA); }
bool isInterpretedLazy() const { return hasFlags(INTERPRETED_LAZY); }
bool isNamedLambda(JSAtom* atom) const {
return isLambda() && atom && !hasInferredName() && !hasGuessedAtom();
}
// These methods determine which of the u.scripted.s union arms are active.
// For live JSFunctions the pointer values will always be non-null, but due
// to partial initialization the GC (and other features that scan the heap
@ -502,10 +506,7 @@ class JSFunction : public js::NativeObject {
/* Compound attributes: */
bool isBuiltin() const { return isBuiltinNative() || isSelfHostedBuiltin(); }
bool isNamedLambda() const {
return isLambda() && displayAtom() && !hasInferredName() &&
!hasGuessedAtom();
}
bool isNamedLambda() const { return flags_.isNamedLambda(displayAtom()); }
bool hasLexicalThis() const { return isArrow(); }
@ -558,6 +559,7 @@ class JSFunction : public js::NativeObject {
JSAtom* explicitName() const {
return (hasInferredName() || hasGuessedAtom()) ? nullptr : atom_.get();
}
JSAtom* explicitOrInferredName() const {
return hasGuessedAtom() ? nullptr : atom_.get();
}