diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-12-01 13:34:22 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-12-17 06:25:23 -0500 |
commit | 9163aaebb670bd87e6ef71beaf24999c926217eb (patch) | |
tree | 48bc403ef6b3349b749b0c38c1e94818b0734274 /js/src/jsscript.h | |
parent | 1fd726c6b04faacbb49c525ec733d9419ab65a84 (diff) | |
download | UXP-9163aaebb670bd87e6ef71beaf24999c926217eb.tar UXP-9163aaebb670bd87e6ef71beaf24999c926217eb.tar.gz UXP-9163aaebb670bd87e6ef71beaf24999c926217eb.tar.lz UXP-9163aaebb670bd87e6ef71beaf24999c926217eb.tar.xz UXP-9163aaebb670bd87e6ef71beaf24999c926217eb.zip |
Bug 1343481 - Part 1: Remove {JSFunction,JSScript,LazyScript}.isGenerator() method.
Tag #1287
Diffstat (limited to 'js/src/jsscript.h')
-rw-r--r-- | js/src/jsscript.h | 20 |
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; } |