Commit 02b179b1 authored by oliver@apple.com's avatar oliver@apple.com
Browse files

fourthTier: put DFG data into a DFG::JITCode, and put common DFG and FTL data...

fourthTier: put DFG data into a DFG::JITCode, and put common DFG and FTL data into something accessible from both DFG::JITCode and FTL::JITCode
https://bugs.webkit.org/show_bug.cgi?id=113905

Reviewed by Geoffrey Garen.

This removes one pointer from CodeBlock.

It also gives us a framework for having JITType-specific data in CodeBlock, by
putting it into the appropriate JITCode class (either DFG::JITCode or
FTL::JITCode). And it allows us to have DFG and FTL share some common data,
via DFG::CommonData, which is stored in both DFG::JITCode and FTL::JITCode and
always accessible via JITCode::dfgCommon().

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC):
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::visitAggregate):
(JSC::CodeBlock::performTracingFixpointIteration):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::stronglyVisitWeakReferences):
(JSC::CodeBlock::shrinkToFit):
(JSC::CodeBlock::tallyFrequentExitSites):
* bytecode/CodeBlock.h:
(CodeBlock):
(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::shouldImmediatelyAssumeLivenessDuringScan):
(JSC::DFGCodeBlocks::mark):
* dfg/DFGAssemblyHelpers.h:
* dfg/DFGCommonData.cpp: Added.
(DFG):
(JSC::DFG::CommonData::notifyCompilingStructureTransition):
(JSC::DFG::CommonData::shrinkToFit):
* dfg/DFGCommonData.h: Added.
(JSC):
(DFG):
(JSC::DFG::WeakReferenceTransition::WeakReferenceTransition):
(WeakReferenceTransition):
(CommonData):
(JSC::DFG::CommonData::CommonData):
* dfg/DFGDriver.cpp:
(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
* dfg/DFGDriver.h:
(DFG):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
* dfg/DFGGraph.h:
(Graph):
* dfg/DFGJITCode.cpp: Added.
(DFG):
(JSC::DFG::JITCode::JITCode):
(JSC::DFG::JITCode::~JITCode):
(JSC::DFG::JITCode::dfgCommon):
(JSC::DFG::JITCode::dfg):
(JSC::DFG::JITCode::shrinkToFit):
* dfg/DFGJITCode.h: Added.
(DFG):
(JITCode):
(JSC::DFG::JITCode::appendOSREntryData):
(JSC::DFG::JITCode::osrEntryDataForBytecodeIndex):
(JSC::DFG::JITCode::appendOSRExit):
(JSC::DFG::JITCode::lastOSRExit):
(JSC::DFG::JITCode::appendSpeculationRecovery):
(JSC::DFG::JITCode::appendWatchpoint):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
* dfg/DFGJITCompiler.h:
(JITCompiler):
(JSC::DFG::JITCompiler::addWeakReference):
(JSC::DFG::JITCompiler::noticeOSREntry):
(JSC::DFG::JITCompiler::jitCode):
* dfg/DFGOSREntry.cpp:
(JSC::DFG::prepareOSREntry):
* dfg/DFGOSRExit.h:
(OSRExit):
* dfg/DFGOSRExitCompiler.cpp:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::backwardSpeculationCheck):
(JSC::DFG::SpeculativeJIT::speculationWatchpoint):
(JSC::DFG::SpeculativeJIT::convertLastOSRExitToForward):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGVariableEventStream.cpp:
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLJITCode.cpp:
(JSC::FTL::JITCode::JITCode):
(JSC::FTL::JITCode::~JITCode):
(FTL):
(JSC::FTL::JITCode::initializeCode):
(JSC::FTL::JITCode::addressForCall):
(JSC::FTL::JITCode::executableAddressAtOffset):
(JSC::FTL::JITCode::dataAddressAtOffset):
(JSC::FTL::JITCode::offsetOf):
(JSC::FTL::JITCode::size):
(JSC::FTL::JITCode::contains):
(JSC::FTL::JITCode::ftl):
(JSC::FTL::JITCode::dfgCommon):
* ftl/FTLJITCode.h:
(JITCode):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileStructureTransitionWatchpoint):
(JSC::FTL::LowerDFGToLLVM::compilePutStructure):
(JSC::FTL::LowerDFGToLLVM::compilePhantomPutStructure):
(JSC::FTL::LowerDFGToLLVM::addWeakReference):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::weakPointer):
* ftl/FTLState.cpp:
(FTL):
(JSC::FTL::State::State):
(JSC::FTL::State::dumpState):
* ftl/FTLState.h:
(State):
* heap/DFGCodeBlocks.cpp:
(JSC::DFGCodeBlocks::~DFGCodeBlocks):
(JSC::DFGCodeBlocks::jettison):
(JSC::DFGCodeBlocks::clearMarks):
(JSC::DFGCodeBlocks::deleteUnmarkedJettisonedCodeBlocks):
(JSC::DFGCodeBlocks::traceMarkedCodeBlocks):
* jit/JITCode.cpp:
(JSC::JITCode::dfgCommon):
(JSC):
(JSC::JITCode::dfg):
(JSC::JITCode::ftl):
(JSC::DirectJITCode::DirectJITCode):
(JSC::DirectJITCode::initializeCodeRef):
(JSC::DirectJITCode::addressForCall):
(JSC::DirectJITCode::executableAddressAtOffset):
(JSC::DirectJITCode::dataAddressAtOffset):
(JSC::DirectJITCode::offsetOf):
(JSC::DirectJITCode::size):
(JSC::DirectJITCode::contains):
* jit/JITCode.h:
(DFG):
(FTL):
(JSC):
(JITCode):
(DirectJITCode):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 56f0addc
......@@ -81,6 +81,7 @@ set(JavaScriptCore_SOURCES
dfg/DFGByteCodeParser.cpp
dfg/DFGCapabilities.cpp
dfg/DFGCommon.cpp
dfg/DFGCommonData.cpp
dfg/DFGCFAPhase.cpp
dfg/DFGCFGSimplificationPhase.cpp
dfg/DFGCPSRethreadingPhase.cpp
......@@ -93,6 +94,7 @@ set(JavaScriptCore_SOURCES
dfg/DFGEdge.cpp
dfg/DFGFixupPhase.cpp
dfg/DFGGraph.cpp
dfg/DFGJITCode.cpp
dfg/DFGJITCompiler.cpp
dfg/DFGLongLivedState.cpp
dfg/DFGMinifiedNode.cpp
......
2013-07-15 Oliver Hunt <oliver@apple.com>
Merged dfgFourthTier r147609
2013-04-03 Filip Pizlo <fpizlo@apple.com>
fourthTier: put DFG data into a DFG::JITCode, and put common DFG and FTL data into something accessible from both DFG::JITCode and FTL::JITCode
https://bugs.webkit.org/show_bug.cgi?id=113905
Reviewed by Geoffrey Garen.
This removes one pointer from CodeBlock.
It also gives us a framework for having JITType-specific data in CodeBlock, by
putting it into the appropriate JITCode class (either DFG::JITCode or
FTL::JITCode). And it allows us to have DFG and FTL share some common data,
via DFG::CommonData, which is stored in both DFG::JITCode and FTL::JITCode and
always accessible via JITCode::dfgCommon().
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC):
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::visitAggregate):
(JSC::CodeBlock::performTracingFixpointIteration):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::stronglyVisitWeakReferences):
(JSC::CodeBlock::shrinkToFit):
(JSC::CodeBlock::tallyFrequentExitSites):
* bytecode/CodeBlock.h:
(CodeBlock):
(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::shouldImmediatelyAssumeLivenessDuringScan):
(JSC::DFGCodeBlocks::mark):
* dfg/DFGAssemblyHelpers.h:
* dfg/DFGCommonData.cpp: Added.
(DFG):
(JSC::DFG::CommonData::notifyCompilingStructureTransition):
(JSC::DFG::CommonData::shrinkToFit):
* dfg/DFGCommonData.h: Added.
(JSC):
(DFG):
(JSC::DFG::WeakReferenceTransition::WeakReferenceTransition):
(WeakReferenceTransition):
(CommonData):
(JSC::DFG::CommonData::CommonData):
* dfg/DFGDriver.cpp:
(JSC::DFG::compile):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
* dfg/DFGDriver.h:
(DFG):
(JSC::DFG::tryCompile):
(JSC::DFG::tryCompileFunction):
* dfg/DFGGraph.h:
(Graph):
* dfg/DFGJITCode.cpp: Added.
(DFG):
(JSC::DFG::JITCode::JITCode):
(JSC::DFG::JITCode::~JITCode):
(JSC::DFG::JITCode::dfgCommon):
(JSC::DFG::JITCode::dfg):
(JSC::DFG::JITCode::shrinkToFit):
* dfg/DFGJITCode.h: Added.
(DFG):
(JITCode):
(JSC::DFG::JITCode::appendOSREntryData):
(JSC::DFG::JITCode::osrEntryDataForBytecodeIndex):
(JSC::DFG::JITCode::appendOSRExit):
(JSC::DFG::JITCode::lastOSRExit):
(JSC::DFG::JITCode::appendSpeculationRecovery):
(JSC::DFG::JITCode::appendWatchpoint):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
* dfg/DFGJITCompiler.h:
(JITCompiler):
(JSC::DFG::JITCompiler::addWeakReference):
(JSC::DFG::JITCompiler::noticeOSREntry):
(JSC::DFG::JITCompiler::jitCode):
* dfg/DFGOSREntry.cpp:
(JSC::DFG::prepareOSREntry):
* dfg/DFGOSRExit.h:
(OSRExit):
* dfg/DFGOSRExitCompiler.cpp:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::SpeculativeJIT):
(JSC::DFG::SpeculativeJIT::backwardSpeculationCheck):
(JSC::DFG::SpeculativeJIT::speculationWatchpoint):
(JSC::DFG::SpeculativeJIT::convertLastOSRExitToForward):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGVariableEventStream.cpp:
* heap/DFGCodeBlocks.cpp:
(JSC::DFGCodeBlocks::~DFGCodeBlocks):
(JSC::DFGCodeBlocks::jettison):
(JSC::DFGCodeBlocks::clearMarks):
(JSC::DFGCodeBlocks::deleteUnmarkedJettisonedCodeBlocks):
(JSC::DFGCodeBlocks::traceMarkedCodeBlocks):
* jit/JITCode.cpp:
(JSC::JITCode::dfgCommon):
(JSC):
(JSC::JITCode::dfg):
(JSC::JITCode::ftl):
(JSC::DirectJITCode::DirectJITCode):
(JSC::DirectJITCode::initializeCodeRef):
(JSC::DirectJITCode::addressForCall):
(JSC::DirectJITCode::executableAddressAtOffset):
(JSC::DirectJITCode::dataAddressAtOffset):
(JSC::DirectJITCode::offsetOf):
(JSC::DirectJITCode::size):
(JSC::DirectJITCode::contains):
* jit/JITCode.h:
(DFG):
(FTL):
(JSC):
(JITCode):
(DirectJITCode):
2013-07-15 Oliver Hunt <oliver@apple.com>
Merge dfgFourthTier r147587
......
......@@ -201,6 +201,8 @@ javascriptcore_sources += \
Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.h \
Source/JavaScriptCore/dfg/DFGCommon.cpp \
Source/JavaScriptCore/dfg/DFGCommon.h \
Source/JavaScriptCore/dfg/DFGCommonData.cpp \
Source/JavaScriptCore/dfg/DFGCommonData.h \
Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp \
Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.h \
Source/JavaScriptCore/dfg/DFGCSEPhase.cpp \
......@@ -224,6 +226,8 @@ javascriptcore_sources += \
Source/JavaScriptCore/dfg/DFGGraph.cpp \
Source/JavaScriptCore/dfg/DFGGraph.h \
Source/JavaScriptCore/dfg/DFGInsertionSet.h \
Source/JavaScriptCore/dfg/DFGJITCode.cpp \
Source/JavaScriptCore/dfg/DFGJITCode.h \
Source/JavaScriptCore/dfg/DFGJITCompiler.cpp \
Source/JavaScriptCore/dfg/DFGJITCompiler.h \
Source/JavaScriptCore/dfg/DFGLongLivedState.cpp \
......
......@@ -280,6 +280,10 @@
0FDDBFB61666EEDA00C55FEF /* DFGVariableAccessDataDump.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDDBFB31666EED500C55FEF /* DFGVariableAccessDataDump.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FE228ED1436AB2700196C48 /* Options.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE228EB1436AB2300196C48 /* Options.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FE228EE1436AB2C00196C48 /* Options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE228EA1436AB2300196C48 /* Options.cpp */; };
0FEA0A31170D40BF00BB722C /* DFGCommonData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA0A2D170D40BF00BB722C /* DFGCommonData.cpp */; };
0FEA0A32170D40BF00BB722C /* DFGCommonData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEA0A2E170D40BF00BB722C /* DFGCommonData.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FEA0A33170D40BF00BB722C /* DFGJITCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA0A2F170D40BF00BB722C /* DFGJITCode.cpp */; };
0FEA0A34170D40BF00BB722C /* DFGJITCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEA0A30170D40BF00BB722C /* DFGJITCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FEB3ECD16237F4D00AB67AD /* TypedArrayDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FEB3ECF16237F6C00AB67AD /* MacroAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB3ECE16237F6700AB67AD /* MacroAssembler.cpp */; };
0FEFC9AA1681A3B300567F53 /* DFGOSRExitJumpPlaceholder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEFC9A71681A3B000567F53 /* DFGOSRExitJumpPlaceholder.cpp */; };
......@@ -1207,6 +1211,10 @@
0FDDBFB31666EED500C55FEF /* DFGVariableAccessDataDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGVariableAccessDataDump.h; path = dfg/DFGVariableAccessDataDump.h; sourceTree = "<group>"; };
0FE228EA1436AB2300196C48 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Options.cpp; sourceTree = "<group>"; };
0FE228EB1436AB2300196C48 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Options.h; sourceTree = "<group>"; };
0FEA0A2D170D40BF00BB722C /* DFGCommonData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGCommonData.cpp; path = dfg/DFGCommonData.cpp; sourceTree = "<group>"; };
0FEA0A2E170D40BF00BB722C /* DFGCommonData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCommonData.h; path = dfg/DFGCommonData.h; sourceTree = "<group>"; };
0FEA0A2F170D40BF00BB722C /* DFGJITCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGJITCode.cpp; path = dfg/DFGJITCode.cpp; sourceTree = "<group>"; };
0FEA0A30170D40BF00BB722C /* DFGJITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGJITCode.h; path = dfg/DFGJITCode.h; sourceTree = "<group>"; };
0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedArrayDescriptor.h; sourceTree = "<group>"; };
0FEB3ECE16237F6700AB67AD /* MacroAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssembler.cpp; sourceTree = "<group>"; };
0FEFC9A71681A3B000567F53 /* DFGOSRExitJumpPlaceholder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitJumpPlaceholder.cpp; path = dfg/DFGOSRExitJumpPlaceholder.cpp; sourceTree = "<group>"; };
......@@ -2700,6 +2708,8 @@
0F3B3A251544C991003ED0FF /* DFGCFGSimplificationPhase.h */,
0FB4B51A16B62772003F696B /* DFGCommon.cpp */,
0FC0977E1469EBC400CF2442 /* DFGCommon.h */,
0FEA0A2D170D40BF00BB722C /* DFGCommonData.cpp */,
0FEA0A2E170D40BF00BB722C /* DFGCommonData.h */,
0F3B3A17153E68EF003ED0FF /* DFGConstantFoldingPhase.cpp */,
0F3B3A18153E68EF003ED0FF /* DFGConstantFoldingPhase.h */,
0FBE0F6B16C1DB010082C5E8 /* DFGCPSRethreadingPhase.cpp */,
......@@ -2725,6 +2735,8 @@
86EC9DB71328DF82002B2AD7 /* DFGGraph.cpp */,
86EC9DB81328DF82002B2AD7 /* DFGGraph.h */,
0F2BDC1F151E803800CD8910 /* DFGInsertionSet.h */,
0FEA0A2F170D40BF00BB722C /* DFGJITCode.cpp */,
0FEA0A30170D40BF00BB722C /* DFGJITCode.h */,
86EC9DBB1328DF82002B2AD7 /* DFGJITCompiler.cpp */,
86EC9DBC1328DF82002B2AD7 /* DFGJITCompiler.h */,
0FB4B51C16B62772003F696B /* DFGLongLivedState.cpp */,
......@@ -3132,6 +3144,7 @@
0F2BDC491522809600CD8910 /* DFGVariableEvent.h in Headers */,
0F2BDC4B1522809D00CD8910 /* DFGVariableEventStream.h in Headers */,
0FFB921E16D02F470055A5DB /* DFGVariadicFunction.h in Headers */,
0FEA0A32170D40BF00BB722C /* DFGCommonData.h in Headers */,
0FFFC96014EF90BD00C72532 /* DFGVirtualRegisterAllocationPhase.h in Headers */,
0FF42731158EBD54004CB9FF /* Disassembler.h in Headers */,
BC3046070E1F497F003232CF /* Error.h in Headers */,
......@@ -3320,6 +3333,7 @@
BC18C4440E16F5CD00B34460 /* NumberPrototype.h in Headers */,
142D3939103E4560007DCB52 /* NumericStrings.h in Headers */,
86F3EEBD168CDE930077B92A /* ObjCCallbackFunction.h in Headers */,
0FEA0A34170D40BF00BB722C /* DFGJITCode.h in Headers */,
86F3EEBF168CDE930077B92A /* ObjcRuntimeExtras.h in Headers */,
14CA958D16AB50FA00938A06 /* ObjectAllocationProfile.h in Headers */,
BC18C4450E16F5CD00B34460 /* ObjectConstructor.h in Headers */,
......@@ -3907,6 +3921,7 @@
86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */,
0F56A1D515001CF4002992B1 /* ExecutionCounter.cpp in Sources */,
0FB105851675480F00F8AB6E /* ExitKind.cpp in Sources */,
0FEA0A31170D40BF00BB722C /* DFGCommonData.cpp in Sources */,
147F39CB107EC37600427A48 /* FunctionConstructor.cpp in Sources */,
0FF0F19F16B72A17005DF95B /* FunctionExecutableDump.cpp in Sources */,
147F39CC107EC37600427A48 /* FunctionPrototype.cpp in Sources */,
......@@ -4043,6 +4058,7 @@
0F13912916771C33009CCB07 /* ProfilerBytecodeSequence.cpp in Sources */,
0FF729AF166AD35C000F5BA3 /* ProfilerCompilation.cpp in Sources */,
0FF729B0166AD35C000F5BA3 /* ProfilerCompilationKind.cpp in Sources */,
0FEA0A33170D40BF00BB722C /* DFGJITCode.cpp in Sources */,
0FF729B1166AD35C000F5BA3 /* ProfilerCompiledBytecode.cpp in Sources */,
0FF729B2166AD35C000F5BA3 /* ProfilerDatabase.cpp in Sources */,
0FF729B3166AD35C000F5BA3 /* ProfilerOrigin.cpp in Sources */,
......
......@@ -119,6 +119,7 @@ SOURCES += \
dfg/DFGByteCodeParser.cpp \
dfg/DFGCapabilities.cpp \
dfg/DFGCommon.cpp \
dfg/DFGCommonData.cpp \
dfg/DFGCFAPhase.cpp \
dfg/DFGCFGSimplificationPhase.cpp \
dfg/DFGCPSRethreadingPhase.cpp \
......@@ -131,6 +132,7 @@ SOURCES += \
dfg/DFGEdge.cpp \
dfg/DFGFixupPhase.cpp \
dfg/DFGGraph.cpp \
dfg/DFGJITCode.cpp \
dfg/DFGJITCompiler.cpp \
dfg/DFGLongLivedState.cpp \
dfg/DFGMinifiedNode.cpp \
......
......@@ -62,10 +62,6 @@
namespace JSC {
#if ENABLE(DFG_JIT)
using namespace DFG;
#endif
String CodeBlock::inferredName() const
{
switch (codeType()) {
......@@ -1442,7 +1438,7 @@ void CodeBlock::dumpBytecode(PrintStream& out, ExecState* exec, const Instructio
#endif
#if ENABLE(DFG_JIT)
Vector<FrequentExitSite> exitSites = exitProfile().exitSitesFor(location);
Vector<DFG::FrequentExitSite> exitSites = exitProfile().exitSitesFor(location);
if (!exitSites.isEmpty()) {
out.print(" !! frequent exits: ");
CommaPrinter comma;
......@@ -2076,13 +2072,15 @@ void EvalCodeCache::visitAggregate(SlotVisitor& visitor)
void CodeBlock::visitAggregate(SlotVisitor& visitor)
{
#if ENABLE(PARALLEL_GC) && ENABLE(DFG_JIT)
if (!!m_dfgData) {
if (JITCode::isOptimizingJIT(getJITType())) {
DFG::CommonData* dfgCommon = m_jitCode->dfgCommon();
// I may be asked to scan myself more than once, and it may even happen concurrently.
// To this end, use a CAS loop to check if I've been called already. Only one thread
// may proceed past this point - whichever one wins the CAS race.
unsigned oldValue;
do {
oldValue = m_dfgData->visitAggregateHasBeenCalled;
oldValue = dfgCommon->visitAggregateHasBeenCalled;
if (oldValue) {
// Looks like someone else won! Return immediately to ensure that we don't
// trace the same CodeBlock concurrently. Doing so is hazardous since we will
......@@ -2097,7 +2095,7 @@ void CodeBlock::visitAggregate(SlotVisitor& visitor)
// termination.
return;
}
} while (!WTF::weakCompareAndSwap(&m_dfgData->visitAggregateHasBeenCalled, 0, 1));
} while (!WTF::weakCompareAndSwap(&dfgCommon->visitAggregateHasBeenCalled, 0, 1));
}
#endif // ENABLE(PARALLEL_GC) && ENABLE(DFG_JIT)
......@@ -2129,15 +2127,15 @@ void CodeBlock::visitAggregate(SlotVisitor& visitor)
// other reasons, that this iteration should run again; it will notify us of this
// decision by calling harvestWeakReferences().
m_dfgData->livenessHasBeenProved = false;
m_dfgData->allTransitionsHaveBeenMarked = false;
m_jitCode->dfgCommon()->livenessHasBeenProved = false;
m_jitCode->dfgCommon()->allTransitionsHaveBeenMarked = false;
performTracingFixpointIteration(visitor);
// GC doesn't have enough information yet for us to decide whether to keep our DFG
// data, so we need to register a handler to run again at the end of GC, when more
// information is available.
if (!(m_dfgData->livenessHasBeenProved && m_dfgData->allTransitionsHaveBeenMarked))
if (!(m_jitCode->dfgCommon()->livenessHasBeenProved && m_jitCode->dfgCommon()->allTransitionsHaveBeenMarked))
visitor.addWeakReferenceHarvester(this);
#else // ENABLE(DFG_JIT)
......@@ -2151,12 +2149,13 @@ void CodeBlock::performTracingFixpointIteration(SlotVisitor& visitor)
#if ENABLE(DFG_JIT)
// Evaluate our weak reference transitions, if there are still some to evaluate.
if (!m_dfgData->allTransitionsHaveBeenMarked) {
DFG::CommonData* dfgCommon = m_jitCode->dfgCommon();
if (!dfgCommon->allTransitionsHaveBeenMarked) {
bool allAreMarkedSoFar = true;
for (unsigned i = 0; i < m_dfgData->transitions.size(); ++i) {
if ((!m_dfgData->transitions[i].m_codeOrigin
|| Heap::isMarked(m_dfgData->transitions[i].m_codeOrigin.get()))
&& Heap::isMarked(m_dfgData->transitions[i].m_from.get())) {
for (unsigned i = 0; i < dfgCommon->transitions.size(); ++i) {
if ((!dfgCommon->transitions[i].m_codeOrigin
|| Heap::isMarked(dfgCommon->transitions[i].m_codeOrigin.get()))
&& Heap::isMarked(dfgCommon->transitions[i].m_from.get())) {
// If the following three things are live, then the target of the
// transition is also live:
// - This code block. We know it's live already because otherwise
......@@ -2168,25 +2167,25 @@ void CodeBlock::performTracingFixpointIteration(SlotVisitor& visitor)
// - The source of the transition. The transition checks if some
// heap location holds the source, and if so, stores the target.
// Hence the source must be live for the transition to be live.
visitor.append(&m_dfgData->transitions[i].m_to);
visitor.append(&dfgCommon->transitions[i].m_to);
} else
allAreMarkedSoFar = false;
}
if (allAreMarkedSoFar)
m_dfgData->allTransitionsHaveBeenMarked = true;
dfgCommon->allTransitionsHaveBeenMarked = true;
}
// Check if we have any remaining work to do.
if (m_dfgData->livenessHasBeenProved)
if (dfgCommon->livenessHasBeenProved)
return;
// Now check all of our weak references. If all of them are live, then we
// have proved liveness and so we scan our strong references. If at end of
// GC we still have not proved liveness, then this code block is toast.
bool allAreLiveSoFar = true;
for (unsigned i = 0; i < m_dfgData->weakReferences.size(); ++i) {
if (!Heap::isMarked(m_dfgData->weakReferences[i].get())) {
for (unsigned i = 0; i < dfgCommon->weakReferences.size(); ++i) {
if (!Heap::isMarked(dfgCommon->weakReferences[i].get())) {
allAreLiveSoFar = false;
break;
}
......@@ -2199,7 +2198,7 @@ void CodeBlock::performTracingFixpointIteration(SlotVisitor& visitor)
// All weak references are live. Record this information so we don't
// come back here again, and scan the strong references.
m_dfgData->livenessHasBeenProved = true;
dfgCommon->livenessHasBeenProved = true;
stronglyVisitStrongReferences(visitor);
#endif // ENABLE(DFG_JIT)
}
......@@ -2275,14 +2274,15 @@ void CodeBlock::finalizeUnconditionally()
#if ENABLE(DFG_JIT)
// Check if we're not live. If we are, then jettison.
if (!(shouldImmediatelyAssumeLivenessDuringScan() || m_dfgData->livenessHasBeenProved)) {
if (!(shouldImmediatelyAssumeLivenessDuringScan() || m_jitCode->dfgCommon()->livenessHasBeenProved)) {
if (verboseUnlinking)
dataLog(*this, " has dead weak references, jettisoning during GC.\n");
if (DFG::shouldShowDisassembly()) {
dataLog(*this, " will be jettisoned because of the following dead references:\n");
for (unsigned i = 0; i < m_dfgData->transitions.size(); ++i) {
WeakReferenceTransition& transition = m_dfgData->transitions[i];
DFG::CommonData* dfgCommon = m_jitCode->dfgCommon();
for (unsigned i = 0; i < dfgCommon->transitions.size(); ++i) {
DFG::WeakReferenceTransition& transition = dfgCommon->transitions[i];
JSCell* origin = transition.m_codeOrigin.get();
JSCell* from = transition.m_from.get();
JSCell* to = transition.m_to.get();
......@@ -2290,8 +2290,8 @@ void CodeBlock::finalizeUnconditionally()
continue;
dataLog(" Transition under ", JSValue(origin), ", ", JSValue(from), " -> ", JSValue(to), ".\n");
}
for (unsigned i = 0; i < m_dfgData->weakReferences.size(); ++i) {
JSCell* weak = m_dfgData->weakReferences[i].get();
for (unsigned i = 0; i < dfgCommon->weakReferences.size(); ++i) {
JSCell* weak = dfgCommon->weakReferences[i].get();
if (Heap::isMarked(weak))
continue;
dataLog(" Weak reference ", JSValue(weak), ".\n");
......@@ -2438,18 +2438,20 @@ void CodeBlock::stronglyVisitWeakReferences(SlotVisitor& visitor)
UNUSED_PARAM(visitor);
#if ENABLE(DFG_JIT)
if (!m_dfgData)
if (!JITCode::isOptimizingJIT(getJITType()))
return;
DFG::CommonData* dfgCommon = m_jitCode->dfgCommon();
for (unsigned i = 0; i < m_dfgData->transitions.size(); ++i) {
if (!!m_dfgData->transitions[i].m_codeOrigin)
visitor.append(&m_dfgData->transitions[i].m_codeOrigin); // Almost certainly not necessary, since the code origin should also be a weak reference. Better to be safe, though.
visitor.append(&m_dfgData->transitions[i].m_from);
visitor.append(&m_dfgData->transitions[i].m_to);
for (unsigned i = 0; i < dfgCommon->transitions.size(); ++i) {
if (!!dfgCommon->transitions[i].m_codeOrigin)
visitor.append(&dfgCommon->transitions[i].m_codeOrigin); // Almost certainly not necessary, since the code origin should also be a weak reference. Better to be safe, though.
visitor.append(&dfgCommon->transitions[i].m_from);
visitor.append(&dfgCommon->transitions[i].m_to);
}
for (unsigned i = 0; i < m_dfgData->weakReferences.size(); ++i)
visitor.append(&m_dfgData->weakReferences[i]);
for (unsigned i = 0; i < dfgCommon->weakReferences.size(); ++i)
visitor.append(&dfgCommon->weakReferences[i]);
#endif
}
......@@ -2530,18 +2532,6 @@ void CodeBlock::shrinkToFit(ShrinkMode shrinkMode)
m_rareData->m_codeOrigins.shrinkToFit();
#endif
}
#if ENABLE(DFG_JIT)
if (m_dfgData) {
m_dfgData->osrEntry.shrinkToFit();
m_dfgData->osrExit.shrinkToFit();
m_dfgData->speculationRecovery.shrinkToFit();
m_dfgData->weakReferences.shrinkToFit();
m_dfgData->transitions.shrinkToFit();
m_dfgData->minifiedDFG.prepareAndShrink();
m_dfgData->variableEventStream.shrinkToFit();
}
#endif
}
void CodeBlock::createActivation(CallFrame* callFrame)
......@@ -3238,12 +3228,12 @@ void CodeBlock::tallyFrequentExitSites()
{
ASSERT(JITCode::isOptimizingJIT(getJITType()));
ASSERT(alternative()->getJITType() == JITCode::BaselineJIT);
ASSERT(!!m_dfgData);
CodeBlock* profiledBlock = alternative();
for (unsigned i = 0; i < m_dfgData->osrExit.size(); ++i) {
DFG::OSRExit& exit = m_dfgData->osrExit[i];
DFG::JITCode* jitCode = m_jitCode->dfg();
for (unsigned i = 0; i < jitCode->osrExit.size(); ++i) {
DFG::OSRExit& exit = jitCode->osrExit[i];
if (!exit.considerAddingAsFrequentExitSite(profiledBlock))
continue;
......
......@@ -41,6 +41,7 @@
#include "CompactJITCodeMap.h"
#include "DFGCodeBlocks.h"
#include "DFGCommon.h"
#include "DFGCommonData.h"
#include "DFGExitProfile.h"
#include "DFGMinifiedGraph.h"
#include "DFGOSREntry.h"
......@@ -267,144 +268,6 @@ public:
}
#endif
#if ENABLE(DFG_JIT)
void createDFGDataIfNecessary()
{
if (!!m_dfgData)
return;
m_dfgData = adoptPtr(new DFGData);
}
void saveCompilation(PassRefPtr<Profiler::Compilation> compilation)
{
createDFGDataIfNecessary();
m_dfgData->compilation = compilation;
}
Profiler::Compilation* compilation()
{
if (!m_dfgData)
return 0;
return m_dfgData->compilation.get();
}
DFG::OSREntryData* appendDFGOSREntryData(unsigned bytecodeIndex, unsigned machineCodeOffset)
{
createDFGDataIfNecessary();
DFG::OSREntryData entry;
entry.m_bytecodeIndex = bytecodeIndex;
entry.m_machineCodeOffset = machineCodeOffset;
m_dfgData->osrEntry.append(entry);
return &m_dfgData->osrEntry.last();
}
unsigned numberOfDFGOSREntries() const
{
if (!m_dfgData)
return 0;
return m_dfgData->osrEntry.size();
}
DFG::OSREntryData* dfgOSREntryData(unsigned i) { return &m_dfgData->osrEntry[i]; }
DFG::OSREntryData* dfgOSREntryDataForBytecodeIndex(unsigned bytecodeIndex)
{
if (!m_dfgData)
return 0;
return tryBinarySearch<DFG::OSREntryData, unsigned>(
m_dfgData->osrEntry, m_dfgData->osrEntry.size(), bytecodeIndex,
DFG::getOSREntryDataBytecodeIndex);
}
unsigned appendOSRExit(const DFG::OSRExit& osrExit)
{
createDFGDataIfNecessary();
unsigned result = m_dfgData->osrExit.size();
m_dfgData->osrExit.append(osrExit);
return result;
}
DFG::OSRExit& lastOSRExit()
{
return m_dfgData->osrExit.last();
}
unsigned appendSpeculationRecovery(const DFG::SpeculationRecovery& recovery)
{
createDFGDataIfNecessary();
unsigned result = m_dfgData->speculationRecovery.size();
m_dfgData->speculationRecovery.append(recovery);
return result;
}
unsigned appendWatchpoint(const JumpReplacementWatchpoint& watchpoint)
{
createDFGDataIfNecessary();
unsigned result = m_dfgData->watchpoints.size();
m_dfgData->watchpoints.append(watchpoint);
return result;
}
unsigned numberOfOSRExits()
{
if (!m_dfgData)
return 0;
return m_dfgData->osrExit.size();
}
unsigned numberOfSpeculationRecoveries()
{
if (!m_dfgData)
return 0;
return m_dfgData->speculationRecovery.size();
}
unsigned numberOfWatchpoints()
{
if (!m_dfgData)
return 0;
return m_dfgData->watchpoints.size();
}
DFG::OSRExit& osrExit(unsigned index)
{
return m_dfgData->osrExit[index];
}
DFG::SpeculationRecovery& speculationRecovery(unsigned index)
{
return m_dfgData->speculationRecovery[index];
}
JumpReplacementWatchpoint& watchpoint(unsigned index)