зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1617306 - Move MutableScriptFlags into SharedStencil r=caroline
Differential Revision: https://phabricator.services.mozilla.com/D63942 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
676b74b5af
Коммит
b203d93434
|
@ -2031,6 +2031,7 @@ class BaseScript : public gc::TenuredCell {
|
|||
// Alias the enum into JSScript to provide easy translation for various
|
||||
// consumers
|
||||
using ImmutableFlags = ImmutableScriptFlagsEnum;
|
||||
using MutableFlags = MutableScriptFlagsEnum;
|
||||
|
||||
protected:
|
||||
// Immutable flags should not be modified after this script has been
|
||||
|
@ -2040,11 +2041,13 @@ class BaseScript : public gc::TenuredCell {
|
|||
//
|
||||
// Specific accessors for flag values are defined with
|
||||
// IMMUTABLE_FLAG_* macros below.
|
||||
// See MutableFlags below for definitions. This is stored
|
||||
// as uint32_t instead of bitfields to make it more predictable to access
|
||||
// from JIT code.
|
||||
uint32_t mutableFlags_ = 0;
|
||||
ImmutableScriptFlags immutableScriptFlags_;
|
||||
// Mutable flags typically store information about runtime or deoptimization
|
||||
// behavior of this script. This is only public for the JITs.
|
||||
//
|
||||
// Specific accessors for flag values are defined with
|
||||
// MUTABLE_FLAG_* macros below.
|
||||
MutableScriptFlags mutableFlags_;
|
||||
|
||||
ScriptWarmUpData warmUpData_ = {};
|
||||
|
||||
|
@ -2080,84 +2083,6 @@ class BaseScript : public gc::TenuredCell {
|
|||
}
|
||||
|
||||
public:
|
||||
// Mutable flags typically store information about runtime or deoptimization
|
||||
// behavior of this script. This is only public for the JITs.
|
||||
//
|
||||
// Specific accessors for flag values are defined with
|
||||
// MUTABLE_FLAG_* macros below.
|
||||
enum class MutableFlags : uint32_t {
|
||||
// Number of times the |warmUpCount| was forcibly discarded. The counter is
|
||||
// reset when a script is successfully jit-compiled.
|
||||
WarmupResets_MASK = 0xFF,
|
||||
|
||||
// Have warned about uses of undefined properties in this script.
|
||||
WarnedAboutUndefinedProp = 1 << 8,
|
||||
|
||||
// If treatAsRunOnce, whether script has executed.
|
||||
HasRunOnce = 1 << 9,
|
||||
|
||||
// Script has been reused for a clone.
|
||||
HasBeenCloned = 1 << 10,
|
||||
|
||||
// Whether the record/replay execution progress counter (see RecordReplay.h)
|
||||
// should be updated as this script runs.
|
||||
TrackRecordReplayProgress = 1 << 11,
|
||||
|
||||
// Script has an entry in Realm::scriptCountsMap.
|
||||
HasScriptCounts = 1 << 12,
|
||||
|
||||
// Script has an entry in Realm::debugScriptMap.
|
||||
HasDebugScript = 1 << 13,
|
||||
|
||||
// Do not relazify this script. This is used by the relazify() testing
|
||||
// function for scripts that are on the stack and also by the AutoDelazify
|
||||
// RAII class. Usually we don't relazify functions in compartments with
|
||||
// scripts on the stack, but the relazify() testing function overrides that,
|
||||
// and sometimes we're working with a cross-compartment function and need to
|
||||
// keep it from relazifying.
|
||||
DoNotRelazify = 1 << 14,
|
||||
|
||||
// IonMonkey compilation hints.
|
||||
|
||||
// Script has had hoisted bounds checks fail.
|
||||
FailedBoundsCheck = 1 << 15,
|
||||
|
||||
// Script has had hoisted shape guard fail.
|
||||
FailedShapeGuard = 1 << 16,
|
||||
|
||||
HadFrequentBailouts = 1 << 17,
|
||||
HadOverflowBailout = 1 << 18,
|
||||
|
||||
// Whether Baseline or Ion compilation has been disabled for this script.
|
||||
// IonDisabled is equivalent to |jitScript->canIonCompile() == false| but
|
||||
// JitScript can be discarded on GC and we don't want this to affect
|
||||
// observable behavior (see ArgumentsGetterImpl comment).
|
||||
BaselineDisabled = 1 << 19,
|
||||
IonDisabled = 1 << 20,
|
||||
|
||||
// Explicitly marked as uninlineable.
|
||||
Uninlineable = 1 << 21,
|
||||
|
||||
// Idempotent cache has triggered invalidation.
|
||||
InvalidatedIdempotentCache = 1 << 22,
|
||||
|
||||
// Lexical check did fail and bail out.
|
||||
FailedLexicalCheck = 1 << 23,
|
||||
|
||||
// See comments below.
|
||||
NeedsArgsAnalysis = 1 << 24,
|
||||
NeedsArgsObj = 1 << 25,
|
||||
|
||||
// Set if the debugger's onNewScript hook has not yet been called.
|
||||
HideScriptFromDebugger = 1 << 26,
|
||||
|
||||
// Set if the script has opted into spew
|
||||
SpewEnabled = 1 << 27,
|
||||
|
||||
// Set for LazyScripts which have been wrapped by some Debugger.
|
||||
WrappedByDebugger = 1 << 28,
|
||||
};
|
||||
|
||||
uint8_t* jitCodeRaw() const { return jitCodeRaw_; }
|
||||
|
||||
// Canonical function for the script, if it has a function. For global and
|
||||
|
@ -2257,10 +2182,10 @@ class BaseScript : public gc::TenuredCell {
|
|||
|
||||
// MutableFlags accessors.
|
||||
MOZ_MUST_USE bool hasFlag(MutableFlags flag) const {
|
||||
return mutableFlags_ & uint32_t(flag);
|
||||
return mutableFlags_.hasFlag(flag);
|
||||
}
|
||||
void setFlag(MutableFlags flag) { mutableFlags_ |= uint32_t(flag); }
|
||||
void clearFlag(MutableFlags flag) { mutableFlags_ &= ~uint32_t(flag); }
|
||||
void setFlag(MutableFlags flag) { mutableFlags_.setFlag(flag); }
|
||||
void clearFlag(MutableFlags flag) { mutableFlags_.clearFlag(flag); }
|
||||
|
||||
// Specific flag accessors
|
||||
|
||||
|
|
|
@ -153,6 +153,101 @@ class ImmutableScriptFlags : public ScriptFlagBase<ImmutableScriptFlagsEnum> {
|
|||
void operator=(uint32_t flag) { flags_ = flag; }
|
||||
};
|
||||
|
||||
enum class MutableScriptFlagsEnum : uint32_t {
|
||||
// Number of times the |warmUpCount| was forcibly discarded. The counter is
|
||||
// reset when a script is successfully jit-compiled.
|
||||
WarmupResets_MASK = 0xFF,
|
||||
|
||||
// Have warned about uses of undefined properties in this script.
|
||||
WarnedAboutUndefinedProp = 1 << 8,
|
||||
|
||||
// If treatAsRunOnce, whether script has executed.
|
||||
HasRunOnce = 1 << 9,
|
||||
|
||||
// Script has been reused for a clone.
|
||||
HasBeenCloned = 1 << 10,
|
||||
|
||||
// Whether the record/replay execution progress counter (see RecordReplay.h)
|
||||
// should be updated as this script runs.
|
||||
TrackRecordReplayProgress = 1 << 11,
|
||||
|
||||
// Script has an entry in Realm::scriptCountsMap.
|
||||
HasScriptCounts = 1 << 12,
|
||||
|
||||
// Script has an entry in Realm::debugScriptMap.
|
||||
HasDebugScript = 1 << 13,
|
||||
|
||||
// Do not relazify this script. This is used by the relazify() testing
|
||||
// function for scripts that are on the stack and also by the AutoDelazify
|
||||
// RAII class. Usually we don't relazify functions in compartments with
|
||||
// scripts on the stack, but the relazify() testing function overrides that,
|
||||
// and sometimes we're working with a cross-compartment function and need to
|
||||
// keep it from relazifying.
|
||||
DoNotRelazify = 1 << 14,
|
||||
|
||||
// IonMonkey compilation hints.
|
||||
|
||||
// Script has had hoisted bounds checks fail.
|
||||
FailedBoundsCheck = 1 << 15,
|
||||
|
||||
// Script has had hoisted shape guard fail.
|
||||
FailedShapeGuard = 1 << 16,
|
||||
|
||||
HadFrequentBailouts = 1 << 17,
|
||||
HadOverflowBailout = 1 << 18,
|
||||
|
||||
// Whether Baseline or Ion compilation has been disabled for this script.
|
||||
// IonDisabled is equivalent to |jitScript->canIonCompile() == false| but
|
||||
// JitScript can be discarded on GC and we don't want this to affect
|
||||
// observable behavior (see ArgumentsGetterImpl comment).
|
||||
BaselineDisabled = 1 << 19,
|
||||
IonDisabled = 1 << 20,
|
||||
|
||||
// Explicitly marked as uninlineable.
|
||||
Uninlineable = 1 << 21,
|
||||
|
||||
// Idempotent cache has triggered invalidation.
|
||||
InvalidatedIdempotentCache = 1 << 22,
|
||||
|
||||
// Lexical check did fail and bail out.
|
||||
FailedLexicalCheck = 1 << 23,
|
||||
|
||||
// See comments below.
|
||||
NeedsArgsAnalysis = 1 << 24,
|
||||
NeedsArgsObj = 1 << 25,
|
||||
|
||||
// Set if the debugger's onNewScript hook has not yet been called.
|
||||
HideScriptFromDebugger = 1 << 26,
|
||||
|
||||
// Set if the script has opted into spew
|
||||
SpewEnabled = 1 << 27,
|
||||
|
||||
// Set for LazyScripts which have been wrapped by some Debugger.
|
||||
WrappedByDebugger = 1 << 28,
|
||||
};
|
||||
|
||||
class MutableScriptFlags : public ScriptFlagBase<MutableScriptFlagsEnum> {
|
||||
public:
|
||||
MutableScriptFlags() = default;
|
||||
|
||||
void static_asserts() {
|
||||
static_assert(sizeof(MutableScriptFlags) == sizeof(flags_),
|
||||
"No extra members allowed");
|
||||
static_assert(offsetof(MutableScriptFlags, flags_) == 0,
|
||||
"Required for JIT flag access");
|
||||
}
|
||||
|
||||
MutableScriptFlags& operator&=(const uint32_t rhs) {
|
||||
flags_ &= rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MutableScriptFlags& operator|=(const uint32_t rhs) {
|
||||
flags_ |= rhs;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif /* vm_SharedStencil_h */
|
||||
|
|
Загрузка…
Ссылка в новой задаче