diff options
Diffstat (limited to 'Source/JavaScriptCore/ftl/FTLJITCode.cpp')
-rw-r--r-- | Source/JavaScriptCore/ftl/FTLJITCode.cpp | 95 |
1 files changed, 27 insertions, 68 deletions
diff --git a/Source/JavaScriptCore/ftl/FTLJITCode.cpp b/Source/JavaScriptCore/ftl/FTLJITCode.cpp index 65e6c0052..cdc7de0c3 100644 --- a/Source/JavaScriptCore/ftl/FTLJITCode.cpp +++ b/Source/JavaScriptCore/ftl/FTLJITCode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2015-2016 Apple Inc. All rights reserved. + * Copyright (C) 2013 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,12 +28,8 @@ #if ENABLE(FTL_JIT) -#include "FTLState.h" - namespace JSC { namespace FTL { -using namespace B3; - JITCode::JITCode() : JSC::JITCode(FTLJIT) { @@ -41,53 +37,44 @@ JITCode::JITCode() JITCode::~JITCode() { - if (FTL::shouldDumpDisassembly()) { - dataLog("Destroying FTL JIT code at "); - CommaPrinter comma; - dataLog(comma, m_b3Code); - dataLog(comma, m_arityCheckEntrypoint); - } } -void JITCode::initializeB3Code(CodeRef b3Code) +void JITCode::initializeExitThunks(CodeRef exitThunks) { - m_b3Code = b3Code; + m_exitThunks = exitThunks; } -void JITCode::initializeB3Byproducts(std::unique_ptr<OpaqueByproducts> byproducts) +void JITCode::addHandle(PassRefPtr<ExecutableMemoryHandle> handle) { - m_b3Byproducts = WTFMove(byproducts); + m_handles.append(handle); } -void JITCode::initializeAddressForCall(CodePtr address) +void JITCode::addDataSection(RefCountedArray<LSectionWord> dataSection) { - m_addressForCall = address; + m_dataSections.append(dataSection); } -void JITCode::initializeArityCheckEntrypoint(CodeRef entrypoint) +void JITCode::initializeCode(CodeRef entrypoint) { - m_arityCheckEntrypoint = entrypoint; + m_entrypoint = entrypoint; } -JITCode::CodePtr JITCode::addressForCall(ArityCheckMode arityCheck) +JITCode::CodePtr JITCode::addressForCall() { - switch (arityCheck) { - case ArityCheckNotRequired: - return m_addressForCall; - case MustCheckArity: - return m_arityCheckEntrypoint.code(); - } - RELEASE_ASSERT_NOT_REACHED(); - return CodePtr(); + RELEASE_ASSERT(m_entrypoint); + return m_entrypoint.code(); } void* JITCode::executableAddressAtOffset(size_t offset) { - return reinterpret_cast<char*>(m_addressForCall.executableAddress()) + offset; + RELEASE_ASSERT(m_entrypoint); + return reinterpret_cast<char*>(m_entrypoint.code().executableAddress()) + offset; } void* JITCode::dataAddressAtOffset(size_t) { + RELEASE_ASSERT(m_entrypoint); + // We can't patch FTL code, yet. Even if we did, it's not clear that we would do so // through this API. RELEASE_ASSERT_NOT_REACHED(); @@ -96,6 +83,8 @@ void* JITCode::dataAddressAtOffset(size_t) unsigned JITCode::offsetOf(void*) { + RELEASE_ASSERT(m_entrypoint); + // We currently don't have visibility into the FTL code. RELEASE_ASSERT_NOT_REACHED(); return 0; @@ -103,6 +92,8 @@ unsigned JITCode::offsetOf(void*) size_t JITCode::size() { + RELEASE_ASSERT(m_entrypoint); + // We don't know the size of FTL code, yet. Make a wild guess. This is mostly used for // GC load estimates. return 1000; @@ -110,11 +101,18 @@ size_t JITCode::size() bool JITCode::contains(void*) { + RELEASE_ASSERT(m_entrypoint); + // We have no idea what addresses the FTL code contains, yet. RELEASE_ASSERT_NOT_REACHED(); return false; } +JITCode::CodePtr JITCode::exitThunks() +{ + return m_exitThunks.code(); +} + JITCode* JITCode::ftl() { return this; @@ -125,45 +123,6 @@ DFG::CommonData* JITCode::dfgCommon() return &common; } -void JITCode::validateReferences(const TrackedReferences& trackedReferences) -{ - common.validateReferences(trackedReferences); - - for (OSRExit& exit : osrExit) - exit.m_descriptor->validateReferences(trackedReferences); -} - -RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock*, CallSiteIndex callSiteIndex) -{ - for (OSRExit& exit : osrExit) { - if (exit.m_exceptionHandlerCallSiteIndex.bits() == callSiteIndex.bits()) { - RELEASE_ASSERT(exit.isExceptionHandler()); - RELEASE_ASSERT(exit.isGenericUnwindHandler()); - return ValueRep::usedRegisters(exit.m_valueReps); - } - } - return RegisterSet(); -} - -Optional<CodeOrigin> JITCode::findPC(CodeBlock* codeBlock, void* pc) -{ - for (OSRExit& exit : osrExit) { - if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) { - if (handle->start() <= pc && pc < handle->end()) - return Optional<CodeOrigin>(exit.m_codeOriginForExitProfile); - } - } - - for (std::unique_ptr<LazySlowPath>& lazySlowPath : lazySlowPaths) { - if (ExecutableMemoryHandle* handle = lazySlowPath->stub().executableMemory()) { - if (handle->start() <= pc && pc < handle->end()) - return Optional<CodeOrigin>(codeBlock->codeOrigin(lazySlowPath->callSiteIndex())); - } - } - - return Nullopt; -} - } } // namespace JSC::FTL #endif // ENABLE(FTL_JIT) |