Changeset 245035 in webkit
- Timestamp:
- May 7, 2019 2:28:38 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r245031 r245035 1 2019-05-07 Robin Morisset <rmorisset@apple.com> 2 3 [B3] Constants should be hoisted to the root block until moveConstants 4 https://bugs.webkit.org/show_bug.cgi?id=197265 5 6 Reviewed by Saam Barati. 7 8 This patch does the following: 9 - B3ReduceStrength now hoists all constants to the root BB, and de-duplicates them along the way 10 - B3PureCSE no longer bothers with constants, since they are already de-duplicated by the time it gets to see them 11 - We now run eliminateDeadCode just after moveConstants, so that the Nops that moveConstants generates are freed instead of staying live throughout Air compilation, reducing memory pressure. 12 - I also took the opportunity to fix typos in comments in various parts of the code base. 13 14 Here are a few numbers to justify this patch: 15 - In JetStream2, about 27% of values at the beginning of B3 are constants 16 - In JetStream2, about 11% of values at the end of B3 are Nops 17 - In JetStream2, this patch increases the number of times that tail duplication happens from a bit less than 24k to a bit more than 25k (hoisting constants makes blocks smaller). 18 19 When I tried measuring the total effect on JetStream2 I got a tiny and almost certainly non-significant progression. 20 21 * b3/B3Generate.cpp: 22 (JSC::B3::generateToAir): 23 * b3/B3MoveConstants.cpp: 24 * b3/B3PureCSE.cpp: 25 (JSC::B3::PureCSE::process): 26 * b3/B3PureCSE.h: 27 * b3/B3ReduceStrength.cpp: 28 * bytecode/GetByIdStatus.cpp: 29 (JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback): 30 * dfg/DFGCSEPhase.cpp: 31 * dfg/DFGOSRAvailabilityAnalysisPhase.h: 32 * dfg/DFGOSRExit.cpp: 33 (JSC::DFG::OSRExit::executeOSRExit): 34 1 35 2019-05-07 Robin Morisset <rmorisset@apple.com> 2 36 -
trunk/Source/JavaScriptCore/b3/B3Generate.cpp
r243851 r245035 117 117 legalizeMemoryOffsets(procedure); 118 118 moveConstants(procedure); 119 eliminateDeadCode(procedure); 119 120 120 121 // FIXME: We should run pureCSE here to clean up some platform specific changes from the previous phases. -
trunk/Source/JavaScriptCore/b3/B3MoveConstants.cpp
r244309 r245035 155 155 156 156 // We call this when we have found a constant that we'd like to use. It's possible that 157 // we have computed that the constant should be m eterialized in this block, but we157 // we have computed that the constant should be materialized in this block, but we 158 158 // haven't inserted it yet. This inserts the constant if necessary. 159 159 auto materialize = [&] (Value* child) { -
trunk/Source/JavaScriptCore/b3/B3PureCSE.cpp
r213714 r245035 69 69 bool PureCSE::process(Value* value, Dominators& dominators) 70 70 { 71 if (value->opcode() == Identity )71 if (value->opcode() == Identity || value->isConstant()) 72 72 return false; 73 73 -
trunk/Source/JavaScriptCore/b3/B3PureCSE.h
r213714 r245035 41 41 42 42 // This is a reusable utility for doing pure CSE. You can use it to do pure CSE on a program by just 43 // proceeding in order an calling process().43 // proceeding in order and calling process(). 44 44 class PureCSE { 45 45 public: -
trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp
r243918 r245035 403 403 , m_insertionSet(proc) 404 404 , m_blockInsertionSet(proc) 405 , m_root(proc.at(0)) 405 406 { 406 407 } … … 443 444 // put them. We're not actually smart enough to move things around at random. 444 445 m_changed |= eliminateDeadCodeImpl(m_proc); 446 m_valueForConstant.clear(); 445 447 446 448 simplifySSA(); … … 2146 2148 break; 2147 2149 } 2148 2150 2151 case Const32: 2152 case Const64: 2153 case ConstFloat: 2154 case ConstDouble: { 2155 ValueKey key = m_value->key(); 2156 if (Value* constInRoot = m_valueForConstant.get(key)) { 2157 if (constInRoot != m_value) { 2158 m_value->replaceWithIdentity(constInRoot); 2159 m_changed = true; 2160 } 2161 } else if (m_block == m_root) 2162 m_valueForConstant.add(key, m_value); 2163 else { 2164 Value* constInRoot = m_proc.clone(m_value); 2165 m_root->appendNonTerminal(constInRoot); 2166 m_valueForConstant.add(key, constInRoot); 2167 m_value->replaceWithIdentity(constInRoot); 2168 m_changed = true; 2169 } 2170 break; 2171 } 2172 2149 2173 default: 2150 2174 break; … … 2795 2819 InsertionSet m_insertionSet; 2796 2820 BlockInsertionSet m_blockInsertionSet; 2821 HashMap<ValueKey, Value*> m_valueForConstant; 2822 BasicBlock* m_root { nullptr }; 2797 2823 BasicBlock* m_block { nullptr }; 2798 2824 unsigned m_index { 0 }; -
trunk/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp
r243467 r245035 277 277 278 278 if (domAttribute) { 279 // Give up when cu tom accesses are not merged into one.279 // Give up when custom accesses are not merged into one. 280 280 if (result.numVariants() != 1) 281 281 return GetByIdStatus(JSC::slowVersion(summary)); -
trunk/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp
r240114 r245035 258 258 } 259 259 260 // The majority of Impure Stack Slots are unique per value.260 // The majority of Impure Stack Slots are unique per value. 261 261 // This is very useful for fast clobber(), we can just remove the slot addressed by AbstractHeap 262 262 // in O(1). -
trunk/Source/JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.h
r218794 r245035 34 34 class Graph; 35 35 36 // Computes BasicBlock::ssa->availabil tiyAtHead/Tail. This is a forward flow type inference36 // Computes BasicBlock::ssa->availabilityAtHead/Tail. This is a forward flow type inference 37 37 // over MovHints and SetLocals. This analysis is run directly by the Plan for preparing for 38 38 // lowering to B3 IR, but it can also be used as a utility. Note that if you run it before -
trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp
r244764 r245035 453 453 context.sp() = context.fp<uint8_t*>() + exitState.stackPointerOffset; 454 454 455 // The only reason for using this do while loo kis so we can break out midway when appropriate.455 // The only reason for using this do while loop is so we can break out midway when appropriate. 456 456 do { 457 457 auto extraInitializationLevel = static_cast<ExtraInitializationLevel>(exitState.extraInitializationLevel);
Note: See TracChangeset
for help on using the changeset viewer.