Bug 1229338: Rename OptimizationInfos to OptimizationLevelInfo; r=Waldo
authorBenjamin Bouvier <benj@benj.me>
Tue, 01 Dec 2015 12:42:04 +0100
changeset 312330 3a5ae2ad1b3d112ae79c5909f4f17cfee47e1153
parent 312329 eb630918efd679213e76bf56bb77f53761305c9c
child 312331 28da91dbe6c5d284bf269276a9bead7901aa6d9b
push id5703
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:18:41 +0000
treeherdermozilla-beta@31e373ad5b5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs1229338
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1229338: Rename OptimizationInfos to OptimizationLevelInfo; r=Waldo
js/src/jit/Ion.cpp
js/src/jit/IonOptimizationLevels.cpp
js/src/jit/IonOptimizationLevels.h
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -2103,18 +2103,16 @@ IonCompile(JSContext* cx, JSScript* scri
            BaselineFrame* baselineFrame, jsbytecode* osrPc, bool constructing,
            bool recompile, OptimizationLevel optimizationLevel)
 {
     TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
     TraceLoggerEvent event(logger, TraceLogger_AnnotateScripts, script);
     AutoTraceLog logScript(logger, event);
     AutoTraceLog logCompile(logger, TraceLogger_IonCompilation);
 
-    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.
     script->ensureNonLazyCanonicalFunction(cx);
 
     TrackPropertiesForSingletonScopes(cx, script, baselineFrame);
 
     LifoAlloc* alloc = cx->new_<LifoAlloc>(TempAllocator::PreferredLifoChunkSize);
     if (!alloc)
--- a/js/src/jit/IonOptimizationLevels.cpp
+++ b/js/src/jit/IonOptimizationLevels.cpp
@@ -11,37 +11,38 @@
 #include "jit/Ion.h"
 
 using namespace js;
 using namespace js::jit;
 
 namespace js {
 namespace jit {
 
-OptimizationInfos IonOptimizations;
+OptimizationLevelInfo IonOptimizations;
 
 void
 OptimizationInfo::initNormalOptimizationInfo()
 {
     level_ = OptimizationLevel::Normal;
 
+    autoTruncate_ = true;
     eaa_ = true;
+    eagerSimdUnbox_ = true;
     edgeCaseAnalysis_ = true;
     eliminateRedundantChecks_ = true;
     inlineInterpreted_ = true;
     inlineNative_ = true;
-    eagerSimdUnbox_ = true;
+    licm_ = true;
+    loopUnrolling_ = true;
     gvn_ = true;
-    licm_ = true;
     rangeAnalysis_ = true;
-    loopUnrolling_ = true;
     reordering_ = true;
-    autoTruncate_ = true;
     sincos_ = true;
     sink_ = true;
+
     registerAllocator_ = RegisterAllocator_Backtracking;
 
     inlineMaxBytecodePerCallSiteMainThread_ = 500;
     inlineMaxBytecodePerCallSiteOffThread_ = 1000;
     inlineMaxCalleeInlinedBytecodeLength_ = 3350;
     inlineMaxTotalBytecodeLength_ = 80000;
     inliningMaxCallerBytecodeLength_ = 1500;
     maxInlineDepth_ = 3;
@@ -56,26 +57,26 @@ void
 OptimizationInfo::initAsmjsOptimizationInfo()
 {
     // The AsmJS optimization level
     // Disables some passes that don't work well with asmjs.
 
     // Take normal option values for not specified values.
     initNormalOptimizationInfo();
 
+    level_ = OptimizationLevel::AsmJS;
+
     ama_ = true;
-    level_ = OptimizationLevel::AsmJS;
+    autoTruncate_ = false;
     eagerSimdUnbox_ = false;           // AsmJS has no boxing / unboxing.
     edgeCaseAnalysis_ = false;
     eliminateRedundantChecks_ = false;
-    autoTruncate_ = false;
+    scalarReplacement_ = false;        // AsmJS has no objects.
     sincos_ = false;
     sink_ = false;
-    registerAllocator_ = RegisterAllocator_Backtracking;
-    scalarReplacement_ = false;        // AsmJS has no objects.
 }
 
 uint32_t
 OptimizationInfo::compilerWarmUpThreshold(JSScript* script, jsbytecode* pc) const
 {
     MOZ_ASSERT(pc == nullptr || pc == script->code() || JSOp(*pc) == JSOP_LOOPENTRY);
 
     if (pc == script->code())
@@ -103,59 +104,59 @@ OptimizationInfo::compilerWarmUpThreshol
     // It's more efficient to enter outer loops, rather than inner loops, via OSR.
     // To accomplish this, we use a slightly higher threshold for inner loops.
     // Note that the loop depth is always > 0 so we will prefer non-OSR over OSR.
     uint32_t loopDepth = LoopEntryDepthHint(pc);
     MOZ_ASSERT(loopDepth > 0);
     return warmUpThreshold + loopDepth * 100;
 }
 
-OptimizationInfos::OptimizationInfos()
+OptimizationLevelInfo::OptimizationLevelInfo()
 {
     infos_[OptimizationLevel::Normal].initNormalOptimizationInfo();
     infos_[OptimizationLevel::AsmJS].initAsmjsOptimizationInfo();
 
 #ifdef DEBUG
     OptimizationLevel level = firstLevel();
     while (!isLastLevel(level)) {
         OptimizationLevel next = nextLevel(level);
         MOZ_ASSERT_IF(level != OptimizationLevel::DontCompile, level < next);
         level = next;
     }
 #endif
 }
 
 OptimizationLevel
-OptimizationInfos::nextLevel(OptimizationLevel level) const
+OptimizationLevelInfo::nextLevel(OptimizationLevel level) const
 {
     MOZ_ASSERT(!isLastLevel(level));
     switch (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
+OptimizationLevelInfo::firstLevel() const
 {
     return nextLevel(OptimizationLevel::DontCompile);
 }
 
 bool
-OptimizationInfos::isLastLevel(OptimizationLevel level) const
+OptimizationLevelInfo::isLastLevel(OptimizationLevel level) const
 {
     return level == OptimizationLevel::Normal;
 }
 
 OptimizationLevel
-OptimizationInfos::levelForScript(JSScript* script, jsbytecode* pc) const
+OptimizationLevelInfo::levelForScript(JSScript* script, jsbytecode* pc) const
 {
     OptimizationLevel prev = OptimizationLevel::DontCompile;
 
     while (!isLastLevel(prev)) {
         OptimizationLevel level = nextLevel(prev);
         const OptimizationInfo* info = get(level);
         if (script->getWarmUpCount() < info->compilerWarmUpThreshold(script, pc))
             return prev;
--- a/js/src/jit/IonOptimizationLevels.h
+++ b/js/src/jit/IonOptimizationLevels.h
@@ -260,32 +260,32 @@ class OptimizationInfo
         return compilerWarmUpThreshold * inliningWarmUpThresholdFactor_;
     }
 
     uint32_t inliningRecompileThreshold() const {
         return inliningWarmUpThreshold() * inliningRecompileThresholdFactor_;
     }
 };
 
-class OptimizationInfos
+class OptimizationLevelInfo
 {
   private:
     mozilla::EnumeratedArray<OptimizationLevel, OptimizationLevel::Count, OptimizationInfo> infos_;
 
   public:
-    OptimizationInfos();
+    OptimizationLevelInfo();
 
     const OptimizationInfo* get(OptimizationLevel level) const {
         return &infos_[level];
     }
 
     OptimizationLevel nextLevel(OptimizationLevel level) const;
     OptimizationLevel firstLevel() const;
     bool isLastLevel(OptimizationLevel level) const;
     OptimizationLevel levelForScript(JSScript* script, jsbytecode* pc = nullptr) const;
 };
 
-extern OptimizationInfos IonOptimizations;
+extern OptimizationLevelInfo IonOptimizations;
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_IonOptimizationLevels_h */