mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
Bug 1343481 - Part 1: Remove {JSFunction,JSScript,LazyScript}.isGenerator() method.
Tag #1287
This commit is contained in:
parent
4ce0bb5e0a
commit
7eb5d46c11
22 changed files with 133 additions and 64 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue