+static void scaleJITPolicy()
+{
+ auto& scaleFactor = Options::jitPolicyScale();
+ if (scaleFactor > 1.0)
+ scaleFactor = 1.0;
+ else if (scaleFactor < 0.0)
+ scaleFactor = 0.0;
+
+ struct OptionToScale {
+ Options::OptionID id;
+ int32_t minVal;
+ };
+
+ static const OptionToScale optionsToScale[] = {
+ { Options::thresholdForJITAfterWarmUpID, 0 },
+ { Options::thresholdForJITSoonID, 0 },
+ { Options::thresholdForOptimizeAfterWarmUpID, 1 },
+ { Options::thresholdForOptimizeAfterLongWarmUpID, 1 },
+ { Options::thresholdForOptimizeSoonID, 1 },
+ { Options::thresholdForFTLOptimizeSoonID, 2 },
+ { Options::thresholdForFTLOptimizeAfterWarmUpID, 2 }
+ };
+
+ const int numberOfOptionsToScale = sizeof(optionsToScale) / sizeof(OptionToScale);
+ for (int i = 0; i < numberOfOptionsToScale; i++) {
+ Option option(optionsToScale[i].id);
+ ASSERT(option.type() == Options::Type::int32Type);
+ option.int32Val() *= scaleFactor;
+ option.int32Val() = std::max(option.int32Val(), optionsToScale[i].minVal);
+ }
+}
+