diff options
Diffstat (limited to 'Source/JavaScriptCore/llint/LLIntData.h')
-rw-r--r-- | Source/JavaScriptCore/llint/LLIntData.h | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/Source/JavaScriptCore/llint/LLIntData.h b/Source/JavaScriptCore/llint/LLIntData.h index 8ed2bceda..441a2cfc6 100644 --- a/Source/JavaScriptCore/llint/LLIntData.h +++ b/Source/JavaScriptCore/llint/LLIntData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,19 +23,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LLIntData_h -#define LLIntData_h +#pragma once #include "JSCJSValue.h" #include "Opcode.h" -#include <wtf/Platform.h> +#include <array> namespace JSC { class VM; struct Instruction; -#if ENABLE(LLINT_C_LOOP) +#if !ENABLE(JIT) typedef OpcodeID LLIntCode; #else typedef void (*LLIntCode)(); @@ -43,15 +42,32 @@ typedef void (*LLIntCode)(); namespace LLInt { -#if ENABLE(LLINT) +struct OpcodeStats { + OpcodeID id; + size_t count { 0 }; + size_t slowPathCount { 0 }; +}; +typedef std::array<OpcodeStats, numOpcodeIDs> OpcodeStatsArray; class Data { public: + static void performAssertions(VM&); + static OpcodeStats& opcodeStats(OpcodeID id) { return (*s_opcodeStatsArray)[id]; } + + JS_EXPORT_PRIVATE static void finalizeStats(); + + static void dumpStats(); + static void loadStats(); private: + static void ensureStats(); + static void resetStats(); + static void saveStats(); + static Instruction* s_exceptionInstructions; - static Opcode* s_opcodeMap; + static Opcode s_opcodeMap[numOpcodeIDs]; + static OpcodeStatsArray* s_opcodeStatsArray; friend void initialize(); @@ -87,41 +103,16 @@ ALWAYS_INLINE void* getCodePtr(OpcodeID id) return reinterpret_cast<void*>(getOpcode(id)); } -#else // !ENABLE(LLINT) - -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wmissing-noreturn" -#endif - -class Data { -public: - static void performAssertions(VM&) { } -}; - -#if COMPILER(CLANG) -#pragma clang diagnostic pop -#endif - -#endif // !ENABLE(LLINT) - -ALWAYS_INLINE void* getOpcode(void llintOpcode()) +#if ENABLE(JIT) +ALWAYS_INLINE LLIntCode getCodeFunctionPtr(OpcodeID codeId) { - return bitwise_cast<void*>(llintOpcode); -} - -ALWAYS_INLINE void* getCodePtr(void glueHelper()) -{ - return bitwise_cast<void*>(glueHelper); + return reinterpret_cast<LLIntCode>(getCodePtr(codeId)); } +#endif ALWAYS_INLINE void* getCodePtr(JSC::EncodedJSValue glueHelper()) { return bitwise_cast<void*>(glueHelper); } - } } // namespace JSC::LLInt - -#endif // LLIntData_h - |