WasmLLIntTierUpCounter.h [plain text]
#pragma once
#if ENABLE(WEBASSEMBLY)
#include "ExecutionCounter.h"
#include "InstructionStream.h"
#include "Options.h"
#include <wtf/HashMap.h>
namespace JSC { namespace Wasm {
class LLIntTierUpCounter : public BaselineExecutionCounter {
WTF_MAKE_NONCOPYABLE(LLIntTierUpCounter);
public:
enum class CompilationStatus : uint8_t {
NotCompiled,
Compiling,
Compiled,
};
LLIntTierUpCounter()
{
optimizeAfterWarmUp();
}
void optimizeAfterWarmUp()
{
if (Options::wasmLLIntTiersUpToBBQ())
setNewThreshold(Options::thresholdForBBQOptimizeAfterWarmUp(), nullptr);
else
setNewThreshold(Options::thresholdForOMGOptimizeAfterWarmUp(), nullptr);
}
bool checkIfOptimizationThresholdReached()
{
return checkIfThresholdCrossedAndSet(nullptr);
}
void optimizeSoon()
{
if (Options::wasmLLIntTiersUpToBBQ())
setNewThreshold(Options::thresholdForBBQOptimizeSoon(), nullptr);
else
setNewThreshold(Options::thresholdForOMGOptimizeSoon(), nullptr);
}
struct OSREntryData {
uint32_t loopIndex;
Vector<VirtualRegister> values;
};
void addOSREntryDataForLoop(InstructionStream::Offset, OSREntryData&&);
const OSREntryData& osrEntryDataForLoop(InstructionStream::Offset) const;
Lock m_lock;
CompilationStatus m_compilationStatus { CompilationStatus::NotCompiled };
CompilationStatus m_loopCompilationStatus { CompilationStatus::NotCompiled };
HashMap<InstructionStream::Offset, OSREntryData> m_osrEntryData;
};
} }
#endif // ENABLE(WEBASSEMBLY)