зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1229338: Make OptimizationLevel an enum class; r=Waldo
--HG-- extra : rebase_source : 2c4d48233965cbf0d65fccffd2d8497acc5f44cf extra : histedit_source : 323d28acc01c987b6495232fb8bc1d276f1233fe
This commit is contained in:
Родитель
7cbc3ab55d
Коммит
d6727ad6fb
|
@ -2946,7 +2946,7 @@ wasm::CompileFunction(CompileTask* task)
|
|||
MIRGraph graph(&results.alloc());
|
||||
CompileInfo compileInfo(func.numLocals());
|
||||
MIRGenerator mir(nullptr, options, &results.alloc(), &graph, &compileInfo,
|
||||
IonOptimizations.get(Optimization_AsmJS),
|
||||
IonOptimizations.get(OptimizationLevel::AsmJS),
|
||||
args.usesSignalHandlersForOOB);
|
||||
|
||||
// Build MIR graph
|
||||
|
|
|
@ -2108,7 +2108,7 @@ IonCompile(JSContext* cx, JSScript* script,
|
|||
AutoTraceLog logScript(logger, event);
|
||||
AutoTraceLog logCompile(logger, TraceLogger_IonCompilation);
|
||||
|
||||
MOZ_ASSERT(optimizationLevel > Optimization_DontCompile);
|
||||
MOZ_ASSERT(optimizationLevel != OptimizationLevel::DontCompile);
|
||||
|
||||
// Make sure the script's canonical function isn't lazy. We can't de-lazify
|
||||
// it in a helper thread.
|
||||
|
@ -2396,7 +2396,7 @@ Compile(JSContext* cx, HandleScript script, BaselineFrame* osrFrame, jsbytecode*
|
|||
|
||||
bool recompile = false;
|
||||
OptimizationLevel optimizationLevel = GetOptimizationLevel(script, osrPc);
|
||||
if (optimizationLevel == Optimization_DontCompile)
|
||||
if (optimizationLevel == OptimizationLevel::DontCompile)
|
||||
return Method_Skipped;
|
||||
|
||||
if (script->hasIonScript()) {
|
||||
|
|
|
@ -3683,7 +3683,7 @@ jit::AnalyzeNewScriptDefiniteProperties(JSContext* cx, JSFunction* fun,
|
|||
script->needsArgsObj(),
|
||||
inlineScriptTree);
|
||||
|
||||
const OptimizationInfo* optimizationInfo = IonOptimizations.get(Optimization_Normal);
|
||||
const OptimizationInfo* optimizationInfo = IonOptimizations.get(OptimizationLevel::Normal);
|
||||
|
||||
CompilerConstraintList* constraints = NewCompilerConstraintList(temp);
|
||||
if (!constraints) {
|
||||
|
@ -3904,7 +3904,7 @@ jit::AnalyzeArgumentsUsage(JSContext* cx, JSScript* scriptArg)
|
|||
/* needsArgsObj = */ true,
|
||||
inlineScriptTree);
|
||||
|
||||
const OptimizationInfo* optimizationInfo = IonOptimizations.get(Optimization_Normal);
|
||||
const OptimizationInfo* optimizationInfo = IonOptimizations.get(OptimizationLevel::Normal);
|
||||
|
||||
CompilerConstraintList* constraints = NewCompilerConstraintList(temp);
|
||||
if (!constraints) {
|
||||
|
|
|
@ -21,7 +21,7 @@ OptimizationInfos IonOptimizations;
|
|||
void
|
||||
OptimizationInfo::initNormalOptimizationInfo()
|
||||
{
|
||||
level_ = Optimization_Normal;
|
||||
level_ = OptimizationLevel::Normal;
|
||||
|
||||
eaa_ = true;
|
||||
edgeCaseAnalysis_ = true;
|
||||
|
@ -62,7 +62,7 @@ OptimizationInfo::initAsmjsOptimizationInfo()
|
|||
initNormalOptimizationInfo();
|
||||
|
||||
ama_ = true;
|
||||
level_ = Optimization_AsmJS;
|
||||
level_ = OptimizationLevel::AsmJS;
|
||||
eagerSimdUnbox_ = false; // AsmJS has no boxing / unboxing.
|
||||
edgeCaseAnalysis_ = false;
|
||||
eliminateRedundantChecks_ = false;
|
||||
|
@ -110,14 +110,14 @@ OptimizationInfo::compilerWarmUpThreshold(JSScript* script, jsbytecode* pc) cons
|
|||
|
||||
OptimizationInfos::OptimizationInfos()
|
||||
{
|
||||
infos_[Optimization_Normal - 1].initNormalOptimizationInfo();
|
||||
infos_[Optimization_AsmJS - 1].initAsmjsOptimizationInfo();
|
||||
infos_[OptimizationLevel::Normal].initNormalOptimizationInfo();
|
||||
infos_[OptimizationLevel::AsmJS].initAsmjsOptimizationInfo();
|
||||
|
||||
#ifdef DEBUG
|
||||
OptimizationLevel level = firstLevel();
|
||||
while (!isLastLevel(level)) {
|
||||
OptimizationLevel next = nextLevel(level);
|
||||
MOZ_ASSERT(level < next);
|
||||
MOZ_ASSERT_IF(level != OptimizationLevel::DontCompile, level < next);
|
||||
level = next;
|
||||
}
|
||||
#endif
|
||||
|
@ -128,29 +128,31 @@ OptimizationInfos::nextLevel(OptimizationLevel level) const
|
|||
{
|
||||
MOZ_ASSERT(!isLastLevel(level));
|
||||
switch (level) {
|
||||
case Optimization_DontCompile:
|
||||
return Optimization_Normal;
|
||||
default:
|
||||
MOZ_CRASH("Unknown optimization level.");
|
||||
case OptimizationLevel::DontCompile:
|
||||
return OptimizationLevel::Normal;
|
||||
case OptimizationLevel::Normal:
|
||||
case OptimizationLevel::AsmJS:
|
||||
case OptimizationLevel::Count:;
|
||||
}
|
||||
MOZ_CRASH("Unknown optimization level.");
|
||||
}
|
||||
|
||||
OptimizationLevel
|
||||
OptimizationInfos::firstLevel() const
|
||||
{
|
||||
return nextLevel(Optimization_DontCompile);
|
||||
return nextLevel(OptimizationLevel::DontCompile);
|
||||
}
|
||||
|
||||
bool
|
||||
OptimizationInfos::isLastLevel(OptimizationLevel level) const
|
||||
{
|
||||
return level == Optimization_Normal;
|
||||
return level == OptimizationLevel::Normal;
|
||||
}
|
||||
|
||||
OptimizationLevel
|
||||
OptimizationInfos::levelForScript(JSScript* script, jsbytecode* pc) const
|
||||
{
|
||||
OptimizationLevel prev = Optimization_DontCompile;
|
||||
OptimizationLevel prev = OptimizationLevel::DontCompile;
|
||||
|
||||
while (!isLastLevel(prev)) {
|
||||
OptimizationLevel level = nextLevel(prev);
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#ifndef jit_IonOptimizationLevels_h
|
||||
#define jit_IonOptimizationLevels_h
|
||||
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
|
||||
#include "jsbytecode.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
|
@ -16,12 +18,12 @@
|
|||
namespace js {
|
||||
namespace jit {
|
||||
|
||||
enum OptimizationLevel
|
||||
enum class OptimizationLevel : uint8_t
|
||||
{
|
||||
Optimization_DontCompile,
|
||||
Optimization_Normal,
|
||||
Optimization_AsmJS,
|
||||
Optimization_Count
|
||||
Normal,
|
||||
AsmJS,
|
||||
Count,
|
||||
DontCompile
|
||||
};
|
||||
|
||||
#ifdef JS_JITSPEW
|
||||
|
@ -29,15 +31,15 @@ inline const char*
|
|||
OptimizationLevelString(OptimizationLevel level)
|
||||
{
|
||||
switch (level) {
|
||||
case Optimization_DontCompile:
|
||||
case OptimizationLevel::DontCompile:
|
||||
return "Optimization_DontCompile";
|
||||
case Optimization_Normal:
|
||||
case OptimizationLevel::Normal:
|
||||
return "Optimization_Normal";
|
||||
case Optimization_AsmJS:
|
||||
case OptimizationLevel::AsmJS:
|
||||
return "Optimization_AsmJS";
|
||||
default:
|
||||
MOZ_CRASH("Invalid OptimizationLevel");
|
||||
case OptimizationLevel::Count:;
|
||||
}
|
||||
MOZ_CRASH("Invalid OptimizationLevel");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -266,16 +268,13 @@ class OptimizationInfo
|
|||
class OptimizationInfos
|
||||
{
|
||||
private:
|
||||
OptimizationInfo infos_[Optimization_Count - 1];
|
||||
mozilla::EnumeratedArray<OptimizationLevel, OptimizationLevel::Count, OptimizationInfo> infos_;
|
||||
|
||||
public:
|
||||
OptimizationInfos();
|
||||
|
||||
const OptimizationInfo* get(OptimizationLevel level) const {
|
||||
MOZ_ASSERT(level < Optimization_Count);
|
||||
MOZ_ASSERT(level != Optimization_DontCompile);
|
||||
|
||||
return &infos_[level - 1];
|
||||
return &infos_[level];
|
||||
}
|
||||
|
||||
OptimizationLevel nextLevel(OptimizationLevel level) const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче