diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-27 09:28:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-27 09:28:46 +0200 |
commit | 6668b07fcd51f86be243b9e08e667224e30c0cf8 (patch) | |
tree | 64f466e09b68a77ae1156c0d35cd5b95e18a34ca /Source/JavaScriptCore/bytecode/ExecutionCounter.cpp | |
parent | e7923d9de38974f0c6fb7646c898a6ea618261e8 (diff) | |
download | qtwebkit-6668b07fcd51f86be243b9e08e667224e30c0cf8.tar.gz |
Imported WebKit commit 26cd9bd8ab0471ffe987c9b60368f63dc0f1f31b (http://svn.webkit.org/repository/webkit/trunk@121325)
New snapshot with more Windows build fixes
Diffstat (limited to 'Source/JavaScriptCore/bytecode/ExecutionCounter.cpp')
-rw-r--r-- | Source/JavaScriptCore/bytecode/ExecutionCounter.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp b/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp index ea335005e..1f2e8260a 100644 --- a/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp +++ b/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp @@ -28,6 +28,7 @@ #include "CodeBlock.h" #include "ExecutableAllocator.h" +#include <wtf/StringExtras.h> namespace JSC { @@ -125,7 +126,7 @@ bool ExecutionCounter::setThreshold(CodeBlock* codeBlock) ASSERT(!hasCrossedThreshold(codeBlock)); // Compute the true total count. - double trueTotalCount = static_cast<double>(m_totalCount) + m_counter; + double trueTotalCount = count(); // Correct the threshold for current memory usage. double threshold = applyMemoryUsageHeuristics(m_activeThreshold, codeBlock); @@ -143,9 +144,14 @@ bool ExecutionCounter::setThreshold(CodeBlock* codeBlock) return true; } - if (threshold > std::numeric_limits<int32_t>::max()) - threshold = std::numeric_limits<int32_t>::max(); - + int32_t maxThreshold; + if (Options::randomizeExecutionCountsBetweenCheckpoints) + maxThreshold = codeBlock->globalObject()->weakRandomInteger() % Options::maximumExecutionCountsBetweenCheckpoints; + else + maxThreshold = Options::maximumExecutionCountsBetweenCheckpoints; + if (threshold > maxThreshold) + threshold = maxThreshold; + m_counter = static_cast<int32_t>(-threshold); m_totalCount = trueTotalCount + threshold; @@ -160,5 +166,12 @@ void ExecutionCounter::reset() m_activeThreshold = 0; } +const char* ExecutionCounter::status() const +{ + static char result[80]; + snprintf(result, sizeof(result), "%lf/%lf, %d", count(), static_cast<double>(m_activeThreshold), m_counter); + return result; +} + } // namespace JSC |