WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Further refactor of Options.{h,cpp}
macrology.patch (text/plain), 11.53 KB, created by
Andy Wingo
on 2011-11-22 03:25:51 PST
(
hide
)
Description:
Further refactor of Options.{h,cpp}
Filename:
MIME Type:
Creator:
Andy Wingo
Created:
2011-11-22 03:25:51 PST
Size:
11.53 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 2f2a027..e5d21cc 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,5 +1,17 @@ > 2011-11-22 Andy Wingo <wingo@igalia.com> > >+ Use more macrology in JSC::Options >+ https://bugs.webkit.org/show_bug.cgi?id=72889 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * runtime/Options.cpp: >+ (JSC::Options::initializeOptions): >+ * runtime/Options.h: Use macros to ensure that all heuristics are >+ declared and have initializers. >+ >+2011-11-22 Andy Wingo <wingo@igalia.com> >+ > Rename JSC::Heuristics to JSC::Options > https://bugs.webkit.org/show_bug.cgi?id=72889 > >diff --git a/Source/JavaScriptCore/runtime/Options.cpp b/Source/JavaScriptCore/runtime/Options.cpp >index a00db9c..5f6c9b3 100644 >--- a/Source/JavaScriptCore/runtime/Options.cpp >+++ b/Source/JavaScriptCore/runtime/Options.cpp >@@ -44,48 +44,9 @@ > > namespace JSC { namespace Options { > >-unsigned maximumEvalOptimizationCandidateInstructionCount; >-unsigned maximumProgramOptimizationCandidateInstructionCount; >-unsigned maximumFunctionForCallOptimizationCandidateInstructionCount; >-unsigned maximumFunctionForConstructOptimizationCandidateInstructionCount; >- >-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; >- >-unsigned likelyToTakeSlowCaseThreshold; >-unsigned couldTakeSlowCaseThreshold; >- >-unsigned largeFailCountThresholdBase; >-unsigned largeFailCountThresholdBaseForLoop; >- >-unsigned reoptimizationRetryCounterMax; >-unsigned reoptimizationRetryCounterStep; >- >-unsigned minimumOptimizationDelay; >-unsigned maximumOptimizationDelay; >-double desiredProfileLivenessRate; >-double desiredProfileFullnessRate; >- >-unsigned minimumNumberOfScansBetweenRebalance; >-unsigned gcMarkStackSegmentSize; >-unsigned minimumNumberOfCellsToKeep; >-unsigned maximumNumberOfSharedSegments; >-unsigned sharedStackWakeupThreshold; >-unsigned numberOfGCMarkers; >-unsigned opaqueRootMergeThreshold; >+#define DEFINE(type, cname, default_val) type cname; >+FOR_EACH_HEURISTIC(DEFINE) >+#undef DEFINE > > #if ENABLE(RUN_TIME_HEURISTICS) > static bool parse(const char* string, int32_t& value) >@@ -126,67 +87,35 @@ void setHeuristic(T& variable, const char* name, U value) > > void initializeOptions() > { >- // FIXME: Must revisit these heuristics! The DFG, being an optimizing compiler, may >- // take a long time for pathologically huge code blocks. The best way to cope with >- // this is to refuse to optimize them. >- SET(maximumEvalOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()); >- SET(maximumProgramOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()); >- SET(maximumFunctionForCallOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()); >- SET(maximumFunctionForConstructOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()); >- >- SET(maximumFunctionForCallInlineCandidateInstructionCount, 150); >- SET(maximumFunctionForConstructInlineCandidateInstructionCount, 80); >- >- SET(maximumInliningDepth, 5); >- >- SET(executionCounterValueForOptimizeAfterWarmUp, -1000); >- SET(executionCounterValueForOptimizeAfterLongWarmUp, -5000); >- SET(executionCounterValueForDontOptimizeAnytimeSoon, std::numeric_limits<int32_t>::min()); >- SET(executionCounterValueForOptimizeSoon, -1000); >- SET(executionCounterValueForOptimizeNextInvocation, 0); >+#define INIT(type, cname, default_val) SET(cname, default_val); >+ FOR_EACH_HEURISTIC(INIT) >+#undef INIT > >- SET(executionCounterIncrementForLoop, 1); >- SET(executionCounterIncrementForReturn, 15); >- >- SET(desiredSpeculativeSuccessFailRatio, 6); >- >- SET(likelyToTakeSlowCaseThreshold, 100); >- SET(couldTakeSlowCaseThreshold, 10); // Shouldn't be zero because some ops will spuriously take slow case, for example for linking or caching. >+ // Now we initialize heuristics whose defaults are not known at >+ // compile-time. > >- SET(largeFailCountThresholdBase, 20); >- SET(largeFailCountThresholdBaseForLoop, 1); >+ if (!gcMarkStackSegmentSize) >+ gcMarkStackSegmentSize = pageSize(); > >- SET(reoptimizationRetryCounterStep, 1); >- >- SET(minimumOptimizationDelay, 1); >- SET(maximumOptimizationDelay, 5); >- SET(desiredProfileLivenessRate, 0.75); >- SET(desiredProfileFullnessRate, 0.35); >- >- SET(minimumNumberOfScansBetweenRebalance, 10000); >- SET(gcMarkStackSegmentSize, pageSize()); >- SET(minimumNumberOfCellsToKeep, 10); >- SET(maximumNumberOfSharedSegments, 3); >- SET(sharedStackWakeupThreshold, 1); >- SET(opaqueRootMergeThreshold, 1000); >- >- int cpusToUse = 1; >+ if (!numberOfGCMarkers) { >+ 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; >+ >+ numberOfGCMarkers = cpusToUse; >+ } > >- SET(numberOfGCMarkers, cpusToUse); >- > ASSERT(executionCounterValueForDontOptimizeAnytimeSoon <= executionCounterValueForOptimizeAfterLongWarmUp); > ASSERT(executionCounterValueForOptimizeAfterLongWarmUp <= executionCounterValueForOptimizeAfterWarmUp); > ASSERT(executionCounterValueForOptimizeAfterWarmUp <= executionCounterValueForOptimizeSoon); >diff --git a/Source/JavaScriptCore/runtime/Options.h b/Source/JavaScriptCore/runtime/Options.h >index 109b392..3ba3b01 100644 >--- a/Source/JavaScriptCore/runtime/Options.h >+++ b/Source/JavaScriptCore/runtime/Options.h >@@ -30,48 +30,64 @@ > > namespace JSC { namespace Options { > >-extern unsigned maximumEvalOptimizationCandidateInstructionCount; >-extern unsigned maximumProgramOptimizationCandidateInstructionCount; >-extern unsigned maximumFunctionForCallOptimizationCandidateInstructionCount; >-extern unsigned maximumFunctionForConstructOptimizationCandidateInstructionCount; >+// FIXME: Must revisit the maximum instruction counts! The DFG, being an >+// optimizing compiler, may take a long time for pathologically huge code >+// blocks. The best way to cope with this is to refuse to optimize them. >+ >+// maximumInliningDepth is the maximum depth of inline stack, so 1 = no >+// inlining, 2 = one level, etc >+ >+// couldTakeSlowCaseThreshold shouldn't be zero because some ops will spuriously >+// take slow case, for example for linking or caching. >+ >+#define FOR_EACH_HEURISTIC(m) \ >+ m(unsigned, maximumEvalOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()) \ >+ m(unsigned, maximumProgramOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()) \ >+ m(unsigned, maximumFunctionForCallOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()) \ >+ m(unsigned, maximumFunctionForConstructOptimizationCandidateInstructionCount, std::numeric_limits<unsigned>::max()) \ >+ \ >+ 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(unsigned, likelyToTakeSlowCaseThreshold, 100) \ >+ m(unsigned, couldTakeSlowCaseThreshold, 10) \ >+ \ >+ m(unsigned, largeFailCountThresholdBase, 20) \ >+ m(unsigned, largeFailCountThresholdBaseForLoop, 1) \ >+ \ >+ m(unsigned, reoptimizationRetryCounterMax, 0) \ >+ m(unsigned, reoptimizationRetryCounterStep, 1) \ >+ \ >+ m(unsigned, minimumOptimizationDelay, 0.75) \ >+ m(unsigned, maximumOptimizationDelay, 0.35) \ >+ m(double, desiredProfileLivenessRate, 10000) \ >+ m(double, desiredProfileFullnessRate, 0) \ >+ \ >+ 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) >+ >+#define DECLARE(type, cname, default_val) extern type cname; >+FOR_EACH_HEURISTIC(DECLARE) >+#undef DECLARE > >-extern unsigned maximumFunctionForCallInlineCandidateInstructionCount; >-extern unsigned maximumFunctionForConstructInlineCandidateInstructionCount; >- >-extern unsigned maximumInliningDepth; // Depth of inline stack, so 1 = no inlining, 2 = one level, etc. >- >-extern int32_t executionCounterValueForOptimizeAfterWarmUp; >-extern int32_t executionCounterValueForOptimizeAfterLongWarmUp; >-extern int32_t executionCounterValueForDontOptimizeAnytimeSoon; >-extern int32_t executionCounterValueForOptimizeSoon; >-extern int32_t executionCounterValueForOptimizeNextInvocation; >- >-extern int32_t executionCounterIncrementForLoop; >-extern int32_t executionCounterIncrementForReturn; >- >-extern unsigned desiredSpeculativeSuccessFailRatio; >- >-extern unsigned likelyToTakeSlowCaseThreshold; >-extern unsigned couldTakeSlowCaseThreshold; >- >-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 unsigned minimumNumberOfScansBetweenRebalance; >-extern unsigned gcMarkStackSegmentSize; >-extern unsigned minimumNumberOfCellsToKeep; >-extern unsigned maximumNumberOfSharedSegments; >-extern unsigned sharedStackWakeupThreshold; >-extern unsigned numberOfGCMarkers; >-extern unsigned opaqueRootMergeThreshold; > > void initializeOptions(); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 72889
:
116096
|
116104
|
116193
|
116194
|
116196
|
116496
|
116979
|
118760
|
119194
|
119198
|
119205
|
119211