Modified: branches/safari-534.54-branch/Source/_javascript_Core/runtime/Options.cpp (104948 => 104949)
--- branches/safari-534.54-branch/Source/_javascript_Core/runtime/Options.cpp 2012-01-13 18:05:41 UTC (rev 104948)
+++ branches/safari-534.54-branch/Source/_javascript_Core/runtime/Options.cpp 2012-01-13 18:26:55 UTC (rev 104949)
@@ -44,10 +44,52 @@
namespace JSC { namespace Options {
-#define DEFINE(type, cname, default_val) type cname;
-FOR_EACH_OPTION(DEFINE)
-#undef DEFINE
+unsigned maximumOptimizationCandidateInstructionCount;
+unsigned maximumFunctionForCallInlineCandidateInstructionCount;
+unsigned maximumFunctionForConstructInlineCandidateInstructionCount;
+
+unsigned maximumInliningDepth;
+
+int32_t executionCounterValueForOptimizeAfterWarmUp;
+int32_t executionCounterValueForOptimizeAfterLongWarmUp;
+int32_t executionCounterValueForDontOptimizeAnytimeSoon;
+int32_t executionCounterValueForOptimizeSoon;
+int32_t executionCounterValueForOptimizeNextInvocation;
+
+int32_t executionCounterIncrementForLoop;
+int32_t executionCounterIncrementForReturn;
+
+unsigned desiredSpeculativeSuccessFailRatio;
+
+double likelyToTakeSlowCaseThreshold;
+double couldTakeSlowCaseThreshold;
+unsigned likelyToTakeSlowCaseMinimumCount;
+unsigned couldTakeSlowCaseMinimumCount;
+
+double osrExitProminenceForFrequentExitSite;
+
+unsigned largeFailCountThresholdBase;
+unsigned largeFailCountThresholdBaseForLoop;
+
+unsigned reoptimizationRetryCounterMax;
+unsigned reoptimizationRetryCounterStep;
+
+unsigned minimumOptimizationDelay;
+unsigned maximumOptimizationDelay;
+double desiredProfileLivenessRate;
+double desiredProfileFullnessRate;
+
+double doubleVoteRatioForDoubleFormat;
+
+unsigned minimumNumberOfScansBetweenRebalance;
+unsigned gcMarkStackSegmentSize;
+unsigned minimumNumberOfCellsToKeep;
+unsigned maximumNumberOfSharedSegments;
+unsigned sharedStackWakeupThreshold;
+unsigned numberOfGCMarkers;
+unsigned opaqueRootMergeThreshold;
+
#if ENABLE(RUN_TIME_HEURISTICS)
static bool parse(const char* string, int32_t& value)
{
@@ -87,35 +129,67 @@
void initializeOptions()
{
-#define INIT(type, cname, default_val) SET(cname, default_val);
- FOR_EACH_OPTION(INIT)
-#undef INIT
+ SET(maximumOptimizationCandidateInstructionCount, 1000);
+
+ SET(maximumFunctionForCallInlineCandidateInstructionCount, 150);
+ SET(maximumFunctionForConstructInlineCandidateInstructionCount, 80);
+
+ SET(maximumInliningDepth, 5);
- // Now we initialize heuristics whose defaults are not known at
- // compile-time.
+ SET(executionCounterValueForOptimizeAfterWarmUp, -1000);
+ SET(executionCounterValueForOptimizeAfterLongWarmUp, -5000);
+ SET(executionCounterValueForDontOptimizeAnytimeSoon, std::numeric_limits<int32_t>::min());
+ SET(executionCounterValueForOptimizeSoon, -1000);
+ SET(executionCounterValueForOptimizeNextInvocation, 0);
- if (!gcMarkStackSegmentSize)
- gcMarkStackSegmentSize = pageSize();
+ SET(executionCounterIncrementForLoop, 1);
+ SET(executionCounterIncrementForReturn, 15);
- if (!numberOfGCMarkers) {
- int cpusToUse = 1;
+ SET(desiredSpeculativeSuccessFailRatio, 6);
+
+ SET(likelyToTakeSlowCaseThreshold, 0.15);
+ SET(couldTakeSlowCaseThreshold, 0.05); // Shouldn't be zero because some ops will spuriously take slow case, for example for linking or caching.
+ SET(likelyToTakeSlowCaseMinimumCount, 100);
+ SET(couldTakeSlowCaseMinimumCount, 10);
+
+ SET(osrExitProminenceForFrequentExitSite, 0.3);
+
+ SET(largeFailCountThresholdBase, 20);
+ SET(largeFailCountThresholdBaseForLoop, 1);
+
+ SET(reoptimizationRetryCounterStep, 1);
+
+ SET(minimumOptimizationDelay, 1);
+ SET(maximumOptimizationDelay, 5);
+ SET(desiredProfileLivenessRate, 0.75);
+ SET(desiredProfileFullnessRate, 0.35);
+
+ SET(doubleVoteRatioForDoubleFormat, 2);
+
+ SET(minimumNumberOfScansBetweenRebalance, 10000);
+ SET(gcMarkStackSegmentSize, pageSize());
+ SET(minimumNumberOfCellsToKeep, 10);
+ SET(maximumNumberOfSharedSegments, 3);
+ SET(sharedStackWakeupThreshold, 1);
+ SET(opaqueRootMergeThreshold, 1000);
+
+ int cpusToUse = 1;
#if OS(DARWIN) && ENABLE(PARALLEL_GC)
- int name[2];
- size_t valueSize = sizeof(cpusToUse);
- name[0] = CTL_HW;
- name[1] = HW_AVAILCPU;
- sysctl(name, 2, &cpusToUse, &valueSize, 0, 0);
+ int name[2];
+ size_t valueSize = sizeof(cpusToUse);
+ name[0] = CTL_HW;
+ name[1] = HW_AVAILCPU;
+ sysctl(name, 2, &cpusToUse, &valueSize, 0, 0);
#endif
- // We don't scale so well beyond 4.
- if (cpusToUse > 4)
- cpusToUse = 4;
- // Be paranoid, it is the OS we're dealing with, after all.
- if (cpusToUse < 1)
- cpusToUse = 1;
+ // We don't scale so well beyond 4.
+ if (cpusToUse > 4)
+ cpusToUse = 4;
+ // Be paranoid, it is the OS we're dealing with, after all.
+ if (cpusToUse < 1)
+ cpusToUse = 1;
+
+ SET(numberOfGCMarkers, cpusToUse);
- numberOfGCMarkers = cpusToUse;
- }
-
ASSERT(executionCounterValueForDontOptimizeAnytimeSoon <= executionCounterValueForOptimizeAfterLongWarmUp);
ASSERT(executionCounterValueForOptimizeAfterLongWarmUp <= executionCounterValueForOptimizeAfterWarmUp);
ASSERT(executionCounterValueForOptimizeAfterWarmUp <= executionCounterValueForOptimizeSoon);
Modified: branches/safari-534.54-branch/Source/_javascript_Core/runtime/Options.h (104948 => 104949)
--- branches/safari-534.54-branch/Source/_javascript_Core/runtime/Options.h 2012-01-13 18:05:41 UTC (rev 104948)
+++ branches/safari-534.54-branch/Source/_javascript_Core/runtime/Options.h 2012-01-13 18:26:55 UTC (rev 104949)
@@ -30,66 +30,52 @@
namespace JSC { namespace Options {
-// maximumInliningDepth is the maximum depth of inline stack, so 1 = no
-// inlining, 2 = one level, etc
+extern unsigned maximumOptimizationCandidateInstructionCount;
-// couldTakeSlowCaseThreshold shouldn't be zero because some ops will spuriously
-// take slow case, for example for linking or caching.
+extern unsigned maximumFunctionForCallInlineCandidateInstructionCount;
+extern unsigned maximumFunctionForConstructInlineCandidateInstructionCount;
-#define FOR_EACH_HEURISTIC(m) \
- m(unsigned, maximumOptimizationCandidateInstructionCount, 1000) \
- \
- m(unsigned, maximumFunctionForCallInlineCandidateInstructionCount, 150) \
- m(unsigned, maximumFunctionForConstructInlineCandidateInstructionCount, 80) \
- \
- m(unsigned, maximumInliningDepth, 5) \
- \
- m(int32_t, executionCounterValueForOptimizeAfterWarmUp, -1000) \
- m(int32_t, executionCounterValueForOptimizeAfterLongWarmUp, -5000) \
- m(int32_t, executionCounterValueForDontOptimizeAnytimeSoon, std::numeric_limits<int32_t>::min()) \
- m(int32_t, executionCounterValueForOptimizeSoon, -1000) \
- m(int32_t, executionCounterValueForOptimizeNextInvocation, 0) \
- \
- m(int32_t, executionCounterIncrementForLoop, 1) \
- m(int32_t, executionCounterIncrementForReturn, 15) \
- \
- m(unsigned, desiredSpeculativeSuccessFailRatio, 6) \
- \
- m(double, likelyToTakeSlowCaseThreshold, 0.15) \
- m(double, couldTakeSlowCaseThreshold, 0.05) \
- m(unsigned, likelyToTakeSlowCaseMinimumCount, 100) \
- m(unsigned, couldTakeSlowCaseMinimumCount, 10) \
- \
- m(double, osrExitProminenceForFrequentExitSite, 0.3) \
- \
- m(unsigned, largeFailCountThresholdBase, 20) \
- m(unsigned, largeFailCountThresholdBaseForLoop, 1) \
- \
- m(unsigned, reoptimizationRetryCounterMax, 0) \
- m(unsigned, reoptimizationRetryCounterStep, 1) \
- \
- m(unsigned, minimumOptimizationDelay, 1) \
- m(unsigned, maximumOptimizationDelay, 5) \
- m(double, desiredProfileLivenessRate, 0.75) \
- m(double, desiredProfileFullnessRate, 0.35) \
- \
- m(double, doubleVoteRatioForDoubleFormat, 2) \
- \
- m(unsigned, minimumNumberOfScansBetweenRebalance, 10000) \
- m(unsigned, gcMarkStackSegmentSize, 0) \
- m(unsigned, minimumNumberOfCellsToKeep, 10) \
- m(unsigned, maximumNumberOfSharedSegments, 3) \
- m(unsigned, sharedStackWakeupThreshold, 1) \
- m(unsigned, numberOfGCMarkers, 0) \
- m(unsigned, opaqueRootMergeThreshold, 1000)
+extern unsigned maximumInliningDepth; // Depth of inline stack, so 1 = no inlining, 2 = one level, etc.
-#define FOR_EACH_OPTION(m) \
- FOR_EACH_HEURISTIC(m)
+extern int32_t executionCounterValueForOptimizeAfterWarmUp;
+extern int32_t executionCounterValueForOptimizeAfterLongWarmUp;
+extern int32_t executionCounterValueForDontOptimizeAnytimeSoon;
+extern int32_t executionCounterValueForOptimizeSoon;
+extern int32_t executionCounterValueForOptimizeNextInvocation;
-#define DECLARE(type, cname, default_val) extern type cname;
-FOR_EACH_OPTION(DECLARE)
-#undef DECLARE
+extern int32_t executionCounterIncrementForLoop;
+extern int32_t executionCounterIncrementForReturn;
+extern unsigned desiredSpeculativeSuccessFailRatio;
+
+extern double likelyToTakeSlowCaseThreshold;
+extern double couldTakeSlowCaseThreshold;
+extern unsigned likelyToTakeSlowCaseMinimumCount;
+extern unsigned couldTakeSlowCaseMinimumCount;
+
+extern double osrExitProminenceForFrequentExitSite;
+
+extern unsigned largeFailCountThresholdBase;
+extern unsigned largeFailCountThresholdBaseForLoop;
+
+extern unsigned reoptimizationRetryCounterMax;
+extern unsigned reoptimizationRetryCounterStep;
+
+extern unsigned minimumOptimizationDelay;
+extern unsigned maximumOptimizationDelay;
+extern double desiredProfileLivenessRate;
+extern double desiredProfileFullnessRate;
+
+extern double doubleVoteRatioForDoubleFormat;
+
+extern unsigned minimumNumberOfScansBetweenRebalance;
+extern unsigned gcMarkStackSegmentSize;
+extern unsigned minimumNumberOfCellsToKeep;
+extern unsigned maximumNumberOfSharedSegments;
+extern unsigned sharedStackWakeupThreshold;
+extern unsigned numberOfGCMarkers;
+extern unsigned opaqueRootMergeThreshold;
+
void initializeOptions();
} } // namespace JSC::Options