diff --git a/js/src/frontend/FunctionCreationData.h b/js/src/frontend/FunctionCreationData.h index b2e7690a6f75..bedfad923ba5 100644 --- a/js/src/frontend/FunctionCreationData.h +++ b/js/src/frontend/FunctionCreationData.h @@ -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"); } diff --git a/js/src/frontend/SharedContext.cpp b/js/src/frontend/SharedContext.cpp index 6731dda0c9f6..63ac0e02c3bd 100644 --- a/js/src/frontend/SharedContext.cpp +++ b/js/src/frontend/SharedContext.cpp @@ -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); diff --git a/js/src/vm/JSFunction.h b/js/src/vm/JSFunction.h index 5ad9632926e0..c10ce5a4140e 100644 --- a/js/src/vm/JSFunction.h +++ b/js/src/vm/JSFunction.h @@ -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(); }