Changeset 280847 in webkit
- Timestamp:
- Aug 10, 2021, 10:08:11 AM (5 years ago)
- Location:
- branches/safari-611.3.10.0-branch
- Files:
-
- 1 added
- 3 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/dfg-arity-fixup-uses-callers-exit-origin.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-611.3.10.0-branch/JSTests/ChangeLog
r278904 r280847 1 2021-08-10 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r275472. rdar://problem/81710596 4 5 DFG arity fixup nodes should exit to the caller's call opcode 6 https://bugs.webkit.org/show_bug.cgi?id=223278 7 8 Reviewed by Saam Barati. 9 10 JSTests: 11 12 * stress/dfg-arity-fixup-uses-callers-exit-origin.js: Added. 13 (main.v22): 14 (main.v30): 15 (main.try.v40): 16 (main.try.v47): 17 (main.try.v56): 18 (main.): 19 (main): 20 21 Source/JavaScriptCore: 22 23 Right now when we do arity fixup in the DFG we model it in the 24 same way that it executes, which means all the nodes are part of 25 the callee. Unfortunately, this causes PhantomInsertionPhase to 26 think those nodes could be replacing previously defined 27 VirtualRegisters as they are part of the callee's header (always 28 alive). When PhantomInsertionPhase then inserts a Phantom it will 29 put that node in the caller's frame as that's the first ExitOK 30 node. The caller however may have no knowledge of that 31 VirtualRegister though. For example: 32 33 --> foo: loc10 is a local in foo. 34 ... 35 1: MovHint(loc10) 36 2: SetLocal(loc10) 37 <-- foo // loc10 ten is now out of scope for the InlineCallFrame of the caller. 38 ... 39 // Phantom will be inserted here refering to loc10, which doesn't make sense. 40 --> bar // loc10 is an argument to bar and needs arity fixup. 41 ... // All of these nodes are ExitInvalid 42 3: MovHint(loc10, ExitInvalid) 43 4: SetLocal(loc10, ExitInvalid) 44 ... 45 46 * dfg/DFGByteCodeParser.cpp: 47 (JSC::DFG::ByteCodeParser::currentNodeOrigin): 48 (JSC::DFG::ByteCodeParser::inlineCall): 49 50 51 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275472 268f45cc-cd09-0410-ab3c-d52691b4dbfc 52 53 2021-04-05 Keith Miller <keith_miller@apple.com> 54 55 DFG arity fixup nodes should exit to the caller's call opcode 56 https://bugs.webkit.org/show_bug.cgi?id=223278 57 58 Reviewed by Saam Barati. 59 60 * stress/dfg-arity-fixup-uses-callers-exit-origin.js: Added. 61 (main.v22): 62 (main.v30): 63 (main.try.v40): 64 (main.try.v47): 65 (main.try.v56): 66 (main.): 67 (main): 68 1 69 2021-06-15 Alan Coon <alancoon@apple.com> 2 70 -
branches/safari-611.3.10.0-branch/Source/JavaScriptCore/ChangeLog
r278904 r280847 1 2021-08-10 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r275472. rdar://problem/81710596 4 5 DFG arity fixup nodes should exit to the caller's call opcode 6 https://bugs.webkit.org/show_bug.cgi?id=223278 7 8 Reviewed by Saam Barati. 9 10 JSTests: 11 12 * stress/dfg-arity-fixup-uses-callers-exit-origin.js: Added. 13 (main.v22): 14 (main.v30): 15 (main.try.v40): 16 (main.try.v47): 17 (main.try.v56): 18 (main.): 19 (main): 20 21 Source/JavaScriptCore: 22 23 Right now when we do arity fixup in the DFG we model it in the 24 same way that it executes, which means all the nodes are part of 25 the callee. Unfortunately, this causes PhantomInsertionPhase to 26 think those nodes could be replacing previously defined 27 VirtualRegisters as they are part of the callee's header (always 28 alive). When PhantomInsertionPhase then inserts a Phantom it will 29 put that node in the caller's frame as that's the first ExitOK 30 node. The caller however may have no knowledge of that 31 VirtualRegister though. For example: 32 33 --> foo: loc10 is a local in foo. 34 ... 35 1: MovHint(loc10) 36 2: SetLocal(loc10) 37 <-- foo // loc10 ten is now out of scope for the InlineCallFrame of the caller. 38 ... 39 // Phantom will be inserted here refering to loc10, which doesn't make sense. 40 --> bar // loc10 is an argument to bar and needs arity fixup. 41 ... // All of these nodes are ExitInvalid 42 3: MovHint(loc10, ExitInvalid) 43 4: SetLocal(loc10, ExitInvalid) 44 ... 45 46 * dfg/DFGByteCodeParser.cpp: 47 (JSC::DFG::ByteCodeParser::currentNodeOrigin): 48 (JSC::DFG::ByteCodeParser::inlineCall): 49 50 51 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275472 268f45cc-cd09-0410-ab3c-d52691b4dbfc 52 53 2021-04-05 Keith Miller <keith_miller@apple.com> 54 55 DFG arity fixup nodes should exit to the caller's call opcode 56 https://bugs.webkit.org/show_bug.cgi?id=223278 57 58 Reviewed by Saam Barati. 59 60 Right now when we do arity fixup in the DFG we model it in the 61 same way that it executes, which means all the nodes are part of 62 the callee. Unfortunately, this causes PhantomInsertionPhase to 63 think those nodes could be replacing previously defined 64 VirtualRegisters as they are part of the callee's header (always 65 alive). When PhantomInsertionPhase then inserts a Phantom it will 66 put that node in the caller's frame as that's the first ExitOK 67 node. The caller however may have no knowledge of that 68 VirtualRegister though. For example: 69 70 --> foo: loc10 is a local in foo. 71 ... 72 1: MovHint(loc10) 73 2: SetLocal(loc10) 74 <-- foo // loc10 ten is now out of scope for the InlineCallFrame of the caller. 75 ... 76 // Phantom will be inserted here refering to loc10, which doesn't make sense. 77 --> bar // loc10 is an argument to bar and needs arity fixup. 78 ... // All of these nodes are ExitInvalid 79 3: MovHint(loc10, ExitInvalid) 80 4: SetLocal(loc10, ExitInvalid) 81 ... 82 83 * dfg/DFGByteCodeParser.cpp: 84 (JSC::DFG::ByteCodeParser::currentNodeOrigin): 85 (JSC::DFG::ByteCodeParser::inlineCall): 86 1 87 2021-06-15 Alan Coon <alancoon@apple.com> 2 88 -
branches/safari-611.3.10.0-branch/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r276664 r280847 747 747 NodeOrigin currentNodeOrigin() 748 748 { 749 CodeOrigin semantic; 750 CodeOrigin forExit; 751 752 if (m_currentSemanticOrigin.isSet()) 753 semantic = m_currentSemanticOrigin; 754 else 755 semantic = currentCodeOrigin(); 756 757 forExit = currentCodeOrigin(); 749 CodeOrigin semantic = m_currentSemanticOrigin.isSet() ? m_currentSemanticOrigin : currentCodeOrigin(); 750 CodeOrigin forExit = m_currentExitOrigin.isSet() ? m_currentExitOrigin : currentCodeOrigin(); 758 751 759 752 return NodeOrigin(semantic, forExit, m_exitOK); … … 1145 1138 // The semantic origin of the current node if different from the current Index. 1146 1139 CodeOrigin m_currentSemanticOrigin; 1140 // The exit origin of the current node if different from the current Index. 1141 CodeOrigin m_currentExitOrigin; 1147 1142 // True if it's OK to OSR exit right now. 1148 1143 bool m_exitOK { false }; … … 1711 1706 calleeVariable->mergeShouldNeverUnbox(true); 1712 1707 } 1708 1709 // We want to claim the exit origin for the arity fixup nodes to be in the caller rather than the callee because 1710 // otherwise phantom insertion phase will think the virtual registers in the callee's header have been alive from the last 1711 // time they were set. For example: 1712 1713 // --> foo: loc10 is a local in foo. 1714 // ... 1715 // 1: MovHint(loc10) 1716 // 2: SetLocal(loc10) 1717 // <-- foo: loc10 ten is now out of scope for the InlineCallFrame of the caller. 1718 // ... 1719 // --> bar: loc10 is an argument to bar and needs arity fixup. 1720 // ... // All of these nodes are ExitInvalid 1721 // 3: MovHint(loc10, ExitInvalid) 1722 // 4: SetLocal(loc10, ExitInvalid) 1723 // ... 1724 1725 // In this example phantom insertion phase will think @3 is always alive because it's in the header of bar. So, 1726 // it will think we are about to kill the old value, as loc10 is in the header of bar and therefore always live, and 1727 // thus need a Phantom. That Phantom, however, may be inserted into the caller's NodeOrigin (all the nodes in bar 1728 // before @3 are ExitInvalid), which doesn't know about loc10. If we move all of the arity fixup nodes into the 1729 // caller's exit origin, forAllKilledOperands, which is how phantom insertion phase decides where phantoms are needed, 1730 // will no longer say loc10 is always alive. 1731 CodeOrigin oldExitOrigin = m_currentExitOrigin; 1732 m_currentExitOrigin = currentCodeOrigin(); 1713 1733 1714 1734 InlineStackEntry* callerStackTop = m_inlineStackTop; … … 1814 1834 // our callee's frame. We emit an ExitOK below. 1815 1835 } 1836 1837 m_currentExitOrigin = oldExitOrigin; 1816 1838 1817 1839 // At this point, it's again OK to OSR exit.
Note:
See TracChangeset
for help on using the changeset viewer.