Changeset 243744 in webkit
- Timestamp:
- Apr 2, 2019, 8:58:34 AM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 added
- 5 edited
-
ChangeLog (modified) (1 diff)
-
JavaScriptCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Sources.txt (modified) (1 diff)
-
dfg/DFGPlan.cpp (modified) (2 diffs)
-
dfg/DFGValueRepReductionPhase.cpp (added)
-
dfg/DFGValueRepReductionPhase.h (added)
-
runtime/Options.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243702 r243744 1 2019-04-02 Saam barati <sbarati@apple.com> 2 3 Add a ValueRepReduction phase 4 https://bugs.webkit.org/show_bug.cgi?id=196234 5 6 Reviewed by Filip Pizlo. 7 8 This patch adds a ValueRepReduction phase. The main idea here is 9 to try to reduce DoubleRep(RealNumberUse:ValueRep(DoubleRepUse:@x)) 10 to just be @x. This patch handles such above strengh reduction rules 11 as long as we prove that all users of the ValueRep can be converted 12 to using the incoming double value. That way we prevent introducing 13 a parallel live range for the double value. 14 15 This patch tracks the uses of the ValueRep through Phi variables, 16 so we can convert entire Phi variables to being Double instead 17 of JSValue if the Phi also has only double uses. 18 19 This is implemented through a simple escape analysis. DoubleRep(RealNumberUse:) 20 and OSR exit hints are not counted as escapes. All other uses are counted 21 as escapes. Connected Phi graphs are converted to being Double only if the 22 entire graph is ok with the result being Double. 23 24 Some ways we could extend this phase in the future: 25 - There are a lot of DoubleRep(NumberUse:@ValueRep(@x)) uses. This ensures 26 that the result of the DoubleRep of @x is not impure NaN. We could 27 handle this case if we introduced a PurifyNaN node and replace the DoubleRep 28 with PurifyNaN(@x). Alternatively, we could see if certain users of this 29 DoubleRep are okay with impure NaN flowing into them and we'd need to ensure 30 their output type is always treated as if the input is impure NaN. 31 - We could do sinking of ValueRep where we think it's profitable. So instead 32 of an escape making it so we never represent the variable as a Double, we 33 could make the escape reconstruct the JSValueRep where profitable. 34 - We can extend this phase to handle Int52Rep if it's profitable. 35 - We can opt other nodes into accepting incoming Doubles so we no longer 36 treat them as escapes. 37 38 This patch is somewhere between neutral and a 1% progression on JetStream 2. 39 40 * JavaScriptCore.xcodeproj/project.pbxproj: 41 * Sources.txt: 42 * dfg/DFGPlan.cpp: 43 (JSC::DFG::Plan::compileInThreadImpl): 44 * dfg/DFGValueRepReductionPhase.cpp: Added. 45 (JSC::DFG::ValueRepReductionPhase::ValueRepReductionPhase): 46 (JSC::DFG::ValueRepReductionPhase::run): 47 (JSC::DFG::ValueRepReductionPhase::convertValueRepsToDouble): 48 (JSC::DFG::performValueRepReduction): 49 * dfg/DFGValueRepReductionPhase.h: Added. 50 * runtime/Options.h: 51 1 52 2019-04-01 Yusuke Suzuki <ysuzuki@apple.com> 2 53 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r243560 r243744 884 884 52B311011975B4670080857C /* TypeLocationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B311001975B4670080857C /* TypeLocationCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 885 885 52C0611F1AA51E1C00B4ADBA /* RuntimeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 52C0611D1AA51E1B00B4ADBA /* RuntimeType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 886 52C55566224C2AEA0099F5CC /* DFGValueRepReductionPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 52C55565224C2AE70099F5CC /* DFGValueRepReductionPhase.h */; }; 886 887 52C952B719A289850069B386 /* TypeProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 52C952B619A289850069B386 /* TypeProfiler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 887 888 52CD0F5D2242F569004A18A5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EB6105C86C6B00E6DF1B /* Foundation.framework */; }; … … 3390 3391 52B717B41A0597E1007AF4F3 /* ControlFlowProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControlFlowProfiler.cpp; sourceTree = "<group>"; }; 3391 3392 52C0611D1AA51E1B00B4ADBA /* RuntimeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeType.h; sourceTree = "<group>"; }; 3393 52C55564224C2AE70099F5CC /* DFGValueRepReductionPhase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = DFGValueRepReductionPhase.cpp; path = dfg/DFGValueRepReductionPhase.cpp; sourceTree = "<group>"; }; 3394 52C55565224C2AE70099F5CC /* DFGValueRepReductionPhase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DFGValueRepReductionPhase.h; path = dfg/DFGValueRepReductionPhase.h; sourceTree = "<group>"; }; 3392 3395 52C952B619A289850069B386 /* TypeProfiler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeProfiler.h; sourceTree = "<group>"; }; 3393 3396 52C952B819A28A1C0069B386 /* TypeProfiler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TypeProfiler.cpp; sourceTree = "<group>"; }; … … 7652 7655 0F3B3A2915474FF4003ED0FF /* DFGValidate.cpp */, 7653 7656 0F3B3A2A15474FF4003ED0FF /* DFGValidate.h */, 7657 52C55564224C2AE70099F5CC /* DFGValueRepReductionPhase.cpp */, 7658 52C55565224C2AE70099F5CC /* DFGValueRepReductionPhase.h */, 7654 7659 0F2BDC4E15228BE700CD8910 /* DFGValueSource.cpp */, 7655 7660 0F2BDC401522801700CD8910 /* DFGValueSource.h */, … … 9380 9385 996B73201BDA08EF00331B84 /* JSModuleLoader.lut.h in Headers */, 9381 9386 E318CBC11B8AEF5100A2929D /* JSModuleNamespaceObject.h in Headers */, 9387 52C55566224C2AEA0099F5CC /* DFGValueRepReductionPhase.h in Headers */, 9382 9388 E39DA4A71B7E8B7C0084F33A /* JSModuleRecord.h in Headers */, 9383 9389 E33E8D1D1B9013C300346B52 /* JSNativeStdFunction.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r243560 r243744 417 417 dfg/DFGUseKind.cpp 418 418 dfg/DFGValidate.cpp 419 dfg/DFGValueRepReductionPhase.cpp 419 420 dfg/DFGValueSource.cpp 420 421 dfg/DFGValueStrength.cpp -
trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp
r243467 r243744 72 72 #include "DFGUnificationPhase.h" 73 73 #include "DFGValidate.h" 74 #include "DFGValueRepReductionPhase.h" 74 75 #include "DFGVarargsForwardingPhase.h" 75 76 #include "DFGVirtualRegisterAllocationPhase.h" … … 425 426 RUN_PHASE(performObjectAllocationSinking); 426 427 } 428 if (Options::useValueRepElimination()) 429 RUN_PHASE(performValueRepReduction); 427 430 if (changed) { 428 431 // State-at-tail and state-at-head will be invalid if we did strength reduction since -
trunk/Source/JavaScriptCore/runtime/Options.h
r243530 r243744 284 284 v(bool, usePutStackSinking, true, Normal, nullptr) \ 285 285 v(bool, useObjectAllocationSinking, true, Normal, nullptr) \ 286 v(bool, useValueRepElimination, true, Normal, nullptr) \ 286 287 v(bool, useArityFixupInlining, true, Normal, nullptr) \ 287 288 v(bool, logExecutableAllocation, false, Normal, nullptr) \
Note:
See TracChangeset
for help on using the changeset viewer.