Skip to content

Commit 39a8f3e

Browse files
author
Filip Pizlo
committed
DFG should allow phases to break Phi's and then have one phase to rebuild them
https://bugs.webkit.org/show_bug.cgi?id=108414 Reviewed by Mark Hahnenberg. Introduces two new DFG forms: LoadStore and ThreadedCPS. These are described in detail in DFGCommon.h. Consequently, DFG phases no longer have to worry about preserving data flow links between basic blocks. It is generally always safe to request that the graph be dethreaded (Graph::dethread), which brings it into LoadStore form, where the data flow is implicit. In this form, only liveness-at-head needs to be preserved. All of the machinery for "threading" the graph to introduce data flow between blocks is now moved out of the bytecode parser and into the CPSRethreadingPhase. All phases that previously did this maintenance themselves now just rely on being able to dethread the graph. The one exception is the structure check hoising phase, which operates over a threaded graph and preserves it, for the sake of performance. Also moved two other things into their own phases: unification (previously found in the parser) and prediction injection (previously found in various places). * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.xcodeproj/project.pbxproj: * Target.pri: * bytecode/Operands.h: (Operands): (JSC::Operands::sizeFor): (JSC::Operands::atFor): * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::execute): (JSC::DFG::AbstractState::mergeStateAtTail): * dfg/DFGAllocator.h: (JSC::DFG::::allocateSlow): * dfg/DFGArgumentsSimplificationPhase.cpp: (JSC::DFG::ArgumentsSimplificationPhase::run): * dfg/DFGBasicBlockInlines.h: (DFG): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getLocal): (JSC::DFG::ByteCodeParser::getArgument): (JSC::DFG::ByteCodeParser::flushDirect): (JSC::DFG::ByteCodeParser::parseBlock): (DFG): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCFGSimplificationPhase.cpp: (JSC::DFG::CFGSimplificationPhase::run): (JSC::DFG::CFGSimplificationPhase::killUnreachable): (JSC::DFG::CFGSimplificationPhase::keepOperandAlive): (CFGSimplificationPhase): (JSC::DFG::CFGSimplificationPhase::fixJettisonedPredecessors): (JSC::DFG::CFGSimplificationPhase::mergeBlocks): * dfg/DFGCPSRethreadingPhase.cpp: Added. (DFG): (CPSRethreadingPhase): (JSC::DFG::CPSRethreadingPhase::CPSRethreadingPhase): (JSC::DFG::CPSRethreadingPhase::run): (JSC::DFG::CPSRethreadingPhase::freeUnnecessaryNodes): (JSC::DFG::CPSRethreadingPhase::clearVariablesAtHeadAndTail): (JSC::DFG::CPSRethreadingPhase::addPhiSilently): (JSC::DFG::CPSRethreadingPhase::addPhi): (JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocalFor): (JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocal): (JSC::DFG::CPSRethreadingPhase::canonicalizeSetLocal): (JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocalFor): (JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocal): (JSC::DFG::CPSRethreadingPhase::canonicalizeSetArgument): (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock): (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlocks): (JSC::DFG::CPSRethreadingPhase::propagatePhis): (JSC::DFG::CPSRethreadingPhase::PhiStackEntry::PhiStackEntry): (PhiStackEntry): (JSC::DFG::CPSRethreadingPhase::phiStackFor): (JSC::DFG::performCPSRethreading): * dfg/DFGCPSRethreadingPhase.h: Added. (DFG): * dfg/DFGCSEPhase.cpp: (CSEPhase): (JSC::DFG::CSEPhase::performNodeCSE): * dfg/DFGCommon.cpp: (WTF): (WTF::printInternal): * dfg/DFGCommon.h: (JSC::DFG::logCompilationChanges): (DFG): (WTF): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDriver.cpp: (JSC::DFG::compile): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::Graph): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dethread): (JSC::DFG::Graph::collectGarbage): * dfg/DFGGraph.h: (JSC::DFG::Graph::performSubstitution): (Graph): (JSC::DFG::Graph::performSubstitutionForEdge): (JSC::DFG::Graph::convertToConstant): * dfg/DFGNode.h: (JSC::DFG::Node::convertToPhantomLocal): (Node): (JSC::DFG::Node::convertToGetLocal): (JSC::DFG::Node::hasVariableAccessData): * dfg/DFGNodeType.h: (DFG): * dfg/DFGPhase.cpp: (JSC::DFG::Phase::beginPhase): * dfg/DFGPhase.h: (JSC::DFG::runAndLog): * dfg/DFGPredictionInjectionPhase.cpp: Added. (DFG): (PredictionInjectionPhase): (JSC::DFG::PredictionInjectionPhase::PredictionInjectionPhase): (JSC::DFG::PredictionInjectionPhase::run): (JSC::DFG::performPredictionInjection): * dfg/DFGPredictionInjectionPhase.h: Added. (DFG): * dfg/DFGPredictionPropagationPhase.cpp: (JSC::DFG::PredictionPropagationPhase::run): (JSC::DFG::PredictionPropagationPhase::propagate): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStructureCheckHoistingPhase.cpp: (JSC::DFG::StructureCheckHoistingPhase::run): * dfg/DFGUnificationPhase.cpp: Added. (DFG): (UnificationPhase): (JSC::DFG::UnificationPhase::UnificationPhase): (JSC::DFG::UnificationPhase::run): (JSC::DFG::performUnification): * dfg/DFGUnificationPhase.h: Added. (DFG): * dfg/DFGValidate.cpp: (JSC::DFG::Validate::validate): (JSC::DFG::Validate::dumpGraphIfAppropriate): * dfg/DFGVirtualRegisterAllocationPhase.cpp: (JSC::DFG::VirtualRegisterAllocationPhase::run): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * runtime/JSCJSValue.cpp: (JSC::JSValue::dump): * runtime/JSString.h: (JSString): * runtime/Options.h: (JSC): Canonical link: https://commits.webkit.org/127618@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent e90ee29 commit 39a8f3e

39 files changed

Lines changed: 1514 additions & 707 deletions

‎Source/JavaScriptCore/CMakeLists.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ set(JavaScriptCore_SOURCES
8282
dfg/DFGCommon.cpp
8383
dfg/DFGCFAPhase.cpp
8484
dfg/DFGCFGSimplificationPhase.cpp
85+
dfg/DFGCPSRethreadingPhase.cpp
8586
dfg/DFGConstantFoldingPhase.cpp
8687
dfg/DFGCSEPhase.cpp
8788
dfg/DFGDisassembler.cpp
@@ -104,12 +105,14 @@ set(JavaScriptCore_SOURCES
104105
dfg/DFGOperations.cpp
105106
dfg/DFGPhase.cpp
106107
dfg/DFGPredictionPropagationPhase.cpp
108+
dfg/DFGPredictionInjectionPhase.cpp
107109
dfg/DFGRepatch.cpp
108110
dfg/DFGSpeculativeJIT.cpp
109111
dfg/DFGSpeculativeJIT32_64.cpp
110112
dfg/DFGSpeculativeJIT64.cpp
111113
dfg/DFGStructureCheckHoistingPhase.cpp
112114
dfg/DFGThunks.cpp
115+
dfg/DFGUnificationPhase.cpp
113116
dfg/DFGValueSource.cpp
114117
dfg/DFGVariableAccessDataDump.cpp
115118
dfg/DFGVariableEvent.cpp

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,158 @@
1+
2013-02-08 Filip Pizlo <fpizlo@apple.com>
2+
3+
DFG should allow phases to break Phi's and then have one phase to rebuild them
4+
https://bugs.webkit.org/show_bug.cgi?id=108414
5+
6+
Reviewed by Mark Hahnenberg.
7+
8+
Introduces two new DFG forms: LoadStore and ThreadedCPS. These are described in
9+
detail in DFGCommon.h.
10+
11+
Consequently, DFG phases no longer have to worry about preserving data flow
12+
links between basic blocks. It is generally always safe to request that the
13+
graph be dethreaded (Graph::dethread), which brings it into LoadStore form, where
14+
the data flow is implicit. In this form, only liveness-at-head needs to be
15+
preserved.
16+
17+
All of the machinery for "threading" the graph to introduce data flow between
18+
blocks is now moved out of the bytecode parser and into the CPSRethreadingPhase.
19+
All phases that previously did this maintenance themselves now just rely on
20+
being able to dethread the graph. The one exception is the structure check
21+
hoising phase, which operates over a threaded graph and preserves it, for the
22+
sake of performance.
23+
24+
Also moved two other things into their own phases: unification (previously found
25+
in the parser) and prediction injection (previously found in various places).
26+
27+
* CMakeLists.txt:
28+
* GNUmakefile.list.am:
29+
* JavaScriptCore.xcodeproj/project.pbxproj:
30+
* Target.pri:
31+
* bytecode/Operands.h:
32+
(Operands):
33+
(JSC::Operands::sizeFor):
34+
(JSC::Operands::atFor):
35+
* dfg/DFGAbstractState.cpp:
36+
(JSC::DFG::AbstractState::execute):
37+
(JSC::DFG::AbstractState::mergeStateAtTail):
38+
* dfg/DFGAllocator.h:
39+
(JSC::DFG::::allocateSlow):
40+
* dfg/DFGArgumentsSimplificationPhase.cpp:
41+
(JSC::DFG::ArgumentsSimplificationPhase::run):
42+
* dfg/DFGBasicBlockInlines.h:
43+
(DFG):
44+
* dfg/DFGByteCodeParser.cpp:
45+
(JSC::DFG::ByteCodeParser::getLocal):
46+
(JSC::DFG::ByteCodeParser::getArgument):
47+
(JSC::DFG::ByteCodeParser::flushDirect):
48+
(JSC::DFG::ByteCodeParser::parseBlock):
49+
(DFG):
50+
(JSC::DFG::ByteCodeParser::parse):
51+
* dfg/DFGCFGSimplificationPhase.cpp:
52+
(JSC::DFG::CFGSimplificationPhase::run):
53+
(JSC::DFG::CFGSimplificationPhase::killUnreachable):
54+
(JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
55+
(CFGSimplificationPhase):
56+
(JSC::DFG::CFGSimplificationPhase::fixJettisonedPredecessors):
57+
(JSC::DFG::CFGSimplificationPhase::mergeBlocks):
58+
* dfg/DFGCPSRethreadingPhase.cpp: Added.
59+
(DFG):
60+
(CPSRethreadingPhase):
61+
(JSC::DFG::CPSRethreadingPhase::CPSRethreadingPhase):
62+
(JSC::DFG::CPSRethreadingPhase::run):
63+
(JSC::DFG::CPSRethreadingPhase::freeUnnecessaryNodes):
64+
(JSC::DFG::CPSRethreadingPhase::clearVariablesAtHeadAndTail):
65+
(JSC::DFG::CPSRethreadingPhase::addPhiSilently):
66+
(JSC::DFG::CPSRethreadingPhase::addPhi):
67+
(JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocalFor):
68+
(JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocal):
69+
(JSC::DFG::CPSRethreadingPhase::canonicalizeSetLocal):
70+
(JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocalFor):
71+
(JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocal):
72+
(JSC::DFG::CPSRethreadingPhase::canonicalizeSetArgument):
73+
(JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock):
74+
(JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlocks):
75+
(JSC::DFG::CPSRethreadingPhase::propagatePhis):
76+
(JSC::DFG::CPSRethreadingPhase::PhiStackEntry::PhiStackEntry):
77+
(PhiStackEntry):
78+
(JSC::DFG::CPSRethreadingPhase::phiStackFor):
79+
(JSC::DFG::performCPSRethreading):
80+
* dfg/DFGCPSRethreadingPhase.h: Added.
81+
(DFG):
82+
* dfg/DFGCSEPhase.cpp:
83+
(CSEPhase):
84+
(JSC::DFG::CSEPhase::performNodeCSE):
85+
* dfg/DFGCommon.cpp:
86+
(WTF):
87+
(WTF::printInternal):
88+
* dfg/DFGCommon.h:
89+
(JSC::DFG::logCompilationChanges):
90+
(DFG):
91+
(WTF):
92+
* dfg/DFGConstantFoldingPhase.cpp:
93+
(JSC::DFG::ConstantFoldingPhase::foldConstants):
94+
* dfg/DFGDriver.cpp:
95+
(JSC::DFG::compile):
96+
* dfg/DFGGraph.cpp:
97+
(JSC::DFG::Graph::Graph):
98+
(JSC::DFG::Graph::dump):
99+
(JSC::DFG::Graph::dethread):
100+
(JSC::DFG::Graph::collectGarbage):
101+
* dfg/DFGGraph.h:
102+
(JSC::DFG::Graph::performSubstitution):
103+
(Graph):
104+
(JSC::DFG::Graph::performSubstitutionForEdge):
105+
(JSC::DFG::Graph::convertToConstant):
106+
* dfg/DFGNode.h:
107+
(JSC::DFG::Node::convertToPhantomLocal):
108+
(Node):
109+
(JSC::DFG::Node::convertToGetLocal):
110+
(JSC::DFG::Node::hasVariableAccessData):
111+
* dfg/DFGNodeType.h:
112+
(DFG):
113+
* dfg/DFGPhase.cpp:
114+
(JSC::DFG::Phase::beginPhase):
115+
* dfg/DFGPhase.h:
116+
(JSC::DFG::runAndLog):
117+
* dfg/DFGPredictionInjectionPhase.cpp: Added.
118+
(DFG):
119+
(PredictionInjectionPhase):
120+
(JSC::DFG::PredictionInjectionPhase::PredictionInjectionPhase):
121+
(JSC::DFG::PredictionInjectionPhase::run):
122+
(JSC::DFG::performPredictionInjection):
123+
* dfg/DFGPredictionInjectionPhase.h: Added.
124+
(DFG):
125+
* dfg/DFGPredictionPropagationPhase.cpp:
126+
(JSC::DFG::PredictionPropagationPhase::run):
127+
(JSC::DFG::PredictionPropagationPhase::propagate):
128+
* dfg/DFGSpeculativeJIT32_64.cpp:
129+
(JSC::DFG::SpeculativeJIT::compile):
130+
* dfg/DFGSpeculativeJIT64.cpp:
131+
(JSC::DFG::SpeculativeJIT::compile):
132+
* dfg/DFGStructureCheckHoistingPhase.cpp:
133+
(JSC::DFG::StructureCheckHoistingPhase::run):
134+
* dfg/DFGUnificationPhase.cpp: Added.
135+
(DFG):
136+
(UnificationPhase):
137+
(JSC::DFG::UnificationPhase::UnificationPhase):
138+
(JSC::DFG::UnificationPhase::run):
139+
(JSC::DFG::performUnification):
140+
* dfg/DFGUnificationPhase.h: Added.
141+
(DFG):
142+
* dfg/DFGValidate.cpp:
143+
(JSC::DFG::Validate::validate):
144+
(JSC::DFG::Validate::dumpGraphIfAppropriate):
145+
* dfg/DFGVirtualRegisterAllocationPhase.cpp:
146+
(JSC::DFG::VirtualRegisterAllocationPhase::run):
147+
* llint/LLIntSlowPaths.cpp:
148+
(JSC::LLInt::setUpCall):
149+
* runtime/JSCJSValue.cpp:
150+
(JSC::JSValue::dump):
151+
* runtime/JSString.h:
152+
(JSString):
153+
* runtime/Options.h:
154+
(JSC):
155+
1156
2013-02-08 Jer Noble <jer.noble@apple.com>
2157

3158
Bring WebKit up to speed with latest Encrypted Media spec.

‎Source/JavaScriptCore/GNUmakefile.list.am‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ javascriptcore_sources += \
195195
Source/JavaScriptCore/dfg/DFGCapabilities.h \
196196
Source/JavaScriptCore/dfg/DFGCFAPhase.cpp \
197197
Source/JavaScriptCore/dfg/DFGCFAPhase.h \
198+
Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.cpp \
199+
Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.h \
198200
Source/JavaScriptCore/dfg/DFGCommon.cpp \
199201
Source/JavaScriptCore/dfg/DFGCommon.h \
200202
Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp \
@@ -249,6 +251,8 @@ javascriptcore_sources += \
249251
Source/JavaScriptCore/dfg/DFGPhase.h \
250252
Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp \
251253
Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.h \
254+
Source/JavaScriptCore/dfg/DFGPredictionInjectionPhase.cpp \
255+
Source/JavaScriptCore/dfg/DFGPredictionInjectionPhase.h \
252256
Source/JavaScriptCore/dfg/DFGRegisterBank.h \
253257
Source/JavaScriptCore/dfg/DFGRegisterSet.h \
254258
Source/JavaScriptCore/dfg/DFGRepatch.cpp \
@@ -266,6 +270,8 @@ javascriptcore_sources += \
266270
Source/JavaScriptCore/dfg/DFGStructureCheckHoistingPhase.h \
267271
Source/JavaScriptCore/dfg/DFGThunks.cpp \
268272
Source/JavaScriptCore/dfg/DFGThunks.h \
273+
Source/JavaScriptCore/dfg/DFGUnificationPhase.cpp \
274+
Source/JavaScriptCore/dfg/DFGUnificationPhase.h \
269275
Source/JavaScriptCore/dfg/DFGValueRecoveryOverride.h \
270276
Source/JavaScriptCore/dfg/DFGValueSource.cpp \
271277
Source/JavaScriptCore/dfg/DFGValueSource.h \

‎Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
0F96EBB316676EF6008BADE3 /* CodeBlockWithJITType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F96EBB116676EF4008BADE3 /* CodeBlockWithJITType.h */; settings = {ATTRIBUTES = (Private, ); }; };
202202
0F9749711687ADE400A4FF6A /* JSCellInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F97496F1687ADE200A4FF6A /* JSCellInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
203203
0F98206016BFE38100240D02 /* PreciseJumpTargets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F98205D16BFE37F00240D02 /* PreciseJumpTargets.cpp */; };
204-
0F98206116BFE38300240D02 /* PreciseJumpTargets.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F98205E16BFE37F00240D02 /* PreciseJumpTargets.h */; };
204+
0F98206116BFE38300240D02 /* PreciseJumpTargets.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F98205E16BFE37F00240D02 /* PreciseJumpTargets.h */; settings = {ATTRIBUTES = (Private, ); }; };
205205
0F9D3370165DBB90005AD387 /* Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9D336E165DBB8D005AD387 /* Disassembler.cpp */; };
206206
0F9FC8C314E1B5FE00D52AE0 /* PolymorphicPutByIdList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */; };
207207
0F9FC8C414E1B60000D52AE0 /* PolymorphicPutByIdList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -234,6 +234,12 @@
234234
0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */; };
235235
0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
236236
0FBD7E691447999600481315 /* CodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBD7E671447998F00481315 /* CodeOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; };
237+
0FBE0F7216C1DB030082C5E8 /* DFGCPSRethreadingPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBE0F6B16C1DB010082C5E8 /* DFGCPSRethreadingPhase.cpp */; };
238+
0FBE0F7316C1DB050082C5E8 /* DFGCPSRethreadingPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBE0F6C16C1DB010082C5E8 /* DFGCPSRethreadingPhase.h */; settings = {ATTRIBUTES = (Private, ); }; };
239+
0FBE0F7416C1DB090082C5E8 /* DFGPredictionInjectionPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBE0F6D16C1DB010082C5E8 /* DFGPredictionInjectionPhase.cpp */; };
240+
0FBE0F7516C1DB0B0082C5E8 /* DFGPredictionInjectionPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBE0F6E16C1DB010082C5E8 /* DFGPredictionInjectionPhase.h */; settings = {ATTRIBUTES = (Private, ); }; };
241+
0FBE0F7616C1DB0F0082C5E8 /* DFGUnificationPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBE0F6F16C1DB010082C5E8 /* DFGUnificationPhase.cpp */; };
242+
0FBE0F7716C1DB120082C5E8 /* DFGUnificationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBE0F7016C1DB010082C5E8 /* DFGUnificationPhase.h */; settings = {ATTRIBUTES = (Private, ); }; };
237243
0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC097681468A6EF00CF2442 /* DFGOSRExit.h */; settings = {ATTRIBUTES = (Private, ); }; };
238244
0FC0976D1468AB4E00CF2442 /* DFGAssemblyHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC0976C1468AB4A00CF2442 /* DFGAssemblyHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; };
239245
0FC0976E1468AB5100CF2442 /* DFGAssemblyHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0976B1468AB4A00CF2442 /* DFGAssemblyHelpers.cpp */; };
@@ -1119,6 +1125,12 @@
11191125
0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFGExitProfile.cpp; sourceTree = "<group>"; };
11201126
0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFGExitProfile.h; sourceTree = "<group>"; };
11211127
0FBD7E671447998F00481315 /* CodeOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeOrigin.h; sourceTree = "<group>"; };
1128+
0FBE0F6B16C1DB010082C5E8 /* DFGCPSRethreadingPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGCPSRethreadingPhase.cpp; path = dfg/DFGCPSRethreadingPhase.cpp; sourceTree = "<group>"; };
1129+
0FBE0F6C16C1DB010082C5E8 /* DFGCPSRethreadingPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCPSRethreadingPhase.h; path = dfg/DFGCPSRethreadingPhase.h; sourceTree = "<group>"; };
1130+
0FBE0F6D16C1DB010082C5E8 /* DFGPredictionInjectionPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGPredictionInjectionPhase.cpp; path = dfg/DFGPredictionInjectionPhase.cpp; sourceTree = "<group>"; };
1131+
0FBE0F6E16C1DB010082C5E8 /* DFGPredictionInjectionPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGPredictionInjectionPhase.h; path = dfg/DFGPredictionInjectionPhase.h; sourceTree = "<group>"; };
1132+
0FBE0F6F16C1DB010082C5E8 /* DFGUnificationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGUnificationPhase.cpp; path = dfg/DFGUnificationPhase.cpp; sourceTree = "<group>"; };
1133+
0FBE0F7016C1DB010082C5E8 /* DFGUnificationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGUnificationPhase.h; path = dfg/DFGUnificationPhase.h; sourceTree = "<group>"; };
11221134
0FC097681468A6EF00CF2442 /* DFGOSRExit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExit.h; path = dfg/DFGOSRExit.h; sourceTree = "<group>"; };
11231135
0FC0976B1468AB4A00CF2442 /* DFGAssemblyHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGAssemblyHelpers.cpp; path = dfg/DFGAssemblyHelpers.cpp; sourceTree = "<group>"; };
11241136
0FC0976C1468AB4A00CF2442 /* DFGAssemblyHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAssemblyHelpers.h; path = dfg/DFGAssemblyHelpers.h; sourceTree = "<group>"; };
@@ -2604,6 +2616,8 @@
26042616
0FC0977E1469EBC400CF2442 /* DFGCommon.h */,
26052617
0F3B3A17153E68EF003ED0FF /* DFGConstantFoldingPhase.cpp */,
26062618
0F3B3A18153E68EF003ED0FF /* DFGConstantFoldingPhase.h */,
2619+
0FBE0F6B16C1DB010082C5E8 /* DFGCPSRethreadingPhase.cpp */,
2620+
0FBE0F6C16C1DB010082C5E8 /* DFGCPSRethreadingPhase.h */,
26072621
0FFFC94D14EF909500C72532 /* DFGCSEPhase.cpp */,
26082622
0FFFC94E14EF909500C72532 /* DFGCSEPhase.h */,
26092623
0FF427611591A1C9004CB9FF /* DFGDisassembler.cpp */,
@@ -2652,6 +2666,8 @@
26522666
0FEFC9A81681A3B000567F53 /* DFGOSRExitJumpPlaceholder.h */,
26532667
0FFFC94F14EF909500C72532 /* DFGPhase.cpp */,
26542668
0FFFC95014EF909500C72532 /* DFGPhase.h */,
2669+
0FBE0F6D16C1DB010082C5E8 /* DFGPredictionInjectionPhase.cpp */,
2670+
0FBE0F6E16C1DB010082C5E8 /* DFGPredictionInjectionPhase.h */,
26552671
0FFFC95114EF909500C72532 /* DFGPredictionPropagationPhase.cpp */,
26562672
0FFFC95214EF909500C72532 /* DFGPredictionPropagationPhase.h */,
26572673
86EC9DC11328DF82002B2AD7 /* DFGRegisterBank.h */,
@@ -2671,6 +2687,8 @@
26712687
0F63943D15C75F14006A597C /* DFGStructureCheckHoistingPhase.h */,
26722688
0FC0979F146B28C700CF2442 /* DFGThunks.cpp */,
26732689
0FC097A0146B28C700CF2442 /* DFGThunks.h */,
2690+
0FBE0F6F16C1DB010082C5E8 /* DFGUnificationPhase.cpp */,
2691+
0FBE0F7016C1DB010082C5E8 /* DFGUnificationPhase.h */,
26742692
0F3B3A2915474FF4003ED0FF /* DFGValidate.cpp */,
26752693
0F3B3A2A15474FF4003ED0FF /* DFGValidate.h */,
26762694
0F2BDC3F1522801700CD8910 /* DFGValueRecoveryOverride.h */,
@@ -3330,6 +3348,9 @@
33303348
86704B8A12DBA33700A9FE7B /* YarrPattern.h in Headers */,
33313349
86704B4312DB8A8100A9FE7B /* YarrSyntaxChecker.h in Headers */,
33323350
0F98206116BFE38300240D02 /* PreciseJumpTargets.h in Headers */,
3351+
0FBE0F7316C1DB050082C5E8 /* DFGCPSRethreadingPhase.h in Headers */,
3352+
0FBE0F7516C1DB0B0082C5E8 /* DFGPredictionInjectionPhase.h in Headers */,
3353+
0FBE0F7716C1DB120082C5E8 /* DFGUnificationPhase.h in Headers */,
33333354
);
33343355
runOnlyForDeploymentPostprocessing = 0;
33353356
};
@@ -3965,6 +3986,9 @@
39653986
86704B8912DBA33700A9FE7B /* YarrPattern.cpp in Sources */,
39663987
86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */,
39673988
0F98206016BFE38100240D02 /* PreciseJumpTargets.cpp in Sources */,
3989+
0FBE0F7216C1DB030082C5E8 /* DFGCPSRethreadingPhase.cpp in Sources */,
3990+
0FBE0F7416C1DB090082C5E8 /* DFGPredictionInjectionPhase.cpp in Sources */,
3991+
0FBE0F7616C1DB0F0082C5E8 /* DFGUnificationPhase.cpp in Sources */,
39683992
);
39693993
runOnlyForDeploymentPostprocessing = 0;
39703994
};

‎Source/JavaScriptCore/Target.pri‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ SOURCES += \
118118
dfg/DFGCommon.cpp \
119119
dfg/DFGCFAPhase.cpp \
120120
dfg/DFGCFGSimplificationPhase.cpp \
121+
dfg/DFGCPSRethreadingPhase.cpp \
121122
dfg/DFGConstantFoldingPhase.cpp \
122123
dfg/DFGCSEPhase.cpp \
123124
dfg/DFGDisassembler.cpp \
@@ -140,12 +141,14 @@ SOURCES += \
140141
dfg/DFGOSRExitJumpPlaceholder.cpp \
141142
dfg/DFGPhase.cpp \
142143
dfg/DFGPredictionPropagationPhase.cpp \
144+
dfg/DFGPredictionInjectionPhase.cpp \
143145
dfg/DFGRepatch.cpp \
144146
dfg/DFGSpeculativeJIT.cpp \
145147
dfg/DFGSpeculativeJIT32_64.cpp \
146148
dfg/DFGSpeculativeJIT64.cpp \
147149
dfg/DFGStructureCheckHoistingPhase.cpp \
148150
dfg/DFGThunks.cpp \
151+
dfg/DFGUnificationPhase.cpp \
149152
dfg/DFGValueSource.cpp \
150153
dfg/DFGVariableAccessDataDump.cpp \
151154
dfg/DFGVariableEvent.cpp \

‎Source/JavaScriptCore/bytecode/Operands.h‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ struct OperandValueTraits {
4646
static void dump(const T& value, PrintStream& out) { value.dump(out); }
4747
};
4848

49+
enum OperandKind { ArgumentOperand, LocalOperand };
50+
4951
template<typename T, typename Traits = OperandValueTraits<T> >
5052
class Operands {
5153
public:
@@ -66,6 +68,28 @@ class Operands {
6668
T& local(size_t idx) { return m_locals[idx]; }
6769
const T& local(size_t idx) const { return m_locals[idx]; }
6870

71+
template<OperandKind operandKind>
72+
size_t sizeFor() const
73+
{
74+
if (operandKind == ArgumentOperand)
75+
return numberOfArguments();
76+
return numberOfLocals();
77+
}
78+
template<OperandKind operandKind>
79+
T& atFor(size_t idx)
80+
{
81+
if (operandKind == ArgumentOperand)
82+
return argument(idx);
83+
return local(idx);
84+
}
85+
template<OperandKind operandKind>
86+
const T& atFor(size_t idx) const
87+
{
88+
if (operandKind == ArgumentOperand)
89+
return argument(idx);
90+
return local(idx);
91+
}
92+
6993
void ensureLocals(size_t size)
7094
{
7195
if (size <= m_locals.size())

‎Source/JavaScriptCore/dfg/DFGAbstractState.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,7 @@ bool AbstractState::execute(unsigned indexInBlock)
17871787

17881788
case Phi:
17891789
case Flush:
1790+
case PhantomLocal:
17901791
node->setCanExit(false);
17911792
break;
17921793

@@ -1913,6 +1914,7 @@ inline bool AbstractState::mergeStateAtTail(AbstractValue& destination, Abstract
19131914
switch (node->op()) {
19141915
case Phi:
19151916
case SetArgument:
1917+
case PhantomLocal:
19161918
case Flush:
19171919
// The block transfers the value from head to tail.
19181920
source = inVariable;

0 commit comments

Comments
 (0)