Commit 9df8b83f authored by mark.lam@apple.com's avatar mark.lam@apple.com

Move DFG inline caching logic into jit/.

https://bugs.webkit.org/show_bug.cgi?id=121749.

Reviewed by Geoffrey Garen.

Relanding http://trac.webkit.org/changeset/156235 after rebasing to latest
revision and fixing build breakages on Windows.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::unlink):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::resetStubInternal):
* bytecode/StructureStubInfo.h:
* dfg/DFGCallArrayAllocatorSlowPathGenerator.h:
(JSC::DFG::CallArrayAllocatorSlowPathGenerator::CallArrayAllocatorSlowPathGenerator):
(JSC::DFG::CallArrayAllocatorWithVariableSizeSlowPathGenerator::CallArrayAllocatorWithVariableSizeSlowPathGenerator):
* dfg/DFGJITCompiler.h:
* dfg/DFGOSRExitCompiler.h:
* dfg/DFGOperations.cpp:
(JSC::DFG::operationPutByValInternal):
* dfg/DFGOperations.h:
(JSC::DFG::operationNewTypedArrayWithSizeForType):
(JSC::DFG::operationNewTypedArrayWithOneArgumentForType):
* dfg/DFGRegisterSet.h: Removed.
* dfg/DFGRepatch.cpp: Removed.
* dfg/DFGRepatch.h: Removed.
* dfg/DFGScratchRegisterAllocator.h: Removed.
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::nonSpeculativeCompare):
(JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
(JSC::DFG::SpeculativeJIT::compare):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch):
(JSC::DFG::CompareAndBoxBooleanSlowPathGenerator::CompareAndBoxBooleanSlowPathGenerator):
(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch):
(JSC::DFG::CompareAndBoxBooleanSlowPathGenerator::CompareAndBoxBooleanSlowPathGenerator):
(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGThunks.cpp:
* dfg/DFGThunks.h:
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct):
* ftl/FTLOSRExitCompiler.h:
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::writeBarrier):
* jit/JIT.cpp:
(JSC::JIT::linkFor):
(JSC::JIT::linkSlowCall):
* jit/JITCall.cpp:
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::privateCompileClosureCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::privateCompileClosureCall):
* jit/JITOperationWrappers.h: Copied from Source/JavaScriptCore/jit/JITOperationWrappers.h.
* jit/JITOperations.cpp: Copied from Source/JavaScriptCore/jit/JITOperations.cpp.
(JSC::getHostCallReturnValueWithExecState):
* jit/JITOperations.h: Copied from Source/JavaScriptCore/jit/JITOperations.h.
* jit/RegisterSet.h: Copied from Source/JavaScriptCore/jit/RegisterSet.h.
* jit/Repatch.cpp: Copied from Source/JavaScriptCore/jit/Repatch.cpp.
(JSC::tryBuildGetByIDList):
* jit/Repatch.h: Copied from Source/JavaScriptCore/jit/Repatch.h.
* jit/ScratchRegisterAllocator.h: Copied from Source/JavaScriptCore/jit/ScratchRegisterAllocator.h.
* jit/ThunkGenerators.cpp:
(JSC::oldStyleGenerateSlowCaseFor):
(JSC::oldStyleLinkForGenerator):
(JSC::oldStyleLinkCallGenerator):
(JSC::oldStyleLinkConstructGenerator):
(JSC::oldStyleLinkClosureCallGenerator):
(JSC::oldStyleVirtualForGenerator):
(JSC::oldStyleVirtualCallGenerator):
(JSC::oldStyleVirtualConstructGenerator):
(JSC::emitPointerValidation):
(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::slowPathFor):
(JSC::linkForThunkGenerator):
(JSC::linkCallThunkGenerator):
(JSC::linkConstructThunkGenerator):
(JSC::linkClosureCallThunkGenerator):
(JSC::virtualForThunkGenerator):
(JSC::virtualCallThunkGenerator):
(JSC::virtualConstructThunkGenerator):
* jit/ThunkGenerators.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cb9e849d
......@@ -150,7 +150,6 @@ set(JavaScriptCore_SOURCES
dfg/DFGPlan.cpp
dfg/DFGPredictionInjectionPhase.cpp
dfg/DFGPredictionPropagationPhase.cpp
dfg/DFGRepatch.cpp
dfg/DFGSSAConversionPhase.cpp
dfg/DFGSpeculativeJIT.cpp
dfg/DFGSpeculativeJIT32_64.cpp
......@@ -225,6 +224,7 @@ set(JavaScriptCore_SOURCES
jit/JITExceptions.cpp
jit/JITOpcodes.cpp
jit/JITOpcodes32_64.cpp
jit/JITOperations.cpp
jit/JITPropertyAccess.cpp
jit/JITPropertyAccess32_64.cpp
jit/JITStubRoutine.cpp
......@@ -232,6 +232,7 @@ set(JavaScriptCore_SOURCES
jit/JITThunks.cpp
jit/JITToDFGDeferredCompilationCallback.cpp
jit/JumpReplacementWatchpoint.cpp
jit/Repatch.cpp
jit/ThunkGenerators.cpp
parser/Lexer.cpp
......
2013-09-26 Mark Lam <mark.lam@apple.com>
Move DFG inline caching logic into jit/.
https://bugs.webkit.org/show_bug.cgi?id=121749.
Reviewed by Geoffrey Garen.
Relanding http://trac.webkit.org/changeset/156235 after rebasing to latest
revision and fixing build breakages on Windows.
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::unlink):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::resetStubInternal):
* bytecode/StructureStubInfo.h:
* dfg/DFGCallArrayAllocatorSlowPathGenerator.h:
(JSC::DFG::CallArrayAllocatorSlowPathGenerator::CallArrayAllocatorSlowPathGenerator):
(JSC::DFG::CallArrayAllocatorWithVariableSizeSlowPathGenerator::CallArrayAllocatorWithVariableSizeSlowPathGenerator):
* dfg/DFGJITCompiler.h:
* dfg/DFGOSRExitCompiler.h:
* dfg/DFGOperations.cpp:
(JSC::DFG::operationPutByValInternal):
* dfg/DFGOperations.h:
(JSC::DFG::operationNewTypedArrayWithSizeForType):
(JSC::DFG::operationNewTypedArrayWithOneArgumentForType):
* dfg/DFGRegisterSet.h: Removed.
* dfg/DFGRepatch.cpp: Removed.
* dfg/DFGRepatch.h: Removed.
* dfg/DFGScratchRegisterAllocator.h: Removed.
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::nonSpeculativeCompare):
(JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
(JSC::DFG::SpeculativeJIT::compare):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch):
(JSC::DFG::CompareAndBoxBooleanSlowPathGenerator::CompareAndBoxBooleanSlowPathGenerator):
(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::cachedPutById):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch):
(JSC::DFG::CompareAndBoxBooleanSlowPathGenerator::CompareAndBoxBooleanSlowPathGenerator):
(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGThunks.cpp:
* dfg/DFGThunks.h:
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct):
* ftl/FTLOSRExitCompiler.h:
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::writeBarrier):
* jit/JIT.cpp:
(JSC::JIT::linkFor):
(JSC::JIT::linkSlowCall):
* jit/JITCall.cpp:
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::privateCompileClosureCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::privateCompileClosureCall):
* jit/JITOperationWrappers.h: Copied from Source/JavaScriptCore/jit/JITOperationWrappers.h.
* jit/JITOperations.cpp: Copied from Source/JavaScriptCore/jit/JITOperations.cpp.
(JSC::getHostCallReturnValueWithExecState):
* jit/JITOperations.h: Copied from Source/JavaScriptCore/jit/JITOperations.h.
* jit/RegisterSet.h: Copied from Source/JavaScriptCore/jit/RegisterSet.h.
* jit/Repatch.cpp: Copied from Source/JavaScriptCore/jit/Repatch.cpp.
(JSC::tryBuildGetByIDList):
* jit/Repatch.h: Copied from Source/JavaScriptCore/jit/Repatch.h.
* jit/ScratchRegisterAllocator.h: Copied from Source/JavaScriptCore/jit/ScratchRegisterAllocator.h.
* jit/ThunkGenerators.cpp:
(JSC::oldStyleGenerateSlowCaseFor):
(JSC::oldStyleLinkForGenerator):
(JSC::oldStyleLinkCallGenerator):
(JSC::oldStyleLinkConstructGenerator):
(JSC::oldStyleLinkClosureCallGenerator):
(JSC::oldStyleVirtualForGenerator):
(JSC::oldStyleVirtualCallGenerator):
(JSC::oldStyleVirtualConstructGenerator):
(JSC::emitPointerValidation):
(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::slowPathFor):
(JSC::linkForThunkGenerator):
(JSC::linkCallThunkGenerator):
(JSC::linkConstructThunkGenerator):
(JSC::linkClosureCallThunkGenerator):
(JSC::virtualForThunkGenerator):
(JSC::virtualCallThunkGenerator):
(JSC::virtualConstructThunkGenerator):
* jit/ThunkGenerators.h:
2013-09-26 Anders Carlsson <andersca@apple.com>
Remove PassWeak.h
......@@ -339,13 +339,9 @@ javascriptcore_sources += \
Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp \
Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.h \
Source/JavaScriptCore/dfg/DFGRegisterBank.h \
Source/JavaScriptCore/dfg/DFGRegisterSet.h \
Source/JavaScriptCore/dfg/DFGRepatch.cpp \
Source/JavaScriptCore/dfg/DFGRepatch.h \
Source/JavaScriptCore/dfg/DFGSafeToExecute.h \
Source/JavaScriptCore/dfg/DFGSaneStringGetByValSlowPathGenerator.h \
Source/JavaScriptCore/dfg/DFGScoreBoard.h \
Source/JavaScriptCore/dfg/DFGScratchRegisterAllocator.h \
Source/JavaScriptCore/dfg/DFGSilentRegisterSavePlan.h \
Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h \
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp \
......@@ -631,6 +627,9 @@ javascriptcore_sources += \
Source/JavaScriptCore/jit/JITInlines.h \
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp \
Source/JavaScriptCore/jit/JITOpcodes.cpp \
Source/JavaScriptCore/jit/JITOperationWrappers.h \
Source/JavaScriptCore/jit/JITOperations.cpp \
Source/JavaScriptCore/jit/JITOperations.h \
Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp \
Source/JavaScriptCore/jit/JITPropertyAccess.cpp \
Source/JavaScriptCore/jit/JITStubCall.h \
......@@ -653,6 +652,9 @@ javascriptcore_sources += \
Source/JavaScriptCore/jit/JSInterfaceJIT.h \
Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp \
Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h \
Source/JavaScriptCore/jit/Repatch.cpp \
Source/JavaScriptCore/jit/Repatch.h \
Source/JavaScriptCore/jit/ScratchRegisterAllocator.h \
Source/JavaScriptCore/jit/SlowPathCall.h \
Source/JavaScriptCore/jit/SpecializedThunkJIT.h \
Source/JavaScriptCore/jit/ThunkGenerator.h \
......
......@@ -378,6 +378,7 @@
<ClCompile Include="..\jit\JITExceptions.cpp" />
<ClCompile Include="..\jit\JITOpcodes.cpp" />
<ClCompile Include="..\jit\JITOpcodes32_64.cpp" />
<ClCompile Include="..\jit\JITOperations.cpp" />
<ClCompile Include="..\jit\JITPropertyAccess.cpp" />
<ClCompile Include="..\jit\JITPropertyAccess32_64.cpp" />
<ClCompile Include="..\jit\JITStubRoutine.cpp" />
......@@ -385,6 +386,7 @@
<ClCompile Include="..\jit\JITThunks.cpp" />
<ClCompile Include="..\jit\JITToDFGDeferredCompilationCallback.cpp" />
<ClCompile Include="..\jit\JumpReplacementWatchpoint.cpp" />
<ClCompile Include="..\jit\Repatch.cpp" />
<ClCompile Include="..\jit\ThunkGenerators.cpp" />
<ClCompile Include="..\llint\LLIntCLoop.cpp" />
<ClCompile Include="..\llint\LLIntData.cpp" />
......@@ -768,6 +770,8 @@
<ClInclude Include="..\jit\JITDisassembler.h" />
<ClInclude Include="..\jit\JITExceptions.h" />
<ClInclude Include="..\jit\JITInlines.h" />
<ClInclude Include="..\jit\JITOperationWrappers.h" />
<ClInclude Include="..\jit\JITOperations.h" />
<ClInclude Include="..\jit\JITStubCall.h" />
<ClInclude Include="..\jit\JITStubRoutine.h" />
<ClInclude Include="..\jit\JITStubs.h" />
......@@ -779,6 +783,9 @@
<ClInclude Include="..\jit\JITWriteBarrier.h" />
<ClInclude Include="..\jit\JSInterfaceJIT.h" />
<ClInclude Include="..\jit\JumpReplacementWatchpoint.h" />
<ClInclude Include="..\jit\RegisterSet.h" />
<ClInclude Include="..\jit\Repatch.h" />
<ClInclude Include="..\jit\ScratchRegisterAllocator.h" />
<ClInclude Include="..\jit\SpecializedThunkJIT.h" />
<ClInclude Include="..\jit\ThunkGenerator.h" />
<ClInclude Include="..\jit\ThunkGenerators.h" />
......
......@@ -183,7 +183,6 @@ SOURCES += \
dfg/DFGPlan.cpp \
dfg/DFGPredictionPropagationPhase.cpp \
dfg/DFGPredictionInjectionPhase.cpp \
dfg/DFGRepatch.cpp \
dfg/DFGSSAConversionPhase.cpp \
dfg/DFGSpeculativeJIT.cpp \
dfg/DFGSpeculativeJIT32_64.cpp \
......@@ -222,6 +221,7 @@ SOURCES += \
jit/JITExceptions.cpp \
jit/JITOpcodes.cpp \
jit/JITOpcodes32_64.cpp \
jit/JITOperations.cpp \
jit/JITPropertyAccess.cpp \
jit/JITPropertyAccess32_64.cpp \
jit/JITStubRoutine.cpp \
......@@ -229,6 +229,7 @@ SOURCES += \
jit/JITThunks.cpp \
jit/JITToDFGDeferredCompilationCallback.cpp \
jit/JumpReplacementWatchpoint.cpp \
jit/Repatch.cpp \
jit/ThunkGenerators.cpp \
llint/LLIntCLoop.cpp \
llint/LLIntData.cpp \
......
......@@ -40,12 +40,12 @@ void CallLinkInfo::unlink(VM& vm, RepatchBuffer& repatchBuffer)
repatchBuffer.revertJumpReplacementToBranchPtrWithPatch(RepatchBuffer::startOfBranchPtrWithPatchOnRegister(hotPathBegin), static_cast<MacroAssembler::RegisterID>(calleeGPR), 0);
if (isDFG) {
#if ENABLE(DFG_JIT)
repatchBuffer.relink(callReturnLocation, (callType == Construct ? vm.getCTIStub(DFG::linkConstructThunkGenerator) : vm.getCTIStub(DFG::linkCallThunkGenerator)).code());
repatchBuffer.relink(callReturnLocation, (callType == Construct ? vm.getCTIStub(linkConstructThunkGenerator) : vm.getCTIStub(linkCallThunkGenerator)).code());
#else
RELEASE_ASSERT_NOT_REACHED();
#endif
} else
repatchBuffer.relink(callReturnLocation, callType == Construct ? vm.getCTIStub(linkConstructGenerator).code() : vm.getCTIStub(linkCallGenerator).code());
repatchBuffer.relink(callReturnLocation, callType == Construct ? vm.getCTIStub(oldStyleLinkConstructGenerator).code() : vm.getCTIStub(oldStyleLinkCallGenerator).code());
hasSeenShouldRepatch = false;
callee.clear();
stub.clear();
......
......@@ -36,7 +36,6 @@
#include "DFGCommon.h"
#include "DFGDriver.h"
#include "DFGNode.h"
#include "DFGRepatch.h"
#include "DFGWorklist.h"
#include "Debugger.h"
#include "Interpreter.h"
......@@ -50,6 +49,7 @@
#include "Operations.h"
#include "PolymorphicPutByIdList.h"
#include "ReduceWhitespace.h"
#include "Repatch.h"
#include "RepatchBuffer.h"
#include "SlotVisitorInlines.h"
#include <stdio.h>
......@@ -2386,12 +2386,12 @@ void CodeBlock::resetStubInternal(RepatchBuffer& repatchBuffer, StructureStubInf
break;
case JITCode::DFGJIT:
if (isGetByIdAccess(accessType))
DFG::resetGetByID(repatchBuffer, stubInfo);
resetGetByID(repatchBuffer, stubInfo);
else if (isPutByIdAccess(accessType))
DFG::resetPutByID(repatchBuffer, stubInfo);
resetPutByID(repatchBuffer, stubInfo);
else {
RELEASE_ASSERT(isInAccess(accessType));
DFG::resetIn(repatchBuffer, stubInfo);
resetIn(repatchBuffer, stubInfo);
}
break;
default:
......
......@@ -31,12 +31,12 @@
#if ENABLE(JIT)
#include "CodeOrigin.h"
#include "DFGRegisterSet.h"
#include "Instruction.h"
#include "JITStubRoutine.h"
#include "MacroAssembler.h"
#include "Opcode.h"
#include "PolymorphicAccessStructureList.h"
#include "RegisterSet.h"
#include "Structure.h"
#include "StructureStubClearingWatchpoint.h"
#include <wtf/OwnPtr.h>
......@@ -231,7 +231,7 @@ struct StructureStubInfo {
int8_t valueTagGPR;
#endif
int8_t valueGPR;
DFG::RegisterSetPOD usedRegisters;
RegisterSetPOD usedRegisters;
int32_t deltaCallToDone;
int32_t deltaCallToStorageLoad;
int32_t deltaCallToStructCheck;
......
......@@ -40,7 +40,7 @@ namespace JSC { namespace DFG {
class CallArrayAllocatorSlowPathGenerator : public JumpingSlowPathGenerator<MacroAssembler::JumpList> {
public:
CallArrayAllocatorSlowPathGenerator(
MacroAssembler::JumpList from, SpeculativeJIT* jit, P_DFGOperation_EStZ function,
MacroAssembler::JumpList from, SpeculativeJIT* jit, P_JITOperation_EStZ function,
GPRReg resultGPR, GPRReg storageGPR, Structure* structure, size_t size)
: JumpingSlowPathGenerator<MacroAssembler::JumpList>(from, jit)
, m_function(function)
......@@ -68,7 +68,7 @@ protected:
}
private:
P_DFGOperation_EStZ m_function;
P_JITOperation_EStZ m_function;
GPRReg m_resultGPR;
GPRReg m_storageGPR;
Structure* m_structure;
......@@ -79,7 +79,7 @@ private:
class CallArrayAllocatorWithVariableSizeSlowPathGenerator : public JumpingSlowPathGenerator<MacroAssembler::JumpList> {
public:
CallArrayAllocatorWithVariableSizeSlowPathGenerator(
MacroAssembler::JumpList from, SpeculativeJIT* jit, P_DFGOperation_EStZ function,
MacroAssembler::JumpList from, SpeculativeJIT* jit, P_JITOperation_EStZ function,
GPRReg resultGPR, Structure* contiguousStructure, Structure* arrayStorageStructure, GPRReg sizeGPR)
: JumpingSlowPathGenerator<MacroAssembler::JumpList>(from, jit)
, m_function(function)
......@@ -112,7 +112,7 @@ protected:
}
private:
P_DFGOperation_EStZ m_function;
P_JITOperation_EStZ m_function;
GPRReg m_resultGPR;
Structure* m_contiguousStructure;
Structure* m_arrayStorageStructure;
......
......@@ -36,12 +36,12 @@
#include "DFGJITCode.h"
#include "DFGOSRExitCompilationInfo.h"
#include "DFGRegisterBank.h"
#include "DFGRegisterSet.h"
#include "FPRInfo.h"
#include "GPRInfo.h"
#include "JITCode.h"
#include "LinkBuffer.h"
#include "MacroAssembler.h"
#include "RegisterSet.h"
namespace JSC {
......
......@@ -76,7 +76,7 @@ private:
};
extern "C" {
void DFG_OPERATION compileOSRExit(ExecState*) WTF_INTERNAL;
void JIT_OPERATION compileOSRExit(ExecState*) WTF_INTERNAL;
}
} } // namespace JSC::DFG
......
This diff is collapsed.
This diff is collapsed.
......@@ -895,22 +895,6 @@ void SpeculativeJIT::useChildren(Node* node)
}
}
void SpeculativeJIT::writeBarrier(MacroAssembler& jit, GPRReg owner, GPRReg scratch1, GPRReg scratch2, WriteBarrierUseKind useKind)
{
UNUSED_PARAM(jit);
UNUSED_PARAM(owner);
UNUSED_PARAM(scratch1);
UNUSED_PARAM(scratch2);
UNUSED_PARAM(useKind);
ASSERT(owner != scratch1);
ASSERT(owner != scratch2);
ASSERT(scratch1 != scratch2);
#if ENABLE(WRITE_BARRIER_PROFILING)
JITCompiler::emitCount(jit, WriteBarrierCounters::jitCounterFor(useKind));
#endif
}
void SpeculativeJIT::writeBarrier(GPRReg ownerGPR, GPRReg valueGPR, Edge valueUse, WriteBarrierUseKind useKind, GPRReg scratch1, GPRReg scratch2)
{
UNUSED_PARAM(ownerGPR);
......@@ -1017,7 +1001,7 @@ void SpeculativeJIT::compileIn(Node* node)
#endif
}
bool SpeculativeJIT::nonSpeculativeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_DFGOperation_EJJ helperFunction)
bool SpeculativeJIT::nonSpeculativeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
{
unsigned branchIndexInBlock = detectPeepHoleBranch();
if (branchIndexInBlock != UINT_MAX) {
......@@ -1465,7 +1449,7 @@ void SpeculativeJIT::compilePeepHoleInt32Branch(Node* node, Node* branchNode, JI
}
// Returns true if the compare is fused with a subsequent branch.
bool SpeculativeJIT::compilePeepHoleBranch(Node* node, MacroAssembler::RelationalCondition condition, MacroAssembler::DoubleCondition doubleCondition, S_DFGOperation_EJJ operation)
bool SpeculativeJIT::compilePeepHoleBranch(Node* node, MacroAssembler::RelationalCondition condition, MacroAssembler::DoubleCondition doubleCondition, S_JITOperation_EJJ operation)
{
// Fused compare & branch.
unsigned branchIndexInBlock = detectPeepHoleBranch();
......@@ -3842,7 +3826,7 @@ void SpeculativeJIT::compileArithMod(Node* node)
}
// Returns true if the compare is fused with a subsequent branch.
bool SpeculativeJIT::compare(Node* node, MacroAssembler::RelationalCondition condition, MacroAssembler::DoubleCondition doubleCondition, S_DFGOperation_EJJ operation)
bool SpeculativeJIT::compare(Node* node, MacroAssembler::RelationalCondition condition, MacroAssembler::DoubleCondition doubleCondition, S_JITOperation_EJJ operation)
{
if (compilePeepHoleBranch(node, condition, doubleCondition, operation))
return true;
......
......@@ -32,6 +32,7 @@
#include "ArrayPrototype.h"
#include "DFGAbstractInterpreterInlines.h"
#include "DFGCallArrayAllocatorSlowPathGenerator.h"
#include "DFGOperations.h"
#include "DFGSlowPathGenerator.h"
#include "JSActivation.h"
#include "ObjectPrototype.h"
......@@ -261,7 +262,7 @@ void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR,
JITCompiler::DataLabel32 payloadStoreWithPatch = m_jit.store32WithAddressOffsetPatch(valuePayloadGPR, JITCompiler::Address(scratchGPR, OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)));
JITCompiler::Label doneLabel = m_jit.label();
V_DFGOperation_EJCI optimizedCall;
V_JITOperation_EJCI optimizedCall;
if (m_jit.strictModeFor(m_currentNode->codeOrigin)) {
if (putKind == Direct)
optimizedCall = operationPutByIdDirectStrictOptimize;
......@@ -440,7 +441,7 @@ bool SpeculativeJIT::nonSpeculativeCompareNull(Node* node, Edge operand, bool in
return false;
}
void SpeculativeJIT::nonSpeculativePeepholeBranch(Node* node, Node* branchNode, MacroAssembler::RelationalCondition cond, S_DFGOperation_EJJ helperFunction)
void SpeculativeJIT::nonSpeculativePeepholeBranch(Node* node, Node* branchNode, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
{
BasicBlock* taken = branchNode->takenBlock();
BasicBlock* notTaken = branchNode->notTakenBlock();
......@@ -512,13 +513,13 @@ void SpeculativeJIT::nonSpeculativePeepholeBranch(Node* node, Node* branchNode,
template<typename JumpType>
class CompareAndBoxBooleanSlowPathGenerator
: public CallSlowPathGenerator<JumpType, S_DFGOperation_EJJ, GPRReg> {
: public CallSlowPathGenerator<JumpType, S_JITOperation_EJJ, GPRReg> {
public:
CompareAndBoxBooleanSlowPathGenerator(
JumpType from, SpeculativeJIT* jit,
S_DFGOperation_EJJ function, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload,
S_JITOperation_EJJ function, GPRReg result, GPRReg arg1Tag, GPRReg arg1Payload,
GPRReg arg2Tag, GPRReg arg2Payload)
: CallSlowPathGenerator<JumpType, S_DFGOperation_EJJ, GPRReg>(
: CallSlowPathGenerator<JumpType, S_JITOperation_EJJ, GPRReg>(
from, jit, function, NeedToSpill, result)
, m_arg1Tag(arg1Tag)
, m_arg1Payload(arg1Payload)
......@@ -546,7 +547,7 @@ private:
GPRReg m_arg2Payload;
};
void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_DFGOperation_EJJ helperFunction)
void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
{
JSValueOperand arg1(this, node->child1());
JSValueOperand arg2(this, node->child2());
......@@ -3606,7 +3607,7 @@ void SpeculativeJIT::compile(Node* node)
TrustedImm32(FinalObjectType)));
m_jit.move(thisValuePayloadGPR, tempGPR);
m_jit.move(thisValueTagGPR, tempTagGPR);
J_DFGOperation_EJ function;
J_JITOperation_EJ function;
if (m_jit.graph().executableFor(node->codeOrigin)->isStrictMode())
function = operationToThisStrict;
else
......
......@@ -32,6 +32,7 @@
#include "ArrayPrototype.h"
#include "DFGAbstractInterpreterInlines.h"
#include "DFGCallArrayAllocatorSlowPathGenerator.h"
#include "DFGOperations.h"
#include "DFGSlowPathGenerator.h"
#include "JSCJSValueInlines.h"
#include "ObjectPrototype.h"
......@@ -253,7 +254,7 @@ void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg
JITCompiler::Label doneLabel = m_jit.label();
V_DFGOperation_EJCI optimizedCall;
V_JITOperation_EJCI optimizedCall;
if (m_jit.strictModeFor(m_currentNode->codeOrigin)) {
if (putKind == Direct)
optimizedCall = operationPutByIdDirectStrictOptimize;
......@@ -428,7 +429,7 @@ bool SpeculativeJIT::nonSpeculativeCompareNull(Node* node, Edge operand, bool in
return false;
}
void SpeculativeJIT::nonSpeculativePeepholeBranch(Node* node, Node* branchNode, MacroAssembler::RelationalCondition cond, S_DFGOperation_EJJ helperFunction)
void SpeculativeJIT::nonSpeculativePeepholeBranch(Node* node, Node* branchNode, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
{
BasicBlock* taken = branchNode->takenBlock();
BasicBlock* notTaken = branchNode->notTakenBlock();
......@@ -498,12 +499,12 @@ void SpeculativeJIT::nonSpeculativePeepholeBranch(Node* node, Node* branchNode,
template<typename JumpType>
class CompareAndBoxBooleanSlowPathGenerator
: public CallSlowPathGenerator<JumpType, S_DFGOperation_EJJ, GPRReg> {
: public CallSlowPathGenerator<JumpType, S_JITOperation_EJJ, GPRReg> {
public:
CompareAndBoxBooleanSlowPathGenerator(
JumpType from, SpeculativeJIT* jit,
S_DFGOperation_EJJ function, GPRReg result, GPRReg arg1, GPRReg arg2)
: CallSlowPathGenerator<JumpType, S_DFGOperation_EJJ, GPRReg>(
S_JITOperation_EJJ function, GPRReg result, GPRReg arg1, GPRReg arg2)
: CallSlowPathGenerator<JumpType, S_JITOperation_EJJ, GPRReg>(
from, jit, function, NeedToSpill, result)
, m_arg1(arg1)
, m_arg2(arg2)
......@@ -525,7 +526,7 @@ private:
GPRReg m_arg2;
};
void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_DFGOperation_EJJ helperFunction)
void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
{
JSValueOperand arg1(this, node->child1());
JSValueOperand arg2(this, node->child2());
......@@ -3902,7 +3903,7 @@ void SpeculativeJIT::compile(Node* node)
MacroAssembler::Address(tempGPR, Structure::typeInfoTypeOffset()),
TrustedImm32(FinalObjectType)));
m_jit.move(thisValueGPR, tempGPR);
J_DFGOperation_EJ function;
J_JITOperation_EJ function;
if (m_jit.graph().executableFor(node->codeOrigin)->isStrictMode())
function = operationToThisStrict;
else
......
......@@ -93,238 +93,6 @@ MacroAssemblerCodeRef osrExitGenerationThunkGenerator(VM* vm)
return FINALIZE_CODE(patchBuffer, ("DFG OSR exit generation thunk"));
}
inline void emitPointerValidation(CCallHelpers& jit, GPRReg pointerGPR)
{
#if !ASSERT_DISABLED
CCallHelpers::Jump isNonZero = jit.branchTestPtr(CCallHelpers::NonZero, pointerGPR);
jit.breakpoint();
isNonZero.link(&jit);
jit.push(pointerGPR);
jit.load8(pointerGPR, pointerGPR);
jit.pop(pointerGPR);
#else
UNUSED_PARAM(jit);
UNUSED_PARAM(pointerGPR);
#endif
}
MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(VM* vm)
{
CCallHelpers jit(vm);
// We will jump to here if the JIT code thinks it's making a call, but the
// linking helper (C++ code) decided to throw an exception instead. We will
// have saved the callReturnIndex in the first arguments of JITStackFrame.
// Note that the return address will be on the stack at this point, so we
// need to remove it and drop it on the floor, since we don't care about it.
// Finally note that the call frame register points at the callee frame, so
// we need to pop it.
jit.preserveReturnAddressAfterCall(GPRInfo::nonPreservedNonReturnGPR);
jit.loadPtr(
CCallHelpers::Address(
GPRInfo::callFrameRegister,
static_cast<ptrdiff_t>(sizeof(Register)) * JSStack::CallerFrame),
GPRInfo::callFrameRegister);
#if USE(JSVALUE64)
jit.peek64(GPRInfo::nonPreservedNonReturnGPR, JITSTACKFRAME_ARGS_INDEX);
#else
jit.peek(GPRInfo::nonPreservedNonReturnGPR, JITSTACKFRAME_ARGS_INDEX);
#endif
jit.setupArgumentsWithExecState(GPRInfo::nonPreservedNonReturnGPR);
jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(lookupExceptionHandler)), GPRInfo::nonArgGPR0);
emitPointerValidation(jit, GPRInfo::nonArgGPR0);
jit.call(GPRInfo::nonArgGPR0);
emitPointerValidation(jit, GPRInfo::returnValueGPR2);
jit.jump(GPRInfo::returnValueGPR2);
LinkBuffer patchBuffer(*vm, &jit, GLOBAL_THUNK_ID);
return FINALIZE_CODE(patchBuffer, ("DFG throw exception from call slow path thunk"));
}
static void slowPathFor(
CCallHelpers& jit, VM* vm, P_DFGOperation_E slowPathFunction)
{
jit.preserveReturnAddressAfterCall(GPRInfo::nonArgGPR2);
emitPointerValidation(jit, GPRInfo::nonArgGPR2);
jit.storePtr(
GPRInfo::nonArgGPR2,
CCallHelpers::Address(
GPRInfo::callFrameRegister,
static_cast<ptrdiff_t>(sizeof(Register)) * JSStack::ReturnPC));
jit.storePtr(GPRInfo::callFrameRegister, &vm->topCallFrame);
#if USE(JSVALUE64)
jit.poke64(GPRInfo::nonPreservedNonReturnGPR, JITSTACKFRAME_ARGS_INDEX);
#else
jit.poke(GPRInfo::nonPreservedNonReturnGPR, JITSTACKFRAME_ARGS_INDEX);
#endif
jit.setupArgumentsExecState();
jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(slowPathFunction)), GPRInfo::nonArgGPR0);
emitPointerValidation(jit, GPRInfo::nonArgGPR0);
jit.call(GPRInfo::nonArgGPR0);
// This slow call will return the address of one of the following:
// 1) Exception throwing thunk.
// 2) Host call return value returner thingy.
// 3) The function to call.
jit.loadPtr(
CCallHelpers::Address(
GPRInfo::callFrameRegister,
static_cast<ptrdiff_t>(sizeof(Register)) * JSStack::ReturnPC),
GPRInfo::nonPreservedNonReturnGPR);
jit.storePtr(
CCallHelpers::TrustedImmPtr(0),
CCallHelpers::Address(
GPRInfo::callFrameRegister,
static_cast<ptrdiff_t>(sizeof(Register)) * JSStack::ReturnPC));
emitPointerValidation(jit, GPRInfo::nonPreservedNonReturnGPR);
jit.restoreReturnAddressBeforeReturn(GPRInfo::nonPreservedNonReturnGPR);
emitPointerValidation(jit, GPRInfo::returnValueGPR);
jit.jump(GPRInfo::returnValueGPR);
}
static MacroAssemblerCodeRef linkForThunkGenerator(
VM* vm, CodeSpecializationKind kind)
{
// The return address is on the stack or in the link register. We will hence
// save the return address to the call frame while we make a C++ function call
// to perform linking and lazy compilation if necessary. We expect the callee
// to be in nonArgGPR0/nonArgGPR1 (payload/tag), the call frame to have already
// been adjusted, nonPreservedNonReturnGPR holds the exception handler index,
// and all other registers to be available for use. We use JITStackFrame::args
// to save important information across calls.
CCallHelpers jit(vm);
slowPathFor(jit, vm, kind == CodeForCall ? operationLinkCall : operationLinkConstruct);
LinkBuffer patchBuffer(*vm, &jit, GLOBAL_THUNK_ID);
return FINALIZE_CODE(
patchBuffer,
("DFG link %s slow path thunk", kind == CodeForCall ? "call" : "construct"));
}
MacroAssemblerCodeRef linkCallThunkGenerator(VM* vm)
{
return linkForThunkGenerator(vm, CodeForCall);
}
MacroAssemblerCodeRef linkConstructThunkGenerator(VM* vm)
{
return linkForThunkGenerator(vm, CodeForConstruct);
}
// For closure optimizations, we only include calls, since if you're using closures for
// object construction then you're going to lose big time anyway.
MacroAssemblerCodeRef linkClosureCallThunkGenerator(VM* vm)
{
CCallHelpers jit(vm);
slowPathFor(jit, vm, operationLinkClosureCall);
LinkBuffer patchBuffer(*vm, &jit, GLOBAL_THUNK_ID);
return FINALIZE_CODE(patchBuffer, ("DFG link closure call slow path thunk"));
}