From 13ebe80af70cc864a5744e3dff2ccb58859848ee Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Fri, 27 Jul 2018 12:46:13 +0900 Subject: [PATCH] Bug 1467022 - Add comment about the script field to JSFunction::hasScript, and refer JSFunction::hasUncompletedScript. r=jandem DONTBUILD, comment-only --- js/src/vm/JSFunction.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/src/vm/JSFunction.h b/js/src/vm/JSFunction.h index d94b3be9b59c..1c11542c2589 100644 --- a/js/src/vm/JSFunction.h +++ b/js/src/vm/JSFunction.h @@ -262,6 +262,14 @@ class JSFunction : public js::NativeObject } bool isLambda() const { return flags() & LAMBDA; } bool isInterpretedLazy() const { return flags() & INTERPRETED_LAZY; } + + // This method doesn't check the non-nullness of u.scripted.s.script_, + // because it's guaranteed to be non-null when this has INTERPRETED flag, + // for live JSFunctions. + // + // When this JSFunction instance is reached via GC iteration, the above + // doesn't hold, and hasUncompletedScript should also be checked. + // (see the comment above hasUncompletedScript for more details). bool hasScript() const { return flags() & INTERPRETED; } bool infallibleIsDefaultClassConstructor(JSContext* cx) const;