summaryrefslogtreecommitdiffstats
path: root/js/src/jsscript.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jsscript.h')
-rw-r--r--js/src/jsscript.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/js/src/jsscript.h b/js/src/jsscript.h
index 85eb2938d..13eaeff34 100644
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -1327,13 +1327,12 @@ class JSScript : public js::gc::TenuredCell
js::GeneratorKind generatorKind() const {
return js::GeneratorKindFromBits(generatorKindBits_);
}
- bool isGenerator() const { return generatorKind() != js::NotGenerator; }
bool isLegacyGenerator() const { return generatorKind() == js::LegacyGenerator; }
bool isStarGenerator() const { return generatorKind() == js::StarGenerator; }
void setGeneratorKind(js::GeneratorKind kind) {
// A script only gets its generator kind set as part of initialization,
// so it can only transition from not being a generator.
- MOZ_ASSERT(!isGenerator());
+ MOZ_ASSERT(!isStarGenerator() && !isLegacyGenerator());
generatorKindBits_ = GeneratorKindAsBits(kind);
}
@@ -1341,6 +1340,10 @@ class JSScript : public js::gc::TenuredCell
return isAsync_ ? js::AsyncFunction : js::SyncFunction;
}
+ bool isAsync() const {
+ return isAsync_;
+ }
+
void setAsyncKind(js::FunctionAsyncKind kind) {
isAsync_ = kind == js::AsyncFunction;
}
@@ -1493,7 +1496,8 @@ class JSScript : public js::gc::TenuredCell
bool isRelazifiable() const {
return (selfHosted() || lazyScript) && !hasInnerFunctions_ && !types_ &&
- !isGenerator() && !hasBaselineScript() && !hasAnyIonScript() &&
+ !isStarGenerator() && !isLegacyGenerator() && !isAsync() &&
+ !hasBaselineScript() && !hasAnyIonScript() &&
!isDefaultClassConstructor() &&
!doNotRelazify_;
}
@@ -1695,7 +1699,7 @@ class JSScript : public js::gc::TenuredCell
bool hasObjects() const { return hasArray(OBJECTS); }
bool hasTrynotes() const { return hasArray(TRYNOTES); }
bool hasScopeNotes() const { return hasArray(SCOPENOTES); }
- bool hasYieldOffsets() const { return isGenerator(); }
+ bool hasYieldOffsets() const { return isStarGenerator() || isLegacyGenerator() || isAsync(); }
#define OFF(fooOff, hasFoo, t) (fooOff() + (hasFoo() ? sizeof(t) : 0))
@@ -2112,8 +2116,6 @@ class LazyScript : public gc::TenuredCell
GeneratorKind generatorKind() const { return GeneratorKindFromBits(p_.generatorKindBits); }
- bool isGenerator() const { return generatorKind() != NotGenerator; }
-
bool isLegacyGenerator() const { return generatorKind() == LegacyGenerator; }
bool isStarGenerator() const { return generatorKind() == StarGenerator; }
@@ -2121,7 +2123,7 @@ class LazyScript : public gc::TenuredCell
void setGeneratorKind(GeneratorKind kind) {
// A script only gets its generator kind set as part of initialization,
// so it can only transition from NotGenerator.
- MOZ_ASSERT(!isGenerator());
+ MOZ_ASSERT(!isStarGenerator() && !isLegacyGenerator());
// Legacy generators cannot currently be lazy.
MOZ_ASSERT(kind != LegacyGenerator);
p_.generatorKindBits = GeneratorKindAsBits(kind);
@@ -2131,6 +2133,10 @@ class LazyScript : public gc::TenuredCell
return p_.isAsync ? AsyncFunction : SyncFunction;
}
+ bool isAsync() const {
+ return p_.isAsync;
+ }
+
void setAsyncKind(FunctionAsyncKind kind) {
p_.isAsync = kind == AsyncFunction;
}