From 32761a6cee1d0dee366b885b7b9c777e67885688 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Sun, 10 Apr 2016 09:28:39 +0000 Subject: webkitgtk-2.4.11 --- .../JavaScriptCore/bytecode/ExecutionCounter.cpp | 42 +++++++++------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'Source/JavaScriptCore/bytecode/ExecutionCounter.cpp') diff --git a/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp b/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp index fe4e430f1..3a646a86a 100644 --- a/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp +++ b/Source/JavaScriptCore/bytecode/ExecutionCounter.cpp @@ -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 @@ -28,25 +28,21 @@ #include "CodeBlock.h" #include "ExecutableAllocator.h" -#include "JSCInlines.h" #include namespace JSC { -template -ExecutionCounter::ExecutionCounter() +ExecutionCounter::ExecutionCounter() { reset(); } -template -void ExecutionCounter::forceSlowPathConcurrently() +void ExecutionCounter::forceSlowPathConcurrently() { m_counter = 0; } -template -bool ExecutionCounter::checkIfThresholdCrossedAndSet(CodeBlock* codeBlock) +bool ExecutionCounter::checkIfThresholdCrossedAndSet(CodeBlock* codeBlock) { if (hasCrossedThreshold(codeBlock)) return true; @@ -57,23 +53,21 @@ bool ExecutionCounter::checkIfThresholdCrossedAndSet(CodeBlock* return false; } -template -void ExecutionCounter::setNewThreshold(int32_t threshold, CodeBlock* codeBlock) +void ExecutionCounter::setNewThreshold(int32_t threshold, CodeBlock* codeBlock) { reset(); m_activeThreshold = threshold; setThreshold(codeBlock); } -template -void ExecutionCounter::deferIndefinitely() +void ExecutionCounter::deferIndefinitely() { m_totalCount = 0; m_activeThreshold = std::numeric_limits::max(); m_counter = std::numeric_limits::min(); } -double applyMemoryUsageHeuristics(int32_t value, CodeBlock* codeBlock) +double ExecutionCounter::applyMemoryUsageHeuristics(int32_t value, CodeBlock* codeBlock) { #if ENABLE(JIT) double multiplier = @@ -88,7 +82,8 @@ double applyMemoryUsageHeuristics(int32_t value, CodeBlock* codeBlock) return multiplier * value; } -int32_t applyMemoryUsageHeuristicsAndConvertToInt(int32_t value, CodeBlock* codeBlock) +int32_t ExecutionCounter::applyMemoryUsageHeuristicsAndConvertToInt( + int32_t value, CodeBlock* codeBlock) { double doubleResult = applyMemoryUsageHeuristics(value, codeBlock); @@ -100,8 +95,7 @@ int32_t applyMemoryUsageHeuristicsAndConvertToInt(int32_t value, CodeBlock* code return static_cast(doubleResult); } -template -bool ExecutionCounter::hasCrossedThreshold(CodeBlock* codeBlock) const +bool ExecutionCounter::hasCrossedThreshold(CodeBlock* codeBlock) const { // This checks if the current count rounded up to the threshold we were targeting. // For example, if we are using half of available executable memory and have @@ -125,17 +119,18 @@ bool ExecutionCounter::hasCrossedThreshold(CodeBlock* codeBlock return static_cast(m_totalCount) + m_counter >= modifiedThreshold - static_cast( - std::min(m_activeThreshold, maximumExecutionCountsBetweenCheckpoints())) / 2; + std::min(m_activeThreshold, Options::maximumExecutionCountsBetweenCheckpoints())) / 2; } -template -bool ExecutionCounter::setThreshold(CodeBlock* codeBlock) +bool ExecutionCounter::setThreshold(CodeBlock* codeBlock) { if (m_activeThreshold == std::numeric_limits::max()) { deferIndefinitely(); return false; } + ASSERT(!m_activeThreshold || !hasCrossedThreshold(codeBlock)); + // Compute the true total count. double trueTotalCount = count(); @@ -164,22 +159,17 @@ bool ExecutionCounter::setThreshold(CodeBlock* codeBlock) return false; } -template -void ExecutionCounter::reset() +void ExecutionCounter::reset() { m_counter = 0; m_totalCount = 0; m_activeThreshold = 0; } -template -void ExecutionCounter::dump(PrintStream& out) const +void ExecutionCounter::dump(PrintStream& out) const { out.printf("%lf/%lf, %d", count(), static_cast(m_activeThreshold), m_counter); } -template class ExecutionCounter; -template class ExecutionCounter; - } // namespace JSC -- cgit v1.2.1