Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add support for using Probe DFG OSR Exit behind a runtime flag.
https://bugs.webkit.org/show_bug.cgi?id=177844 <rdar://problem/34801425> Reviewed by Saam Barati. Source/JavaScriptCore: This is based on the code originally posted in https://bugs.webkit.org/show_bug.cgi?id=175144 (in r221774 and r221832) with some optimizations and bug fixes added. The probe based DFG OSR Exit is only enabled if Options::useProbeOSRExit() is true. We're landing this behind an option switch to make it easier to tune performance using the probe based OSR exit. * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/MacroAssembler.cpp: (JSC::stdFunctionCallback): * assembler/MacroAssemblerPrinter.cpp: (JSC::Printer::printCallback): * assembler/ProbeContext.cpp: (JSC::Probe::executeProbe): (JSC::Probe::flushDirtyStackPages): * assembler/ProbeContext.h: (JSC::Probe::Context::Context): (JSC::Probe::Context::arg): * assembler/ProbeFrame.h: Added. (JSC::Probe::Frame::Frame): (JSC::Probe::Frame::argument): (JSC::Probe::Frame::operand): (JSC::Probe::Frame::setArgument): (JSC::Probe::Frame::setOperand): (JSC::Probe::Frame::get): (JSC::Probe::Frame::set): * assembler/ProbeStack.cpp: (JSC::Probe::Page::lowWatermarkFromVisitingDirtyChunks): (JSC::Probe::Stack::Stack): (JSC::Probe::Stack::lowWatermarkFromVisitingDirtyPages): * assembler/ProbeStack.h: (JSC::Probe::Stack::Stack): (JSC::Probe::Stack::lowWatermark): (JSC::Probe::Stack::set): (JSC::Probe::Stack::savedStackPointer const): (JSC::Probe::Stack::setSavedStackPointer): (JSC::Probe::Stack::newStackPointer const): Deleted. (JSC::Probe::Stack::setNewStackPointer): Deleted. * bytecode/ArrayProfile.h: (JSC::ArrayProfile::observeArrayMode): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize): * bytecode/CodeBlock.h: (JSC::CodeBlock::addressOfOSRExitCounter): Deleted. * bytecode/ExecutionCounter.h: (JSC::ExecutionCounter::hasCrossedThreshold const): (JSC::ExecutionCounter::setNewThresholdForOSRExit): * bytecode/MethodOfGettingAValueProfile.cpp: (JSC::MethodOfGettingAValueProfile::reportValue): * bytecode/MethodOfGettingAValueProfile.h: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::linkOSRExits): (JSC::DFG::JITCompiler::link): * dfg/DFGOSRExit.cpp: (JSC::DFG::jsValueFor): (JSC::DFG::restoreCalleeSavesFor): (JSC::DFG::saveCalleeSavesFor): (JSC::DFG::restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer): (JSC::DFG::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::DFG::saveOrCopyCalleeSavesFor): (JSC::DFG::createDirectArgumentsDuringExit): (JSC::DFG::createClonedArgumentsDuringExit): (JSC::DFG::emitRestoreArguments): (JSC::DFG::OSRExit::executeOSRExit): (JSC::DFG::reifyInlinedCallFrames): (JSC::DFG::adjustAndJumpToTarget): (JSC::DFG::printOSRExit): * dfg/DFGOSRExit.h: (JSC::DFG::OSRExitState::OSRExitState): * dfg/DFGThunks.cpp: (JSC::DFG::osrExitThunkGenerator): * dfg/DFGThunks.h: * dfg/DFGVariableEventStream.cpp: (JSC::DFG::tryToSetConstantRecovery): (JSC::DFG::VariableEventStream::reconstruct const): (JSC::DFG::VariableEventStream::tryToSetConstantRecovery const): Deleted. * dfg/DFGVariableEventStream.h: * profiler/ProfilerOSRExit.h: (JSC::Profiler::OSRExit::incCount): * runtime/JSCJSValue.h: * runtime/JSCJSValueInlines.h: * runtime/Options.h: Tools: Enable --useProbeOSrExit=true for dfg-eager and ftl-no-cjit-validate-sampling-profiler test configurations. * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/194150@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
29 changed files
with
1,382 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright (C) 2017 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | ||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | ||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#if ENABLE(MASM_PROBE) | ||
|
||
#include "CallFrame.h" | ||
#include "ProbeStack.h" | ||
|
||
namespace JSC { | ||
namespace Probe { | ||
|
||
class Frame { | ||
public: | ||
Frame(void* frameBase, Stack& stack) | ||
: m_frameBase { reinterpret_cast<uint8_t*>(frameBase) } | ||
, m_stack { stack } | ||
{ } | ||
|
||
template<typename T = JSValue> | ||
T argument(int argument) | ||
{ | ||
return get<T>(CallFrame::argumentOffset(argument) * sizeof(Register)); | ||
} | ||
template<typename T = JSValue> | ||
T operand(int operand) | ||
{ | ||
return get<T>(static_cast<VirtualRegister>(operand).offset() * sizeof(Register)); | ||
} | ||
template<typename T = JSValue> | ||
T operand(int operand, ptrdiff_t offset) | ||
{ | ||
return get<T>(static_cast<VirtualRegister>(operand).offset() * sizeof(Register) + offset); | ||
} | ||
|
||
template<typename T> | ||
void setArgument(int argument, T value) | ||
{ | ||
return set<T>(CallFrame::argumentOffset(argument) * sizeof(Register), value); | ||
} | ||
template<typename T> | ||
void setOperand(int operand, T value) | ||
{ | ||
set<T>(static_cast<VirtualRegister>(operand).offset() * sizeof(Register), value); | ||
} | ||
template<typename T> | ||
void setOperand(int operand, ptrdiff_t offset, T value) | ||
{ | ||
set<T>(static_cast<VirtualRegister>(operand).offset() * sizeof(Register) + offset, value); | ||
} | ||
|
||
template<typename T = JSValue> | ||
T get(ptrdiff_t offset) | ||
{ | ||
return m_stack.get<T>(m_frameBase + offset); | ||
} | ||
template<typename T> | ||
void set(ptrdiff_t offset, T value) | ||
{ | ||
m_stack.set<T>(m_frameBase + offset, value); | ||
} | ||
|
||
private: | ||
uint8_t* m_frameBase; | ||
Stack& m_stack; | ||
}; | ||
|
||
} // namespace Probe | ||
} // namespace JSC | ||
|
||
#endif // ENABLE(MASM_PROBE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.