summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/ExecutionCounter.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/bytecode/ExecutionCounter.h')
-rw-r--r--Source/JavaScriptCore/bytecode/ExecutionCounter.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/bytecode/ExecutionCounter.h b/Source/JavaScriptCore/bytecode/ExecutionCounter.h
index 1c0d23f0f..f40650a31 100644
--- a/Source/JavaScriptCore/bytecode/ExecutionCounter.h
+++ b/Source/JavaScriptCore/bytecode/ExecutionCounter.h
@@ -26,6 +26,8 @@
#ifndef ExecutionCounter_h
#define ExecutionCounter_h
+#include "JSGlobalObject.h"
+#include "Options.h"
#include <wtf/SimpleStats.h>
namespace JSC {
@@ -42,6 +44,18 @@ public:
const char* status() const;
static double applyMemoryUsageHeuristics(int32_t value, CodeBlock*);
static int32_t applyMemoryUsageHeuristicsAndConvertToInt(int32_t value, CodeBlock*);
+ template<typename T>
+ static T clippedThreshold(JSGlobalObject* globalObject, T threshold)
+ {
+ int32_t maxThreshold;
+ if (Options::randomizeExecutionCountsBetweenCheckpoints())
+ maxThreshold = globalObject->weakRandomInteger() % Options::maximumExecutionCountsBetweenCheckpoints();
+ else
+ maxThreshold = Options::maximumExecutionCountsBetweenCheckpoints();
+ if (threshold > maxThreshold)
+ threshold = maxThreshold;
+ return threshold;
+ }
static int32_t formattedTotalCount(float value)
{