Bug 1567388 part 1 - Move ionCompiledOrInlined flag from BaselineScript to JitScript. r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D39166

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-07-26 10:10:51 +00:00
Родитель cc71a043f6
Коммит e9bbf59980
4 изменённых файлов: 22 добавлений и 25 удалений

Просмотреть файл

@ -321,15 +321,10 @@ void Zone::discardJitCode(FreeOp* fop,
jit::FinishInvalidation(fop, script);
// Discard baseline script if it's not marked as active.
if (discardBaselineCode && script->hasBaselineScript()) {
if (script->jitScript()->active()) {
// ICs will be purged so the script will need to warm back up before it
// can be inlined during Ion compilation.
script->baselineScript()->clearIonCompiledOrInlined();
} else {
if (discardBaselineCode && script->hasBaselineScript() &&
!script->jitScript()->active()) {
jit::FinishDiscardBaselineScript(fop, script);
}
}
// Warm-up counter for scripts are reset on GC. After discarding code we
// need to let it warm back up to get information such as which
@ -354,6 +349,10 @@ void Zone::discardJitCode(FreeOp* fop,
// stubs because the optimizedStubSpace will be purged below.
if (discardBaselineCode) {
jitScript->purgeOptimizedStubs(script);
// ICs were purged so the script will need to warm back up before it can
// be inlined during Ion compilation.
jitScript->clearIonCompiledOrInlined();
}
// Finally, reset the active flag.

Просмотреть файл

@ -266,28 +266,21 @@ struct BaselineScript final {
public:
enum Flag {
// (1 << 0) and (1 << 1) are unused.
// Flag set when the script contains any writes to its on-stack
// (rather than call object stored) arguments.
MODIFIES_ARGUMENTS = 1 << 2,
MODIFIES_ARGUMENTS = 1 << 0,
// Flag set when compiled for use with Debugger. Handles various
// Debugger hooks and compiles toggled calls for traps.
HAS_DEBUG_INSTRUMENTATION = 1 << 3,
// Flag set if this script has ever been Ion compiled, either directly
// or inlined into another script. This is cleared when the script's
// type information or caches are cleared.
ION_COMPILED_OR_INLINED = 1 << 4,
HAS_DEBUG_INSTRUMENTATION = 1 << 1,
// Flag is set if this script has profiling instrumentation turned on.
PROFILER_INSTRUMENTATION_ON = 1 << 5,
PROFILER_INSTRUMENTATION_ON = 1 << 2,
// Whether this script uses its environment chain. This is currently
// determined by the BytecodeAnalysis and cached on the BaselineScript
// for IonBuilder.
USES_ENVIRONMENT_CHAIN = 1 << 6,
USES_ENVIRONMENT_CHAIN = 1 << 3,
};
private:
@ -339,10 +332,6 @@ struct BaselineScript final {
return flags_ & HAS_DEBUG_INSTRUMENTATION;
}
void setIonCompiledOrInlined() { flags_ |= ION_COMPILED_OR_INLINED; }
void clearIonCompiledOrInlined() { flags_ &= ~ION_COMPILED_OR_INLINED; }
bool ionCompiledOrInlined() const { return flags_ & ION_COMPILED_OR_INLINED; }
void setUsesEnvironmentChain() { flags_ |= USES_ENVIRONMENT_CHAIN; }
bool usesEnvironmentChain() const { return flags_ & USES_ENVIRONMENT_CHAIN; }

Просмотреть файл

@ -182,7 +182,7 @@ IonBuilder::IonBuilder(JSContext* analysisContext, CompileRealm* realm,
MOZ_ASSERT(script_->numBytecodeTypeSets() < JSScript::MaxBytecodeTypeSets);
if (!info->isAnalysis()) {
script()->baselineScript()->setIonCompiledOrInlined();
script()->jitScript()->setIonCompiledOrInlined();
}
}
@ -4352,7 +4352,7 @@ IonBuilder::InliningDecision IonBuilder::makeInliningDecision(
// as the caller has not run yet.
if (targetScript->getWarmUpCount() <
optimizationInfo().inliningWarmUpThreshold() &&
!targetScript->baselineScript()->ionCompiledOrInlined() &&
!targetScript->jitScript()->ionCompiledOrInlined() &&
info().analysisMode() != Analysis_DefiniteProperties) {
trackOptimizationOutcome(TrackedOutcome::CantInlineNotHot);
JitSpew(JitSpew_Inlining,

Просмотреть файл

@ -132,6 +132,11 @@ class alignas(uintptr_t) JitScript final {
// Whether freeze constraints for stack type sets have been generated.
bool hasFreezeConstraints : 1;
// Flag set if this script has ever been Ion compiled, either directly or
// inlined into another script. This is cleared when the script's type
// information or caches are cleared.
bool ionCompiledOrInlined : 1;
};
Flags flags_ = {}; // Zero-initialize flags.
@ -179,6 +184,10 @@ class alignas(uintptr_t) JitScript final {
inline bool typesNeedsSweep(Zone* zone) const;
void sweepTypes(const js::AutoSweepJitScript& sweep, Zone* zone);
void setIonCompiledOrInlined() { flags_.ionCompiledOrInlined = true; }
void clearIonCompiledOrInlined() { flags_.ionCompiledOrInlined = false; }
bool ionCompiledOrInlined() const { return flags_.ionCompiledOrInlined; }
RecompileInfoVector& inlinedCompilations(
const js::AutoSweepJitScript& sweep) {
MOZ_ASSERT(sweep.jitScript() == this);