summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/ExecutionCounter.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/bytecode/ExecutionCounter.h
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/bytecode/ExecutionCounter.h')
-rw-r--r--Source/JavaScriptCore/bytecode/ExecutionCounter.h56
1 files changed, 16 insertions, 40 deletions
diff --git a/Source/JavaScriptCore/bytecode/ExecutionCounter.h b/Source/JavaScriptCore/bytecode/ExecutionCounter.h
index 5002c6c67..a7346691d 100644
--- a/Source/JavaScriptCore/bytecode/ExecutionCounter.h
+++ b/Source/JavaScriptCore/bytecode/ExecutionCounter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,25 +35,6 @@ namespace JSC {
class CodeBlock;
-enum CountingVariant {
- CountingForBaseline,
- CountingForUpperTiers
-};
-
-double applyMemoryUsageHeuristics(int32_t value, CodeBlock*);
-int32_t applyMemoryUsageHeuristicsAndConvertToInt(int32_t value, CodeBlock*);
-
-inline int32_t formattedTotalExecutionCount(float value)
-{
- union {
- int32_t i;
- float f;
- } u;
- u.f = value;
- return u.i;
-}
-
-template<CountingVariant countingVariant>
class ExecutionCounter {
public:
ExecutionCounter();
@@ -63,33 +44,31 @@ public:
void deferIndefinitely();
double count() const { return static_cast<double>(m_totalCount) + m_counter; }
void dump(PrintStream&) const;
-
- static int32_t maximumExecutionCountsBetweenCheckpoints()
- {
- switch (countingVariant) {
- case CountingForBaseline:
- return Options::maximumExecutionCountsBetweenCheckpointsForBaseline();
- case CountingForUpperTiers:
- return Options::maximumExecutionCountsBetweenCheckpointsForUpperTiers();
- default:
- RELEASE_ASSERT_NOT_REACHED();
- return 0;
- }
- }
-
+ 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() % maximumExecutionCountsBetweenCheckpoints();
+ maxThreshold = globalObject->weakRandomInteger() % Options::maximumExecutionCountsBetweenCheckpoints();
else
- maxThreshold = maximumExecutionCountsBetweenCheckpoints();
+ maxThreshold = Options::maximumExecutionCountsBetweenCheckpoints();
if (threshold > maxThreshold)
threshold = maxThreshold;
return threshold;
}
+ static int32_t formattedTotalCount(float value)
+ {
+ union {
+ int32_t i;
+ float f;
+ } u;
+ u.f = value;
+ return u.i;
+ }
+
private:
bool hasCrossedThreshold(CodeBlock*) const;
bool setThreshold(CodeBlock*);
@@ -110,14 +89,11 @@ public:
// m_counter.
float m_totalCount;
- // This is the threshold we were originally targeting, without any correction for
+ // This is the threshold we were originally targetting, without any correction for
// the memory usage heuristics.
int32_t m_activeThreshold;
};
-typedef ExecutionCounter<CountingForBaseline> BaselineExecutionCounter;
-typedef ExecutionCounter<CountingForUpperTiers> UpperTierExecutionCounter;
-
} // namespace JSC
#endif // ExecutionCounter_h