diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGJITCode.h')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGJITCode.h | 67 |
1 files changed, 54 insertions, 13 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGJITCode.h b/Source/JavaScriptCore/dfg/DFGJITCode.h index 0e771e046..e1f6c41e1 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCode.h +++ b/Source/JavaScriptCore/dfg/DFGJITCode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013-2015 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,13 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DFGJITCode_h -#define DFGJITCode_h - -#include <wtf/Platform.h> +#pragma once #if ENABLE(DFG_JIT) +#include "CodeBlock.h" #include "CompilationResult.h" #include "DFGCommonData.h" #include "DFGMinifiedGraph.h" @@ -40,7 +38,11 @@ #include "JITCode.h" #include <wtf/SegmentedVector.h> -namespace JSC { namespace DFG { +namespace JSC { + +class TrackedReferences; + +namespace DFG { class JITCompiler; @@ -49,8 +51,8 @@ public: JITCode(); virtual ~JITCode(); - virtual CommonData* dfgCommon() override; - virtual JITCode* dfg() override; + CommonData* dfgCommon() override; + JITCode* dfg() override; OSREntryData* appendOSREntryData(unsigned bytecodeIndex, unsigned machineCodeOffset) { @@ -109,7 +111,20 @@ public: void setOptimizationThresholdBasedOnCompilationResult(CodeBlock*, CompilationResult); #endif // ENABLE(FTL_JIT) + void validateReferences(const TrackedReferences&) override; + void shrinkToFit(); + + RegisterSet liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock*, CallSiteIndex) override; +#if ENABLE(FTL_JIT) + CodeBlock* osrEntryBlock() { return m_osrEntryBlock.get(); } + void setOSREntryBlock(VM& vm, const JSCell* owner, CodeBlock* osrEntryBlock) { m_osrEntryBlock.set(vm, owner, osrEntryBlock); } + void clearOSREntryBlock() { m_osrEntryBlock.clear(); } +#endif + + static ptrdiff_t commonDataOffset() { return OBJECT_OFFSETOF(JITCode, common); } + + std::optional<CodeOrigin> findPC(CodeBlock*, void* pc) override; private: friend class JITCompiler; // Allow JITCompiler to call setCodeRef(). @@ -122,14 +137,40 @@ public: DFG::VariableEventStream variableEventStream; DFG::MinifiedGraph minifiedDFG; #if ENABLE(FTL_JIT) - ExecutionCounter tierUpCounter; - RefPtr<CodeBlock> osrEntryBlock; + uint8_t neverExecutedEntry { 1 }; + + UpperTierExecutionCounter tierUpCounter; + + // For osrEntryPoint that are in inner loop, this maps their bytecode to the bytecode + // of the outerloop entry points in order (from innermost to outermost). + // + // The key may not always be a target for OSR Entry but the list in the value is guaranteed + // to be usable for OSR Entry. + HashMap<unsigned, Vector<unsigned>> tierUpInLoopHierarchy; + + // Map each bytecode of CheckTierUpAndOSREnter to its stream index. + HashMap<unsigned, unsigned, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> bytecodeIndexToStreamIndex; + + enum class TriggerReason : uint8_t { + DontTrigger, + CompilationDone, + StartCompilation, + }; + + // Map each bytecode of CheckTierUpAndOSREnter to its trigger forcing OSR Entry. + // This can never be modified after it has been initialized since the addresses of the triggers + // are used by the JIT. + HashMap<unsigned, TriggerReason> tierUpEntryTriggers; + + // Set of bytecode that were the target of a TierUp operation. + HashSet<unsigned, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<unsigned>> tierUpEntrySeen; + + WriteBarrier<CodeBlock> m_osrEntryBlock; + unsigned osrEntryRetry; + bool abandonOSREntry; #endif // ENABLE(FTL_JIT) }; } } // namespace JSC::DFG #endif // ENABLE(DFG_JIT) - -#endif // DFGJITCode_h - |