Changeset 195395 in webkit
- Timestamp:
- Jan 20, 2016 7:12:55 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r195313 r195395 105 105 b3/B3BasicBlock.cpp 106 106 b3/B3BlockInsertionSet.cpp 107 b3/B3BreakCriticalEdges.cpp 107 108 b3/B3CCallValue.cpp 108 109 b3/B3CheckSpecial.cpp … … 118 119 b3/B3ControlValue.cpp 119 120 b3/B3DataSection.cpp 121 b3/B3DuplicateTails.cpp 120 122 b3/B3Effects.cpp 123 b3/B3FixSSA.cpp 121 124 b3/B3FrequencyClass.cpp 122 125 b3/B3Generate.cpp … … 133 136 b3/B3Opcode.cpp 134 137 b3/B3Origin.cpp 138 b3/B3OriginDump.cpp 135 139 b3/B3PatchpointSpecial.cpp 136 140 b3/B3PatchpointValue.cpp … … 140 144 b3/B3ReduceDoubleToFloat.cpp 141 145 b3/B3ReduceStrength.cpp 146 b3/B3SSACalculator.cpp 142 147 b3/B3StackmapGenerationParams.cpp 143 148 b3/B3StackmapSpecial.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r195388 r195395 1 2016-01-19 Filip Pizlo <fpizlo@apple.com> 2 3 B3 should have basic path specialization 4 https://bugs.webkit.org/show_bug.cgi?id=153200 5 6 Reviewed by Benjamin Poulain. 7 8 This adds two different kind of path specializations: 9 10 - Check(Select) where the Select results are constants is specialized into a Branch 11 instead of a Select and duplicated paths where the results of the Select are folded. 12 13 - Tail duplication. A jump to a small block causes the block's contents to be copied over 14 the Jump. 15 16 Both optimizations required being able to clone Values. We can now do that using 17 proc.clone(value). 18 19 Check(Select) specialization needed some utilities for walking graphs of Values. 20 21 Tail duplication needed SSA fixup, so I added a way to demote values to anonymous stack 22 slots (B3's equivalent of non-SSA variables) and a way to "fix SSA", i.e. to allocate 23 anonymous stack slots to SSA values along with an optimal Phi graph. 24 25 This is a big speed-up on Octane/deltablue. It's a 2.2% speed-up on Octane overall. 26 27 * CMakeLists.txt: 28 * JavaScriptCore.xcodeproj/project.pbxproj: 29 * b3/B3ArgumentRegValue.cpp: 30 (JSC::B3::ArgumentRegValue::dumpMeta): 31 (JSC::B3::ArgumentRegValue::cloneImpl): 32 * b3/B3ArgumentRegValue.h: 33 * b3/B3BasicBlock.cpp: 34 (JSC::B3::BasicBlock::append): 35 (JSC::B3::BasicBlock::appendNonTerminal): 36 (JSC::B3::BasicBlock::removeLast): 37 * b3/B3BasicBlock.h: 38 (JSC::B3::BasicBlock::values): 39 * b3/B3BasicBlockInlines.h: 40 (JSC::B3::BasicBlock::appendNew): 41 (JSC::B3::BasicBlock::appendNewNonTerminal): 42 (JSC::B3::BasicBlock::replaceLastWithNew): 43 * b3/B3BlockInsertionSet.h: 44 * b3/B3BreakCriticalEdges.cpp: Added. 45 (JSC::B3::breakCriticalEdges): 46 * b3/B3BreakCriticalEdges.h: Added. 47 * b3/B3CCallValue.cpp: 48 (JSC::B3::CCallValue::~CCallValue): 49 (JSC::B3::CCallValue::cloneImpl): 50 * b3/B3CCallValue.h: 51 * b3/B3CheckValue.cpp: 52 (JSC::B3::CheckValue::convertToAdd): 53 (JSC::B3::CheckValue::cloneImpl): 54 (JSC::B3::CheckValue::CheckValue): 55 * b3/B3CheckValue.h: 56 * b3/B3Const32Value.cpp: 57 (JSC::B3::Const32Value::dumpMeta): 58 (JSC::B3::Const32Value::cloneImpl): 59 * b3/B3Const32Value.h: 60 * b3/B3Const64Value.cpp: 61 (JSC::B3::Const64Value::dumpMeta): 62 (JSC::B3::Const64Value::cloneImpl): 63 * b3/B3Const64Value.h: 64 * b3/B3ConstDoubleValue.cpp: 65 (JSC::B3::ConstDoubleValue::dumpMeta): 66 (JSC::B3::ConstDoubleValue::cloneImpl): 67 * b3/B3ConstDoubleValue.h: 68 * b3/B3ConstFloatValue.cpp: 69 (JSC::B3::ConstFloatValue::dumpMeta): 70 (JSC::B3::ConstFloatValue::cloneImpl): 71 * b3/B3ConstFloatValue.h: 72 * b3/B3ControlValue.cpp: 73 (JSC::B3::ControlValue::dumpMeta): 74 (JSC::B3::ControlValue::cloneImpl): 75 * b3/B3ControlValue.h: 76 * b3/B3DuplicateTails.cpp: Added. 77 (JSC::B3::duplicateTails): 78 * b3/B3DuplicateTails.h: Added. 79 * b3/B3FixSSA.cpp: Added. 80 (JSC::B3::demoteValues): 81 (JSC::B3::fixSSA): 82 * b3/B3FixSSA.h: Added. 83 * b3/B3Generate.cpp: 84 (JSC::B3::generateToAir): 85 * b3/B3IndexSet.h: 86 (JSC::B3::IndexSet::Iterable::Iterable): 87 (JSC::B3::IndexSet::values): 88 (JSC::B3::IndexSet::indices): 89 * b3/B3InsertionSet.cpp: 90 (JSC::B3::InsertionSet::insertIntConstant): 91 (JSC::B3::InsertionSet::insertBottom): 92 (JSC::B3::InsertionSet::execute): 93 * b3/B3InsertionSet.h: 94 * b3/B3LowerToAir.cpp: 95 (JSC::B3::Air::LowerToAir::run): 96 (JSC::B3::Air::LowerToAir::tmp): 97 * b3/B3MemoryValue.cpp: 98 (JSC::B3::MemoryValue::dumpMeta): 99 (JSC::B3::MemoryValue::cloneImpl): 100 * b3/B3MemoryValue.h: 101 * b3/B3OriginDump.cpp: Added. 102 (JSC::B3::OriginDump::dump): 103 * b3/B3OriginDump.h: 104 (JSC::B3::OriginDump::OriginDump): 105 (JSC::B3::OriginDump::dump): Deleted. 106 * b3/B3PatchpointValue.cpp: 107 (JSC::B3::PatchpointValue::dumpMeta): 108 (JSC::B3::PatchpointValue::cloneImpl): 109 (JSC::B3::PatchpointValue::PatchpointValue): 110 * b3/B3PatchpointValue.h: 111 * b3/B3Procedure.cpp: 112 (JSC::B3::Procedure::addBlock): 113 (JSC::B3::Procedure::clone): 114 (JSC::B3::Procedure::addIntConstant): 115 (JSC::B3::Procedure::addBottom): 116 (JSC::B3::Procedure::addBoolConstant): 117 (JSC::B3::Procedure::deleteValue): 118 * b3/B3Procedure.h: 119 * b3/B3ReduceStrength.cpp: 120 * b3/B3SSACalculator.cpp: Added. 121 (JSC::B3::SSACalculator::Variable::dump): 122 (JSC::B3::SSACalculator::Variable::dumpVerbose): 123 (JSC::B3::SSACalculator::Def::dump): 124 (JSC::B3::SSACalculator::SSACalculator): 125 (JSC::B3::SSACalculator::~SSACalculator): 126 (JSC::B3::SSACalculator::reset): 127 (JSC::B3::SSACalculator::newVariable): 128 (JSC::B3::SSACalculator::newDef): 129 (JSC::B3::SSACalculator::nonLocalReachingDef): 130 (JSC::B3::SSACalculator::reachingDefAtTail): 131 (JSC::B3::SSACalculator::dump): 132 * b3/B3SSACalculator.h: Added. 133 (JSC::B3::SSACalculator::Variable::index): 134 (JSC::B3::SSACalculator::Variable::Variable): 135 (JSC::B3::SSACalculator::Def::variable): 136 (JSC::B3::SSACalculator::Def::block): 137 (JSC::B3::SSACalculator::Def::value): 138 (JSC::B3::SSACalculator::Def::Def): 139 (JSC::B3::SSACalculator::variable): 140 (JSC::B3::SSACalculator::computePhis): 141 (JSC::B3::SSACalculator::phisForBlock): 142 (JSC::B3::SSACalculator::reachingDefAtHead): 143 * b3/B3StackSlotKind.h: 144 * b3/B3StackSlotValue.cpp: 145 (JSC::B3::StackSlotValue::dumpMeta): 146 (JSC::B3::StackSlotValue::cloneImpl): 147 * b3/B3StackSlotValue.h: 148 * b3/B3SwitchValue.cpp: 149 (JSC::B3::SwitchValue::dumpMeta): 150 (JSC::B3::SwitchValue::cloneImpl): 151 (JSC::B3::SwitchValue::SwitchValue): 152 * b3/B3SwitchValue.h: 153 * b3/B3UpsilonValue.cpp: 154 (JSC::B3::UpsilonValue::dumpMeta): 155 (JSC::B3::UpsilonValue::cloneImpl): 156 * b3/B3UpsilonValue.h: 157 * b3/B3Validate.cpp: 158 * b3/B3Value.cpp: 159 (JSC::B3::Value::replaceWithNop): 160 (JSC::B3::Value::replaceWithPhi): 161 (JSC::B3::Value::dump): 162 (JSC::B3::Value::cloneImpl): 163 (JSC::B3::Value::dumpChildren): 164 (JSC::B3::Value::deepDump): 165 * b3/B3Value.h: 166 (JSC::B3::DeepValueDump::DeepValueDump): 167 (JSC::B3::DeepValueDump::dump): 168 (JSC::B3::deepDump): 169 * b3/B3ValueInlines.h: 170 (JSC::B3::Value::asNumber): 171 (JSC::B3::Value::walk): 172 * b3/B3ValueKey.cpp: 173 (JSC::B3::ValueKey::intConstant): 174 (JSC::B3::ValueKey::dump): 175 * b3/B3ValueKey.h: 176 (JSC::B3::ValueKey::ValueKey): 177 (JSC::B3::ValueKey::opcode): 178 (JSC::B3::ValueKey::type): 179 (JSC::B3::ValueKey::childIndex): 180 * b3/air/AirCode.h: 181 (JSC::B3::Air::Code::forAllTmps): 182 (JSC::B3::Air::Code::isFastTmp): 183 * b3/air/AirIteratedRegisterCoalescing.cpp: 184 * b3/air/AirUseCounts.h: 185 (JSC::B3::Air::UseCounts::UseCounts): 186 (JSC::B3::Air::UseCounts::operator[]): 187 (JSC::B3::Air::UseCounts::dump): 188 * b3/testb3.cpp: 189 (JSC::B3::testSelectInvert): 190 (JSC::B3::testCheckSelect): 191 (JSC::B3::testCheckSelectCheckSelect): 192 (JSC::B3::testPowDoubleByIntegerLoop): 193 (JSC::B3::run): 194 * runtime/Options.h: 195 1 196 2016-01-20 Benjamin Poulain <bpoulain@apple.com> 2 197 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r195307 r195395 382 382 0F4DE1CE1C4C1B54004D6C11 /* AirFixObviousSpills.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4DE1CC1C4C1B54004D6C11 /* AirFixObviousSpills.cpp */; }; 383 383 0F4DE1CF1C4C1B54004D6C11 /* AirFixObviousSpills.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4DE1CD1C4C1B54004D6C11 /* AirFixObviousSpills.h */; }; 384 0F4DE1D11C4D764B004D6C11 /* B3OriginDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4DE1D01C4D764B004D6C11 /* B3OriginDump.cpp */; }; 384 385 0F4F29DF18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4F29DD18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.cpp */; }; 385 386 0F4F29E018B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F29DE18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h */; }; … … 450 451 0F6B1CC51862C47800845D97 /* FTLUnwindInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6B1CC11862C47800845D97 /* FTLUnwindInfo.cpp */; }; 451 452 0F6B1CC61862C47800845D97 /* FTLUnwindInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6B1CC21862C47800845D97 /* FTLUnwindInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 453 0F6B8AD81C4EDDA200969052 /* B3DuplicateTails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6B8AD61C4EDDA200969052 /* B3DuplicateTails.cpp */; }; 454 0F6B8AD91C4EDDA200969052 /* B3DuplicateTails.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6B8AD71C4EDDA200969052 /* B3DuplicateTails.h */; }; 455 0F6B8ADC1C4EFAC300969052 /* B3SSACalculator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6B8ADA1C4EFAC300969052 /* B3SSACalculator.cpp */; }; 456 0F6B8ADD1C4EFAC300969052 /* B3SSACalculator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6B8ADB1C4EFAC300969052 /* B3SSACalculator.h */; }; 457 0F6B8AE21C4EFE1700969052 /* B3BreakCriticalEdges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6B8ADE1C4EFE1700969052 /* B3BreakCriticalEdges.cpp */; }; 458 0F6B8AE31C4EFE1700969052 /* B3BreakCriticalEdges.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6B8ADF1C4EFE1700969052 /* B3BreakCriticalEdges.h */; }; 459 0F6B8AE41C4EFE1700969052 /* B3FixSSA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6B8AE01C4EFE1700969052 /* B3FixSSA.cpp */; }; 460 0F6B8AE51C4EFE1700969052 /* B3FixSSA.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6B8AE11C4EFE1700969052 /* B3FixSSA.h */; }; 452 461 0F6C73501AC9F99F00BE1682 /* VariableWriteFireDetail.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F6C734E1AC9F99F00BE1682 /* VariableWriteFireDetail.cpp */; }; 453 462 0F6C73511AC9F99F00BE1682 /* VariableWriteFireDetail.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F6C734F1AC9F99F00BE1682 /* VariableWriteFireDetail.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 459 468 0F714CA416EA92F000F3EBEB /* DFGBackwardsPropagationPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F714CA116EA92ED00F3EBEB /* DFGBackwardsPropagationPhase.cpp */; }; 460 469 0F714CA516EA92F200F3EBEB /* DFGBackwardsPropagationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F714CA216EA92ED00F3EBEB /* DFGBackwardsPropagationPhase.h */; }; 470 0F725CAF1C506D3B00AD943A /* B3FoldPathConstants.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F725CAD1C506D3B00AD943A /* B3FoldPathConstants.cpp */; }; 471 0F725CB01C506D3B00AD943A /* B3FoldPathConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F725CAE1C506D3B00AD943A /* B3FoldPathConstants.h */; }; 461 472 0F743BAA16B88249009F9277 /* ARM64Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 652A3A201651C66100A80AFE /* ARM64Disassembler.cpp */; }; 462 473 0F766D2815A8CC1E008F363E /* JITStubRoutine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F766D2615A8CC1B008F363E /* JITStubRoutine.cpp */; }; … … 2549 2560 0F4DE1CC1C4C1B54004D6C11 /* AirFixObviousSpills.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirFixObviousSpills.cpp; path = b3/air/AirFixObviousSpills.cpp; sourceTree = "<group>"; }; 2550 2561 0F4DE1CD1C4C1B54004D6C11 /* AirFixObviousSpills.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirFixObviousSpills.h; path = b3/air/AirFixObviousSpills.h; sourceTree = "<group>"; }; 2562 0F4DE1D01C4D764B004D6C11 /* B3OriginDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3OriginDump.cpp; path = b3/B3OriginDump.cpp; sourceTree = "<group>"; }; 2551 2563 0F4F29DD18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGStaticExecutionCountEstimationPhase.cpp; path = dfg/DFGStaticExecutionCountEstimationPhase.cpp; sourceTree = "<group>"; }; 2552 2564 0F4F29DE18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStaticExecutionCountEstimationPhase.h; path = dfg/DFGStaticExecutionCountEstimationPhase.h; sourceTree = "<group>"; }; … … 2619 2631 0F6B1CC11862C47800845D97 /* FTLUnwindInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLUnwindInfo.cpp; path = ftl/FTLUnwindInfo.cpp; sourceTree = "<group>"; }; 2620 2632 0F6B1CC21862C47800845D97 /* FTLUnwindInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLUnwindInfo.h; path = ftl/FTLUnwindInfo.h; sourceTree = "<group>"; }; 2633 0F6B8AD61C4EDDA200969052 /* B3DuplicateTails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3DuplicateTails.cpp; path = b3/B3DuplicateTails.cpp; sourceTree = "<group>"; }; 2634 0F6B8AD71C4EDDA200969052 /* B3DuplicateTails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3DuplicateTails.h; path = b3/B3DuplicateTails.h; sourceTree = "<group>"; }; 2635 0F6B8ADA1C4EFAC300969052 /* B3SSACalculator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3SSACalculator.cpp; path = b3/B3SSACalculator.cpp; sourceTree = "<group>"; }; 2636 0F6B8ADB1C4EFAC300969052 /* B3SSACalculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3SSACalculator.h; path = b3/B3SSACalculator.h; sourceTree = "<group>"; }; 2637 0F6B8ADE1C4EFE1700969052 /* B3BreakCriticalEdges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3BreakCriticalEdges.cpp; path = b3/B3BreakCriticalEdges.cpp; sourceTree = "<group>"; }; 2638 0F6B8ADF1C4EFE1700969052 /* B3BreakCriticalEdges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3BreakCriticalEdges.h; path = b3/B3BreakCriticalEdges.h; sourceTree = "<group>"; }; 2639 0F6B8AE01C4EFE1700969052 /* B3FixSSA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3FixSSA.cpp; path = b3/B3FixSSA.cpp; sourceTree = "<group>"; }; 2640 0F6B8AE11C4EFE1700969052 /* B3FixSSA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3FixSSA.h; path = b3/B3FixSSA.h; sourceTree = "<group>"; }; 2621 2641 0F6C734E1AC9F99F00BE1682 /* VariableWriteFireDetail.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VariableWriteFireDetail.cpp; sourceTree = "<group>"; }; 2622 2642 0F6C734F1AC9F99F00BE1682 /* VariableWriteFireDetail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VariableWriteFireDetail.h; sourceTree = "<group>"; }; … … 2628 2648 0F714CA116EA92ED00F3EBEB /* DFGBackwardsPropagationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGBackwardsPropagationPhase.cpp; path = dfg/DFGBackwardsPropagationPhase.cpp; sourceTree = "<group>"; }; 2629 2649 0F714CA216EA92ED00F3EBEB /* DFGBackwardsPropagationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGBackwardsPropagationPhase.h; path = dfg/DFGBackwardsPropagationPhase.h; sourceTree = "<group>"; }; 2650 0F725CAD1C506D3B00AD943A /* B3FoldPathConstants.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3FoldPathConstants.cpp; path = b3/B3FoldPathConstants.cpp; sourceTree = "<group>"; }; 2651 0F725CAE1C506D3B00AD943A /* B3FoldPathConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3FoldPathConstants.h; path = b3/B3FoldPathConstants.h; sourceTree = "<group>"; }; 2630 2652 0F766D1C15A5028D008F363E /* JITStubRoutine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubRoutine.h; sourceTree = "<group>"; }; 2631 2653 0F766D2615A8CC1B008F363E /* JITStubRoutine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITStubRoutine.cpp; sourceTree = "<group>"; }; … … 4727 4749 0F338E181BF286EA0013C88F /* B3BlockInsertionSet.h */, 4728 4750 0FEC84BA1BDACDAC0080FF74 /* B3BlockWorklist.h */, 4751 0F6B8ADE1C4EFE1700969052 /* B3BreakCriticalEdges.cpp */, 4752 0F6B8ADF1C4EFE1700969052 /* B3BreakCriticalEdges.h */, 4729 4753 0F338DF71BE96AA80013C88F /* B3CCallValue.cpp */, 4730 4754 0F338DF81BE96AA80013C88F /* B3CCallValue.h */, … … 4756 4780 0F338E021BF0276C0013C88F /* B3DataSection.h */, 4757 4781 0F33FCFA1C1625BE00323F67 /* B3Dominators.h */, 4782 0F6B8AD61C4EDDA200969052 /* B3DuplicateTails.cpp */, 4783 0F6B8AD71C4EDDA200969052 /* B3DuplicateTails.h */, 4758 4784 0FEC85C41BE16F5A0080FF74 /* B3Effects.cpp */, 4759 4785 0FEC85BE1BE167A00080FF74 /* B3Effects.h */, 4786 0F6B8AE01C4EFE1700969052 /* B3FixSSA.cpp */, 4787 0F6B8AE11C4EFE1700969052 /* B3FixSSA.h */, 4788 0F725CAD1C506D3B00AD943A /* B3FoldPathConstants.cpp */, 4789 0F725CAE1C506D3B00AD943A /* B3FoldPathConstants.h */, 4760 4790 0FEC84CB1BDACDAC0080FF74 /* B3FrequencyClass.cpp */, 4761 4791 0FEC84CC1BDACDAC0080FF74 /* B3FrequencyClass.h */, … … 4792 4822 0FEC84D91BDACDAC0080FF74 /* B3Origin.cpp */, 4793 4823 0FEC84DA1BDACDAC0080FF74 /* B3Origin.h */, 4824 0F4DE1D01C4D764B004D6C11 /* B3OriginDump.cpp */, 4794 4825 0F4C91651C29F4F2004341A6 /* B3OriginDump.h */, 4795 4826 0FEC84DB1BDACDAC0080FF74 /* B3PatchpointSpecial.cpp */, … … 4808 4839 0FEC85B71BE1462F0080FF74 /* B3ReduceStrength.cpp */, 4809 4840 0FEC85B81BE1462F0080FF74 /* B3ReduceStrength.h */, 4841 0F6B8ADA1C4EFAC300969052 /* B3SSACalculator.cpp */, 4842 0F6B8ADB1C4EFAC300969052 /* B3SSACalculator.h */, 4810 4843 0F33FCF51C136E2500323F67 /* B3StackmapGenerationParams.cpp */, 4811 4844 0F33FCF61C136E2500323F67 /* B3StackmapGenerationParams.h */, … … 7129 7162 0F1C3DDA1BBCE09E00E523E4 /* CellState.h in Headers */, 7130 7163 BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */, 7164 0F6B8AD91C4EDDA200969052 /* B3DuplicateTails.h in Headers */, 7131 7165 0FE050261AA9095600D33B33 /* ClonedArguments.h in Headers */, 7132 7166 969A07970ED1D3AE00F1F681 /* CodeBlock.h in Headers */, … … 7242 7276 0F7B294D14C3CD4C007C3DB1 /* DFGCommon.h in Headers */, 7243 7277 0FEA0A32170D40BF00BB722C /* DFGCommonData.h in Headers */, 7278 0F725CB01C506D3B00AD943A /* B3FoldPathConstants.h in Headers */, 7244 7279 0F38B01817CFE75500B144D3 /* DFGCompilationKey.h in Headers */, 7245 7280 0F9D4C111C3E2C74006CD984 /* FTLPatchpointExceptionHandle.h in Headers */, … … 7304 7339 0F5874EE194FEB1200AAB2C1 /* DFGMayExit.h in Headers */, 7305 7340 0F2BDC451522801B00CD8910 /* DFGMinifiedGraph.h in Headers */, 7341 0F6B8AE31C4EFE1700969052 /* B3BreakCriticalEdges.h in Headers */, 7306 7342 0F2E892D16D02BAF009E4FD2 /* DFGMinifiedID.h in Headers */, 7307 7343 0F2BDC461522802000CD8910 /* DFGMinifiedNode.h in Headers */, … … 7424 7460 0FEA0A1F1708B00700BB722C /* FTLAbstractHeapRepository.h in Headers */, 7425 7461 0F485328187DFDEC0083B687 /* FTLAvailableRecovery.h in Headers */, 7462 0F6B8AE51C4EFE1700969052 /* B3FixSSA.h in Headers */, 7426 7463 0FEA0A0A170513DB00BB722C /* FTLCapabilities.h in Headers */, 7427 7464 0FEA0A231709606900BB722C /* FTLCommonValues.h in Headers */, … … 8101 8138 7B8329BF1BB21FE300649A6E /* WASMFunctionLLVMIRGenerator.h in Headers */, 8102 8139 7B0247571B8682E400542440 /* WASMFunctionParser.h in Headers */, 8140 0F6B8ADD1C4EFAC300969052 /* B3SSACalculator.h in Headers */, 8103 8141 7B0247591B868EB700542440 /* WASMFunctionSyntaxChecker.h in Headers */, 8104 8142 7B39F76E1B62DE3200360FB4 /* WASMModuleParser.h in Headers */, … … 8784 8822 0F0B83B014BCF71600885B4F /* CallLinkInfo.cpp in Sources */, 8785 8823 0F93329D14CA7DC30085F3C6 /* CallLinkStatus.cpp in Sources */, 8824 0F6B8ADC1C4EFAC300969052 /* B3SSACalculator.cpp in Sources */, 8786 8825 627673231B680C1E00FD9F2E /* CallMode.cpp in Sources */, 8787 8826 0F3B7E2A19A11B8000D9BC56 /* CallVariant.cpp in Sources */, … … 8928 8967 0F235BEB17178E7300690C7F /* DFGOSRExitBase.cpp in Sources */, 8929 8968 0FC09792146A6F7300CF2442 /* DFGOSRExitCompiler.cpp in Sources */, 8969 0F4DE1D11C4D764B004D6C11 /* B3OriginDump.cpp in Sources */, 8930 8970 FE3A06B11C10CB8400390FDD /* JITBitAndGenerator.cpp in Sources */, 8931 8971 0FC09776146943B000CF2442 /* DFGOSRExitCompiler32_64.cpp in Sources */, … … 9024 9064 0FEA0A281709623B00BB722C /* FTLIntrinsicRepository.cpp in Sources */, 9025 9065 0FEA0A0D170513DB00BB722C /* FTLJITCode.cpp in Sources */, 9066 0F6B8AE21C4EFE1700969052 /* B3BreakCriticalEdges.cpp in Sources */, 9026 9067 A78A9780179738D5009DF744 /* FTLJITFinalizer.cpp in Sources */, 9027 9068 0F6B1CB5185FC9E900845D97 /* FTLJSCall.cpp in Sources */, 9028 9069 0FD1202F1A8AED12000F5280 /* FTLJSCallBase.cpp in Sources */, 9070 0F725CAF1C506D3B00AD943A /* B3FoldPathConstants.cpp in Sources */, 9029 9071 0FD120331A8C85BD000F5280 /* FTLJSCallVarargs.cpp in Sources */, 9030 9072 62774DAA1B8D4B190006F05A /* FTLJSTailCall.cpp in Sources */, … … 9367 9409 A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */, 9368 9410 0F24E55017EE274900ABB217 /* Repatch.cpp in Sources */, 9411 0F6B8AD81C4EDDA200969052 /* B3DuplicateTails.cpp in Sources */, 9369 9412 527773DE1AAF83AC00BDE7E8 /* RuntimeType.cpp in Sources */, 9370 9413 0F7700921402FF3C0078EB39 /* SamplingCounter.cpp in Sources */, … … 9430 9473 0F2D4DEB19832DC4007D4B19 /* TypeProfilerLog.cpp in Sources */, 9431 9474 0F2D4DEF19832DD3007D4B19 /* TypeSet.cpp in Sources */, 9475 0F6B8AE41C4EFE1700969052 /* B3FixSSA.cpp in Sources */, 9432 9476 0FF4274A158EBE91004CB9FF /* udis86.c in Sources */, 9433 9477 0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */, -
trunk/Source/JavaScriptCore/b3/B3ArgumentRegValue.cpp
r191993 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 40 40 } 41 41 42 Value* ArgumentRegValue::cloneImpl() const 43 { 44 return new ArgumentRegValue(*this); 45 } 46 42 47 } } // namespace JSC::B3 43 48 -
trunk/Source/JavaScriptCore/b3/B3ArgumentRegValue.h
r191994 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 void dumpMeta(CommaPrinter&, PrintStream&) const override; 46 46 47 Value* cloneImpl() const override; 48 47 49 private: 48 50 friend class Procedure; -
trunk/Source/JavaScriptCore/b3/B3BasicBlock.cpp
r194372 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 53 53 { 54 54 m_values.append(value); 55 } 56 57 void BasicBlock::appendNonTerminal(Value* value) 58 { 59 m_values.append(m_values.last()); 60 m_values[m_values.size() - 1] = value; 55 61 } 56 62 -
trunk/Source/JavaScriptCore/b3/B3BasicBlock.h
r194915 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 72 72 73 73 JS_EXPORT_PRIVATE void append(Value*); 74 JS_EXPORT_PRIVATE void appendNonTerminal(Value*); 74 75 JS_EXPORT_PRIVATE void replaceLast(Procedure&, Value*); 75 76 76 77 template<typename ValueType, typename... Arguments> 77 78 ValueType* appendNew(Procedure&, Arguments...); 79 template<typename ValueType, typename... Arguments> 80 ValueType* appendNewNonTerminal(Procedure&, Arguments...); 78 81 79 82 JS_EXPORT_PRIVATE Value* appendIntConstant(Procedure&, Origin, Type, int64_t value); -
trunk/Source/JavaScriptCore/b3/B3BasicBlockInlines.h
r192295 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 40 40 ValueType* result = procedure.add<ValueType>(arguments...); 41 41 append(result); 42 return result; 43 } 44 45 template<typename ValueType, typename... Arguments> 46 ValueType* BasicBlock::appendNewNonTerminal(Procedure& procedure, Arguments... arguments) 47 { 48 ValueType* result = procedure.add<ValueType>(arguments...); 49 appendNonTerminal(result); 42 50 return result; 43 51 } -
trunk/Source/JavaScriptCore/b3/B3BlockInsertionSet.h
r192346 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 62 62 // executed on the newly created block - this makes sense if you had previously inserted 63 63 // things into the original block, since the newly created block will be indexed identically 64 // to ho ld this block was indexed for all values prior to valueIndex. After this runs, it65 // setsvalueIndex to zero. This allows you to use this method for things like:64 // to how this block was indexed for all values prior to valueIndex. After this runs, it sets 65 // valueIndex to zero. This allows you to use this method for things like: 66 66 // 67 67 // for (unsigned valueIndex = 0; valueIndex < block->size(); ++valueIndex) { -
trunk/Source/JavaScriptCore/b3/B3CCallValue.cpp
r191994 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 } 36 36 37 Value* CCallValue::cloneImpl() const 38 { 39 return new CCallValue(*this); 40 } 41 37 42 } } // namespace JSC::B3 38 43 -
trunk/Source/JavaScriptCore/b3/B3CCallValue.h
r195139 r195395 42 42 Effects effects { Effects::forCall() }; 43 43 44 protected: 45 Value* cloneImpl() const override; 46 44 47 private: 45 48 friend class Procedure; -
trunk/Source/JavaScriptCore/b3/B3CheckValue.cpp
r193393 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 41 41 } 42 42 43 Value* CheckValue::cloneImpl() const 44 { 45 return new CheckValue(*this); 46 } 47 43 48 // Use this form for CheckAdd, CheckSub, and CheckMul. 44 49 CheckValue::CheckValue(unsigned index, Opcode opcode, Origin origin, Value* left, Value* right) -
trunk/Source/JavaScriptCore/b3/B3CheckValue.h
r192540 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 52 52 void convertToAdd(); 53 53 54 protected: 55 Value* cloneImpl() const override; 56 54 57 private: 55 58 friend class Procedure; -
trunk/Source/JavaScriptCore/b3/B3Const32Value.cpp
r193933 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 242 242 } 243 243 244 Value* Const32Value::cloneImpl() const 245 { 246 return new Const32Value(*this); 247 } 248 244 249 } } // namespace JSC::B3 245 250 -
trunk/Source/JavaScriptCore/b3/B3Const32Value.h
r195362 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 74 74 void dumpMeta(CommaPrinter&, PrintStream&) const override; 75 75 76 Value* cloneImpl() const override; 77 76 78 friend class Procedure; 77 79 -
trunk/Source/JavaScriptCore/b3/B3Const64Value.cpp
r193933 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 242 242 } 243 243 244 Value* Const64Value::cloneImpl() const 245 { 246 return new Const64Value(*this); 247 } 248 244 249 } } // namespace JSC::B3 245 250 -
trunk/Source/JavaScriptCore/b3/B3Const64Value.h
r193933 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 74 74 void dumpMeta(CommaPrinter&, PrintStream&) const override; 75 75 76 Value* cloneImpl() const override; 77 76 78 friend class Procedure; 77 79 -
trunk/Source/JavaScriptCore/b3/B3ConstDoubleValue.cpp
r194314 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 176 176 } 177 177 178 Value* ConstDoubleValue::cloneImpl() const 179 { 180 return new ConstDoubleValue(*this); 181 } 182 178 183 } } // namespace JSC::B3 179 184 -
trunk/Source/JavaScriptCore/b3/B3ConstDoubleValue.h
r194314 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 66 66 void dumpMeta(CommaPrinter&, PrintStream&) const override; 67 67 68 Value* cloneImpl() const override; 69 68 70 private: 69 71 friend class Procedure; -
trunk/Source/JavaScriptCore/b3/B3ConstFloatValue.cpp
r194062 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 158 158 } 159 159 160 Value* ConstFloatValue::cloneImpl() const 161 { 162 return new ConstFloatValue(*this); 163 } 164 160 165 } } // namespace JSC::B3 161 166 -
trunk/Source/JavaScriptCore/b3/B3ConstFloatValue.h
r194062 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 64 64 void dumpMeta(CommaPrinter&, PrintStream&) const override; 65 65 66 Value* cloneImpl() const override; 67 66 68 private: 67 69 friend class Procedure; -
trunk/Source/JavaScriptCore/b3/B3ControlValue.cpp
r194855 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 84 84 } 85 85 86 Value* ControlValue::cloneImpl() const 87 { 88 return new ControlValue(*this); 89 } 90 86 91 } } // namespace JSC::B3 87 92 -
trunk/Source/JavaScriptCore/b3/B3ControlValue.h
r195362 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 31 31 #include "B3FrequentedBlock.h" 32 #include "B3SuccessorCollection.h" 32 33 #include "B3Value.h" 33 34 … … 65 66 SuccessorList& successors() { return m_successors; } 66 67 68 BasicBlock* successorBlock(unsigned index) const { return successor(index).block(); } 69 BasicBlock*& successorBlock(unsigned index) { return successor(index).block(); } 70 SuccessorCollection<BasicBlock, SuccessorList> successorBlocks() 71 { 72 return SuccessorCollection<BasicBlock, SuccessorList>(successors()); 73 } 74 SuccessorCollection<const BasicBlock, const SuccessorList> successorBlocks() const 75 { 76 return SuccessorCollection<const BasicBlock, const SuccessorList>(successors()); 77 } 78 67 79 bool replaceSuccessor(BasicBlock* from, BasicBlock* to); 68 80 … … 93 105 protected: 94 106 void dumpMeta(CommaPrinter&, PrintStream&) const override; 107 108 Value* cloneImpl() const override; 95 109 96 110 // Use this for subclasses. -
trunk/Source/JavaScriptCore/b3/B3Generate.cpp
r195159 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 #include "AirInstInlines.h" 34 34 #include "B3Common.h" 35 #include "B3DuplicateTails.h" 36 #include "B3FoldPathConstants.h" 35 37 #include "B3LegalizeMemoryOffsets.h" 36 38 #include "B3LowerMacros.h" … … 74 76 validate(procedure); 75 77 78 if (optLevel >= 1) { 79 reduceDoubleToFloat(procedure); 80 reduceStrength(procedure); 81 duplicateTails(procedure); 82 foldPathConstants(procedure); 83 84 // FIXME: Add more optimizations here. 85 // https://bugs.webkit.org/show_bug.cgi?id=150507 86 } 87 76 88 lowerMacros(procedure); 77 89 78 90 if (optLevel >= 1) { 79 reduceDoubleToFloat(procedure);80 81 91 reduceStrength(procedure); 82 92 … … 86 96 87 97 lowerMacrosAfterOptimizations(procedure); 88 89 98 legalizeMemoryOffsets(procedure); 90 91 99 moveConstants(procedure); 92 100 -
trunk/Source/JavaScriptCore/b3/B3IndexSet.h
r194834 r195395 73 73 class Iterable { 74 74 public: 75 Iterable(const CollectionType& collection, const IndexSet& set)75 Iterable(const CollectionType& collection, const BitVector& set) 76 76 : m_collection(collection) 77 77 , m_set(set) … … 123 123 private: 124 124 const CollectionType& m_collection; 125 const IndexSet& m_set;125 const BitVector& m_set; 126 126 }; 127 127 … … 134 134 Iterable<CollectionType> values(const CollectionType& collection) const 135 135 { 136 return Iterable<CollectionType>(collection );136 return Iterable<CollectionType>(collection, indices()); 137 137 } 138 138 -
trunk/Source/JavaScriptCore/b3/B3InsertionSet.cpp
r192295 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 } 47 47 48 Value* InsertionSet::insertBottom(size_t index, Origin origin, Type type) 49 { 50 return insertValue(index, m_procedure.addBottom(origin, type)); 51 } 52 53 Value* InsertionSet::insertBottom(size_t index, Value* likeValue) 54 { 55 return insertBottom(index, likeValue->origin(), likeValue->type()); 56 } 57 48 58 void InsertionSet::execute(BasicBlock* block) 49 59 { -
trunk/Source/JavaScriptCore/b3/B3InsertionSet.h
r194855 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 68 68 Value* insertIntConstant(size_t index, Value* likeValue, int64_t value); 69 69 70 Value* insertBottom(size_t index, Origin, Type); 71 Value* insertBottom(size_t index, Value*); 72 70 73 void execute(BasicBlock*); 71 74 -
trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
r195298 r195395 89 89 case Phi: { 90 90 m_phiToTmp[value] = m_code.newTmp(Arg::typeForB3Type(value->type())); 91 if (verbose) 92 dataLog("Phi tmp for ", *value, ": ", m_phiToTmp[value], "\n"); 91 93 break; 92 94 } … … 307 309 if (m_procedure.isFastConstant(value->key())) 308 310 m_code.addFastTmp(realTmp); 311 if (verbose) 312 dataLog("Tmp for ", *value, ": ", realTmp, "\n"); 309 313 } 310 314 tmp = realTmp; -
trunk/Source/JavaScriptCore/b3/B3MemoryValue.cpp
r193683 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 62 62 } 63 63 64 Value* MemoryValue::cloneImpl() const 65 { 66 return new MemoryValue(*this); 67 } 68 64 69 } } // namespace JSC::B3 65 70 -
trunk/Source/JavaScriptCore/b3/B3MemoryValue.h
r193989 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 65 65 protected: 66 66 void dumpMeta(CommaPrinter& comma, PrintStream&) const override; 67 68 Value* cloneImpl() const override; 67 69 68 70 private: -
trunk/Source/JavaScriptCore/b3/B3OriginDump.h
r194372 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 31 31 #include "B3Origin.h" 32 #include "B3Procedure.h"33 32 34 33 namespace JSC { namespace B3 { 35 34 35 class Procedure; 36 36 37 class OriginDump { 37 38 public: 38 OriginDump(const Procedure &proc, Origin origin)39 OriginDump(const Procedure* proc, Origin origin) 39 40 : m_proc(proc) 40 41 , m_origin(origin) … … 42 43 } 43 44 44 void dump(PrintStream& out) const 45 { 46 m_proc.printOrigin(out, m_origin); 47 } 45 void dump(PrintStream& out) const; 48 46 49 47 private: 50 const Procedure &m_proc;48 const Procedure* m_proc; 51 49 Origin m_origin; 52 50 }; -
trunk/Source/JavaScriptCore/b3/B3PatchpointValue.cpp
r194542 r195395 45 45 } 46 46 47 Value* PatchpointValue::cloneImpl() const 48 { 49 return new PatchpointValue(*this); 50 } 51 47 52 PatchpointValue::PatchpointValue(unsigned index, Type type, Origin origin) 48 53 : Base(index, CheckedOpcode, Patchpoint, type, origin) -
trunk/Source/JavaScriptCore/b3/B3PatchpointValue.h
r194542 r195395 66 66 void dumpMeta(CommaPrinter&, PrintStream&) const override; 67 67 68 Value* cloneImpl() const override; 69 68 70 private: 69 71 friend class Procedure; -
trunk/Source/JavaScriptCore/b3/B3Procedure.cpp
r194608 r195395 69 69 } 70 70 71 Value* Procedure::clone(Value* value) 72 { 73 std::unique_ptr<Value> clone(value->cloneImpl()); 74 Value* result = clone.get(); 75 clone->m_index = addValueIndex(); 76 clone->owner = nullptr; 77 m_values[clone->m_index] = WTFMove(clone); 78 return result; 79 } 80 71 81 Value* Procedure::addIntConstant(Origin origin, Type type, int64_t value) 72 82 { … … 91 101 } 92 102 103 Value* Procedure::addBottom(Origin origin, Type type) 104 { 105 return addIntConstant(origin, type, 0); 106 } 107 108 Value* Procedure::addBottom(Value* value) 109 { 110 return addBottom(value->origin(), value->type()); 111 } 112 93 113 Value* Procedure::addBoolConstant(Origin origin, TriState triState) 94 114 { … … 166 186 void Procedure::deleteValue(Value* value) 167 187 { 168 ASSERT(m_values[value->index()].get() == value);188 RELEASE_ASSERT(m_values[value->index()].get() == value); 169 189 m_valueIndexFreeList.append(value->index()); 170 190 m_values[value->index()] = nullptr; -
trunk/Source/JavaScriptCore/b3/B3Procedure.h
r194608 r195395 77 77 ValueType* add(Arguments...); 78 78 79 Value* clone(Value*); 80 79 81 Value* addIntConstant(Origin, Type, int64_t value); 80 82 Value* addIntConstant(Value*, int64_t value); 83 84 Value* addBottom(Origin, Type); 85 Value* addBottom(Value*); 81 86 82 87 // Returns null for MixedTriState. -
trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp
r195314 r195395 30 30 31 31 #include "B3BasicBlockInlines.h" 32 #include "B3BlockInsertionSet.h" 32 33 #include "B3ControlValue.h" 33 34 #include "B3Dominators.h" … … 259 260 : m_proc(proc) 260 261 , m_insertionSet(proc) 262 , m_blockInsertionSet(proc) 261 263 { 262 264 } … … 287 289 288 290 for (m_index = 0; m_index < block->size(); ++m_index) { 291 if (verbose) { 292 dataLog( 293 "Looking at ", *block, " #", m_index, ": ", 294 deepDump(m_proc, block->at(m_index)), "\n"); 295 } 289 296 m_value = m_block->at(m_index); 290 297 m_value->performSubstitution(); … … 296 303 } 297 304 305 if (m_blockInsertionSet.execute()) { 306 m_proc.resetReachability(); 307 m_proc.invalidateCFG(); 308 m_dominators = &m_proc.dominators(); // Recompute if necessary. 309 m_changedCFG = true; 310 } 311 298 312 simplifyCFG(); 299 313 … … 1388 1402 checkValue->child(0) = checkValue->child(0)->child(0); 1389 1403 m_changed = true; 1404 } 1405 1406 // If we are checking some bounded-size SSA expression that leads to a Select that 1407 // has a constant as one of its results, then turn the Select into a Branch and split 1408 // the code between the Check and the Branch. For example, this: 1409 // 1410 // @a = Select(@p, @x, 42) 1411 // @b = Add(@a, 35) 1412 // Check(@b) 1413 // 1414 // becomes this: 1415 // 1416 // Branch(@p, #truecase, #falsecase) 1417 // 1418 // BB#truecase: 1419 // @b_truecase = Add(@x, 35) 1420 // Check(@b_truecase) 1421 // Upsilon(@x, ^a) 1422 // Upsilon(@b_truecase, ^b) 1423 // Jump(#continuation) 1424 // 1425 // BB#falsecase: 1426 // @b_falsecase = Add(42, 35) 1427 // Check(@b_falsecase) 1428 // Upsilon(42, ^a) 1429 // Upsilon(@b_falsecase, ^b) 1430 // Jump(#continuation) 1431 // 1432 // BB#continuation: 1433 // @a = Phi() 1434 // @b = Phi() 1435 // 1436 // The goal of this optimization is to kill a lot of code in one of those basic 1437 // blocks. This is pretty much guaranteed since one of those blocks will replace all 1438 // uses of the Select with a constant, and that constant will be transitively used 1439 // from the check. 1440 static const unsigned selectSpecializationBound = 3; 1441 Value* select = findRecentNodeMatching( 1442 m_value->child(0), selectSpecializationBound, 1443 [&] (Value* value) -> bool { 1444 return value->opcode() == Select 1445 && (value->child(1)->isConstant() && value->child(2)->isConstant()); 1446 }); 1447 if (select) { 1448 specializeSelect(select); 1390 1449 break; 1391 1450 } … … 1457 1516 break; 1458 1517 } 1518 } 1519 1520 // Find a node that: 1521 // - functor(node) returns true. 1522 // - it's reachable from the given node via children. 1523 // - it's in the last "bound" slots in the current basic block. 1524 // This algorithm is optimized under the assumption that the bound is small. 1525 template<typename Functor> 1526 Value* findRecentNodeMatching(Value* start, unsigned bound, const Functor& functor) 1527 { 1528 unsigned startIndex = bound < m_index ? m_index - bound : 0; 1529 Value* result = nullptr; 1530 start->walk( 1531 [&] (Value* value) -> Value::WalkStatus { 1532 bool found = false; 1533 for (unsigned i = startIndex; i <= m_index; ++i) { 1534 if (m_block->at(i) == value) 1535 found = true; 1536 } 1537 if (!found) 1538 return Value::IgnoreChildren; 1539 1540 if (functor(value)) { 1541 result = value; 1542 return Value::Stop; 1543 } 1544 1545 return Value::Continue; 1546 }); 1547 return result; 1548 } 1549 1550 // This specializes a sequence of code up to a Select. This doesn't work when we're at a 1551 // terminal. It would be cool to fix that eventually. The main problem is that instead of 1552 // splitting the block, we should just insert the then/else blocks. We'll have to create 1553 // double the Phis and double the Upsilons. It'll probably be the sort of optimization that 1554 // we want to do only after we've done loop optimizations, since this will *definitely* 1555 // obscure things. In fact, even this simpler form of select specialization will possibly 1556 // obscure other optimizations. It would be great to have two modes of strength reduction, 1557 // one that does obscuring optimizations and runs late, and another that does not do 1558 // obscuring optimizations and runs early. 1559 // FIXME: Make select specialization handle branches. 1560 // FIXME: Have a form of strength reduction that does no obscuring optimizations and runs 1561 // early. 1562 void specializeSelect(Value* source) 1563 { 1564 if (verbose) 1565 dataLog("Specializing select: ", deepDump(m_proc, source), "\n"); 1566 1567 // This mutates startIndex to account for the fact that m_block got the front of it 1568 // chopped off. 1569 BasicBlock* predecessor = 1570 m_blockInsertionSet.splitForward(m_block, m_index, &m_insertionSet); 1571 1572 // Splitting will commit the insertion set, which changes the exact position of the 1573 // source. That's why we do the search after splitting. 1574 unsigned startIndex = UINT_MAX; 1575 for (unsigned i = predecessor->size(); i--;) { 1576 if (predecessor->at(i) == source) { 1577 startIndex = i; 1578 break; 1579 } 1580 } 1581 1582 RELEASE_ASSERT(startIndex != UINT_MAX); 1583 1584 // By BasicBlock convention, caseIndex == 0 => then, caseIndex == 1 => else. 1585 static const unsigned numCases = 2; 1586 BasicBlock* cases[numCases]; 1587 for (unsigned i = 0; i < numCases; ++i) 1588 cases[i] = m_blockInsertionSet.insertBefore(m_block); 1589 1590 HashMap<Value*, Value*> mappings[2]; 1591 1592 // Save things we want to know about the source. 1593 Value* predicate = source->child(0); 1594 1595 for (unsigned i = 0; i < numCases; ++i) 1596 mappings[i].add(source, source->child(1 + i)); 1597 1598 auto cloneValue = [&] (Value* value) { 1599 ASSERT(value != source); 1600 1601 for (unsigned i = 0; i < numCases; ++i) { 1602 Value* clone = m_proc.clone(value); 1603 for (Value*& child : clone->children()) { 1604 if (Value* newChild = mappings[i].get(child)) 1605 child = newChild; 1606 } 1607 if (value->type() != Void) 1608 mappings[i].add(value, clone); 1609 1610 cases[i]->append(clone); 1611 if (value->type() != Void) 1612 cases[i]->appendNew<UpsilonValue>(m_proc, value->origin(), clone, value); 1613 } 1614 1615 value->replaceWithPhi(); 1616 }; 1617 1618 // The jump that the splitter inserted is of no use to us. 1619 predecessor->removeLast(m_proc); 1620 1621 // Hance the source, it's special. 1622 for (unsigned i = 0; i < numCases; ++i) { 1623 cases[i]->appendNew<UpsilonValue>( 1624 m_proc, source->origin(), source->child(1 + i), source); 1625 } 1626 source->replaceWithPhi(); 1627 m_insertionSet.insertValue(m_index, source); 1628 1629 // Now handle all values between the source and the check. 1630 for (unsigned i = startIndex + 1; i < predecessor->size(); ++i) { 1631 Value* value = predecessor->at(i); 1632 value->owner = nullptr; 1633 1634 cloneValue(value); 1635 1636 if (value->type() != Void) 1637 m_insertionSet.insertValue(m_index, value); 1638 else 1639 m_proc.deleteValue(value); 1640 } 1641 1642 // Finally, deal with the check. 1643 cloneValue(m_value); 1644 1645 // Remove the values from the predecessor. 1646 predecessor->values().resize(startIndex); 1647 1648 predecessor->appendNew<ControlValue>( 1649 m_proc, Branch, source->origin(), predicate, 1650 FrequentedBlock(cases[0]), FrequentedBlock(cases[1])); 1651 1652 for (unsigned i = 0; i < numCases; ++i) { 1653 cases[i]->appendNew<ControlValue>( 1654 m_proc, Jump, m_value->origin(), FrequentedBlock(m_block)); 1655 } 1656 1657 m_changed = true; 1658 1659 predecessor->updatePredecessorsAfter(); 1459 1660 } 1460 1661 … … 1837 2038 Procedure& m_proc; 1838 2039 InsertionSet m_insertionSet; 2040 BlockInsertionSet m_blockInsertionSet; 1839 2041 BasicBlock* m_block { nullptr }; 1840 2042 unsigned m_index { 0 }; -
trunk/Source/JavaScriptCore/b3/B3StackSlotKind.h
r191705 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 Locked, 38 38 39 // These stack slots could share space with other stack slots, provided that they aren't live 40 // at the same time. The compiler still has to do escape analysis, since these can be escaped 41 // explicitly in IR. 39 // These stack slots behave like variables. Undefined behavior happens if you store less than 40 // the width of the slot. 42 41 Anonymous 43 42 -
trunk/Source/JavaScriptCore/b3/B3StackSlotValue.cpp
r191993 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 40 40 } 41 41 42 Value* StackSlotValue::cloneImpl() const 43 { 44 return new StackSlotValue(*this); 45 } 46 42 47 } } // namespace JSC::B3 43 48 -
trunk/Source/JavaScriptCore/b3/B3StackSlotValue.h
r191994 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 60 60 void dumpMeta(CommaPrinter&, PrintStream&) const override; 61 61 62 Value* cloneImpl() const override; 63 62 64 private: 63 65 friend class Air::StackSlot; -
trunk/Source/JavaScriptCore/b3/B3SwitchValue.cpp
r192346 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 64 64 } 65 65 66 Value* SwitchValue::cloneImpl() const 67 { 68 return new SwitchValue(*this); 69 } 70 66 71 SwitchValue::SwitchValue( 67 72 unsigned index, Origin origin, Value* child, const FrequentedBlock& fallThrough) -
trunk/Source/JavaScriptCore/b3/B3SwitchValue.h
r192346 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 117 117 void dumpMeta(CommaPrinter&, PrintStream&) const override; 118 118 119 Value* cloneImpl() const override; 120 119 121 private: 120 122 friend class Procedure; -
trunk/Source/JavaScriptCore/b3/B3UpsilonValue.cpp
r191993 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 } 47 47 48 Value* UpsilonValue::cloneImpl() const 49 { 50 return new UpsilonValue(*this); 51 } 52 48 53 } } // namespace JSC::B3 49 54 -
trunk/Source/JavaScriptCore/b3/B3UpsilonValue.h
r191994 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 50 50 void dumpMeta(CommaPrinter&, PrintStream&) const override; 51 51 52 Value* cloneImpl() const override; 53 52 54 private: 53 55 friend class Procedure; … … 60 62 , m_phi(phi) 61 63 { 62 if (phi) {64 if (phi) 63 65 ASSERT(value->type() == phi->type()); 64 ASSERT(phi->opcode() == Phi);65 }66 66 } 67 67 -
trunk/Source/JavaScriptCore/b3/B3Validate.cpp
r194802 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 353 353 VALIDATE(value->numChildren() == 1, ("At ", *value)); 354 354 VALIDATE(value->as<UpsilonValue>()->phi(), ("At ", *value)); 355 VALIDATE(value->as<UpsilonValue>()->phi()->opcode() == Phi, ("At ", *value)); 355 356 VALIDATE(value->child(0)->type() == value->as<UpsilonValue>()->phi()->type(), ("At ", *value)); 356 357 VALIDATE(valueInProc.contains(value->as<UpsilonValue>()->phi()), ("At ", *value)); -
trunk/Source/JavaScriptCore/b3/B3Value.cpp
r194802 r195395 90 90 } 91 91 92 void Value::replaceWithPhi() 93 { 94 if (m_type == Void) { 95 replaceWithNop(); 96 return; 97 } 98 99 unsigned index = m_index; 100 Origin origin = m_origin; 101 BasicBlock* owner = this->owner; 102 Type type = m_type; 103 104 this->Value::~Value(); 105 106 new (this) Value(index, Phi, type, origin); 107 108 this->owner = owner; 109 } 110 92 111 void Value::dump(PrintStream& out) const 93 112 { 94 113 out.print(dumpPrefix, m_index); 114 } 115 116 Value* Value::cloneImpl() const 117 { 118 return new Value(*this); 95 119 } 96 120 … … 101 125 } 102 126 103 void Value::deepDump(const Procedure &proc, PrintStream& out) const127 void Value::deepDump(const Procedure* proc, PrintStream& out) const 104 128 { 105 129 out.print(m_type, " ", *this, " = ", m_opcode); -
trunk/Source/JavaScriptCore/b3/B3Value.h
r194855 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 43 43 class BasicBlock; 44 44 class CheckValue; 45 class PhiChildren; 45 46 class Procedure; 46 47 47 48 class JS_EXPORT_PRIVATE Value { 48 WTF_MAKE_NONCOPYABLE(Value);49 49 WTF_MAKE_FAST_ALLOCATED; 50 50 public: … … 85 85 void replaceWithIdentity(Value*); 86 86 void replaceWithNop(); 87 void replaceWithPhi(); 87 88 88 89 void dump(PrintStream&) const; 89 void deepDump(const Procedure &, PrintStream&) const;90 void deepDump(const Procedure*, PrintStream&) const; 90 91 91 92 // This is how you cast Values. For example, if you want to do something provided that we have a … … 205 206 void performSubstitution(); 206 207 208 // Walk the ancestors of this value (i.e. the graph of things it transitively uses). This 209 // either walks phis or not, depending on whether PhiChildren is null. Your callback gets 210 // called with the signature: 211 // 212 // (Value*) -> WalkStatus 213 enum WalkStatus { 214 Continue, 215 IgnoreChildren, 216 Stop 217 }; 218 template<typename Functor> 219 void walk(const Functor& functor, PhiChildren* = nullptr); 220 207 221 protected: 222 virtual Value* cloneImpl() const; 223 208 224 virtual void dumpChildren(CommaPrinter&, PrintStream&) const; 209 225 virtual void dumpMeta(CommaPrinter&, PrintStream&) const; … … 221 237 protected: 222 238 enum CheckedOpcodeTag { CheckedOpcode }; 239 240 Value(const Value&) = default; 241 Value& operator=(const Value&) = default; 223 242 224 243 // Instantiate values via Procedure. … … 316 335 class DeepValueDump { 317 336 public: 318 DeepValueDump(const Procedure &proc, const Value* value)337 DeepValueDump(const Procedure* proc, const Value* value) 319 338 : m_proc(proc) 320 339 , m_value(value) … … 331 350 332 351 private: 333 const Procedure &m_proc;352 const Procedure* m_proc; 334 353 const Value* m_value; 335 354 }; … … 337 356 inline DeepValueDump deepDump(const Procedure& proc, const Value* value) 338 357 { 339 return DeepValueDump( proc, value);358 return DeepValueDump(&proc, value); 340 359 } 360 inline DeepValueDump deepDump(const Value* value) 361 { 362 return DeepValueDump(nullptr, value); 363 } 341 364 342 365 } } // namespace JSC::B3 -
trunk/Source/JavaScriptCore/b3/B3ValueInlines.h
r193683 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 #include "B3ConstFloatValue.h" 36 36 #include "B3PatchpointValue.h" 37 #include "B3PhiChildren.h" 37 38 #include "B3Procedure.h" 38 39 #include "B3Value.h" 40 #include <wtf/GraphNodeWorklist.h> 39 41 40 42 namespace JSC { namespace B3 { … … 205 207 } 206 208 209 template<typename Functor> 210 void Value::walk(const Functor& functor, PhiChildren* phiChildren) 211 { 212 GraphNodeWorklist<Value*> worklist; 213 worklist.push(this); 214 while (Value* value = worklist.pop()) { 215 WalkStatus status = functor(value); 216 switch (status) { 217 case Continue: 218 if (value->opcode() == Phi) { 219 if (phiChildren) 220 worklist.pushAll(phiChildren->at(value).values()); 221 } else 222 worklist.pushAll(value->children()); 223 break; 224 case IgnoreChildren: 225 break; 226 case Stop: 227 return; 228 } 229 } 230 } 231 207 232 } } // namespace JSC::B3 208 233 -
trunk/Source/JavaScriptCore/b3/B3ValueKey.cpp
r194341 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 36 36 namespace JSC { namespace B3 { 37 38 ValueKey ValueKey::intConstant(Type type, int64_t value) 39 { 40 switch (type) { 41 case Int32: 42 return ValueKey(Const32, Int32, value); 43 case Int64: 44 return ValueKey(Const64, Int64, value); 45 default: 46 RELEASE_ASSERT_NOT_REACHED(); 47 return ValueKey(); 48 } 49 } 37 50 38 51 void ValueKey::dump(PrintStream& out) const -
trunk/Source/JavaScriptCore/b3/B3ValueKey.h
r193683 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 86 86 } 87 87 88 static ValueKey intConstant(Type type, int64_t value); 89 88 90 Opcode opcode() const { return m_opcode; } 89 91 Type type() const { return m_type; } -
trunk/Source/JavaScriptCore/b3/air/AirCode.h
r195298 r195395 29 29 #if ENABLE(B3_JIT) 30 30 31 #include "AirArg.h" 31 32 #include "AirBasicBlock.h" 32 33 #include "AirSpecial.h" -
trunk/Source/JavaScriptCore/b3/air/AirIteratedRegisterCoalescing.cpp
r195387 r195395 54 54 class AbstractColoringAllocator { 55 55 public: 56 AbstractColoringAllocator(const Vector<Reg>& regsInPriorityOrder, IndexType lastPrecoloredRegisterIndex, unsigned tmpArraySize )56 AbstractColoringAllocator(const Vector<Reg>& regsInPriorityOrder, IndexType lastPrecoloredRegisterIndex, unsigned tmpArraySize, const HashSet<unsigned>& unspillableTmp) 57 57 : m_regsInPriorityOrder(regsInPriorityOrder) 58 58 , m_lastPrecoloredRegisterIndex(lastPrecoloredRegisterIndex) 59 , m_unspillableTmps(unspillableTmp) 59 60 { 60 61 initializeDegrees(tmpArraySize); … … 91 92 92 93 if (degree >= m_regsInPriorityOrder.size()) 93 m_spillWorklist.add(i);94 addToSpill(i); 94 95 else if (!m_moveList[i].isEmpty()) 95 96 m_freezeWorklist.add(i); … … 97 98 m_simplifyWorklist.append(i); 98 99 } 100 } 101 102 void addToSpill(unsigned toSpill) 103 { 104 if (m_unspillableTmps.contains(toSpill)) 105 return; 106 107 m_spillWorklist.add(toSpill); 99 108 } 100 109 … … 362 371 363 372 if (m_degrees[u] >= m_regsInPriorityOrder.size() && m_freezeWorklist.remove(u)) 364 m_spillWorklist.add(u);373 addToSpill(u); 365 374 } 366 375 … … 626 635 // The mapping of Tmp to their alias for Moves that are always coalescing regardless of spilling. 627 636 Vector<IndexType, 0, UnsafeVectorOverflow> m_coalescedTmpsAtSpill; 637 638 const HashSet<unsigned>& m_unspillableTmps; 628 639 }; 629 640 … … 633 644 public: 634 645 ColoringAllocator(Code& code, TmpWidth& tmpWidth, const UseCounts<Tmp>& useCounts, const HashSet<unsigned>& unspillableTmp) 635 : AbstractColoringAllocator<unsigned>(regsInPriorityOrder(type), AbsoluteTmpMapper<type>::lastMachineRegisterIndex(), tmpArraySize(code) )646 : AbstractColoringAllocator<unsigned>(regsInPriorityOrder(type), AbsoluteTmpMapper<type>::lastMachineRegisterIndex(), tmpArraySize(code), unspillableTmp) 636 647 , m_code(code) 637 648 , m_tmpWidth(tmpWidth) 638 649 , m_useCounts(useCounts) 639 , m_unspillableTmps(unspillableTmp)640 650 { 641 651 initializePrecoloredTmp(); … … 928 938 auto iterator = m_spillWorklist.begin(); 929 939 930 while (iterator != m_spillWorklist.end() && m_unspillableTmps.contains(*iterator)) 931 ++iterator; 932 933 RELEASE_ASSERT_WITH_MESSAGE(iterator != m_spillWorklist.end(), "It is not possible to color the Air graph with the number of available registers."); 940 RELEASE_ASSERT_WITH_MESSAGE(iterator != m_spillWorklist.end(), "selectSpill() called when there was no spill."); 941 RELEASE_ASSERT_WITH_MESSAGE(!m_unspillableTmps.contains(*iterator), "trying to spill unspillable tmp"); 934 942 935 943 // Higher score means more desirable to spill. Lower scores maximize the likelihood that a tmp … … 946 954 // All else being equal, the score should be inversely related to the number of warm uses and 947 955 // defs. 948 const UseCounts<Tmp>::Counts& counts = m_useCounts[tmp]; 949 double uses = counts.numWarmUses + counts.numDefs; 956 const UseCounts<Tmp>::Counts* counts = m_useCounts[tmp]; 957 if (!counts) 958 return std::numeric_limits<double>::infinity(); 959 960 double uses = counts->numWarmUses + counts->numDefs; 950 961 951 962 // If it's a constant, then it's not as bad to spill. We can rematerialize it in many 952 963 // cases. 953 if (counts .numConstDefs == counts.numDefs)964 if (counts->numConstDefs == counts->numDefs) 954 965 uses /= 2; 955 966 … … 962 973 ++iterator; 963 974 for (;iterator != m_spillWorklist.end(); ++iterator) { 964 if (m_unspillableTmps.contains(*iterator))965 continue;966 967 975 double tmpScore = score(AbsoluteTmpMapper<type>::tmpFromAbsoluteIndex(*iterator)); 968 976 if (tmpScore > maxScore) { 977 ASSERT(!m_unspillableTmps.contains(*iterator)); 969 978 victimIterator = iterator; 970 979 maxScore = tmpScore; … … 1059 1068 // FIXME: spilling should not type specific. It is only a side effect of using UseCounts. 1060 1069 const UseCounts<Tmp>& m_useCounts; 1061 const HashSet<unsigned>& m_unspillableTmps;1062 1070 }; 1063 1071 -
trunk/Source/JavaScriptCore/b3/air/AirUseCounts.h
r195387 r195395 98 98 } 99 99 100 const Counts &operator[](const Thing& arg) const100 const Counts* operator[](const Thing& arg) const 101 101 { 102 auto iterator = m_counts.find(arg); 103 ASSERT(iterator != m_counts.end()); 104 return iterator->value; 102 auto iter = m_counts.find(arg); 103 if (iter == m_counts.end()) 104 return nullptr; 105 return &iter->value; 105 106 } 106 107 -
trunk/Source/JavaScriptCore/b3/testb3.cpp
r195159 r195395 9064 9064 CHECK(invoke<intptr_t>(*code, 43, 1, 2) == 2); 9065 9065 CHECK(invoke<intptr_t>(*code, 43, 642462, 32533) == 32533); 9066 } 9067 9068 void testCheckSelect() 9069 { 9070 Procedure proc; 9071 BasicBlock* root = proc.addBlock(); 9072 9073 CheckValue* check = root->appendNew<CheckValue>( 9074 proc, Check, Origin(), 9075 root->appendNew<Value>( 9076 proc, Add, Origin(), 9077 root->appendNew<Value>( 9078 proc, Select, Origin(), 9079 root->appendNew<Value>( 9080 proc, BitAnd, Origin(), 9081 root->appendNew<Value>( 9082 proc, Trunc, Origin(), 9083 root->appendNew<ArgumentRegValue>( 9084 proc, Origin(), GPRInfo::argumentGPR0)), 9085 root->appendNew<Const32Value>(proc, Origin(), 0xff)), 9086 root->appendNew<ConstPtrValue>(proc, Origin(), -42), 9087 root->appendNew<ConstPtrValue>(proc, Origin(), 35)), 9088 root->appendNew<ConstPtrValue>(proc, Origin(), 42))); 9089 unsigned generationCount = 0; 9090 check->setGenerator( 9091 [&] (CCallHelpers& jit, const StackmapGenerationParams&) { 9092 AllowMacroScratchRegisterUsage allowScratch(jit); 9093 9094 generationCount++; 9095 jit.move(CCallHelpers::TrustedImm32(666), GPRInfo::returnValueGPR); 9096 jit.emitFunctionEpilogue(); 9097 jit.ret(); 9098 }); 9099 9100 root->appendNew<ControlValue>( 9101 proc, Return, Origin(), 9102 root->appendNew<Const32Value>(proc, Origin(), 0)); 9103 9104 auto code = compile(proc); 9105 CHECK(generationCount == 1); 9106 CHECK(invoke<int>(*code, true) == 0); 9107 CHECK(invoke<int>(*code, false) == 666); 9108 } 9109 9110 void testCheckSelectCheckSelect() 9111 { 9112 Procedure proc; 9113 BasicBlock* root = proc.addBlock(); 9114 9115 CheckValue* check = root->appendNew<CheckValue>( 9116 proc, Check, Origin(), 9117 root->appendNew<Value>( 9118 proc, Add, Origin(), 9119 root->appendNew<Value>( 9120 proc, Select, Origin(), 9121 root->appendNew<Value>( 9122 proc, BitAnd, Origin(), 9123 root->appendNew<Value>( 9124 proc, Trunc, Origin(), 9125 root->appendNew<ArgumentRegValue>( 9126 proc, Origin(), GPRInfo::argumentGPR0)), 9127 root->appendNew<Const32Value>(proc, Origin(), 0xff)), 9128 root->appendNew<ConstPtrValue>(proc, Origin(), -42), 9129 root->appendNew<ConstPtrValue>(proc, Origin(), 35)), 9130 root->appendNew<ConstPtrValue>(proc, Origin(), 42))); 9131 9132 unsigned generationCount = 0; 9133 check->setGenerator( 9134 [&] (CCallHelpers& jit, const StackmapGenerationParams&) { 9135 AllowMacroScratchRegisterUsage allowScratch(jit); 9136 9137 generationCount++; 9138 jit.move(CCallHelpers::TrustedImm32(666), GPRInfo::returnValueGPR); 9139 jit.emitFunctionEpilogue(); 9140 jit.ret(); 9141 }); 9142 9143 CheckValue* check2 = root->appendNew<CheckValue>( 9144 proc, Check, Origin(), 9145 root->appendNew<Value>( 9146 proc, Add, Origin(), 9147 root->appendNew<Value>( 9148 proc, Select, Origin(), 9149 root->appendNew<Value>( 9150 proc, BitAnd, Origin(), 9151 root->appendNew<Value>( 9152 proc, Trunc, Origin(), 9153 root->appendNew<ArgumentRegValue>( 9154 proc, Origin(), GPRInfo::argumentGPR1)), 9155 root->appendNew<Const32Value>(proc, Origin(), 0xff)), 9156 root->appendNew<ConstPtrValue>(proc, Origin(), -43), 9157 root->appendNew<ConstPtrValue>(proc, Origin(), 36)), 9158 root->appendNew<ConstPtrValue>(proc, Origin(), 43))); 9159 9160 unsigned generationCount2 = 0; 9161 check2->setGenerator( 9162 [&] (CCallHelpers& jit, const StackmapGenerationParams&) { 9163 AllowMacroScratchRegisterUsage allowScratch(jit); 9164 9165 generationCount2++; 9166 jit.move(CCallHelpers::TrustedImm32(667), GPRInfo::returnValueGPR); 9167 jit.emitFunctionEpilogue(); 9168 jit.ret(); 9169 }); 9170 9171 root->appendNew<ControlValue>( 9172 proc, Return, Origin(), 9173 root->appendNew<Const32Value>(proc, Origin(), 0)); 9174 9175 auto code = compile(proc); 9176 CHECK(generationCount == 1); 9177 CHECK(generationCount2 == 1); 9178 CHECK(invoke<int>(*code, true, true) == 0); 9179 CHECK(invoke<int>(*code, false, true) == 666); 9180 CHECK(invoke<int>(*code, true, false) == 667); 9066 9181 } 9067 9182 … … 10075 10190 10076 10191 RUN(testComplex(64, 128)); 10077 RUN(testComplex(64, 256));10078 RUN(testComplex(64, 384));10079 10192 RUN(testComplex(4, 128)); 10080 10193 RUN(testComplex(4, 256)); … … 10525 10638 RUN(testSelectFold(43)); 10526 10639 RUN(testSelectInvert()); 10640 RUN(testCheckSelect()); 10641 RUN(testCheckSelectCheckSelect()); 10527 10642 RUN_BINARY(testPowDoubleByIntegerLoop, floatingPointOperands<double>(), int64Operands()); 10528 10643 -
trunk/Source/JavaScriptCore/runtime/Options.h
r195298 r195395 1 1 /* 2 * Copyright (C) 2011-201 5Apple Inc. All rights reserved.2 * Copyright (C) 2011-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 345 345 v(bool, airSpillsEverything, false, nullptr) \ 346 346 v(bool, logAirRegisterPressure, false, nullptr) \ 347 v(unsigned, maxB3TailDupBlockSize, 3, nullptr) \ 348 v(unsigned, maxB3TailDupBlockSuccessors, 3, nullptr) \ 347 349 \ 348 350 v(bool, useDollarVM, false, "installs the $vm debugging tool in global objects") \ -
trunk/Source/WTF/ChangeLog
r195356 r195395 1 2016-01-19 Filip Pizlo <fpizlo@apple.com> 2 3 B3 should have basic path specialization 4 https://bugs.webkit.org/show_bug.cgi?id=153200 5 6 Reviewed by Benjamin Poulain. 7 8 * wtf/GraphNodeWorklist.h: 9 (WTF::GraphNodeWorklist::push): 10 (WTF::GraphNodeWorklist::pushAll): 11 (WTF::GraphNodeWorklist::isEmpty): 12 (WTF::GraphNodeWorklist::notEmpty): 13 1 14 2016-01-20 Said Abou-Hallawa <sabouhallawa@apple.com> 2 15 -
trunk/Source/WTF/wtf/GraphNodeWorklist.h
r192539 r195395 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 } 47 47 48 template<typename Iterable> 49 void pushAll(const Iterable& iterable) 50 { 51 for (Node node : iterable) 52 push(node); 53 } 54 48 55 bool isEmpty() const { return m_stack.isEmpty(); } 49 56 bool notEmpty() const { return !m_stack.isEmpty(); } -
trunk/Tools/Scripts/display-profiler-output
r172129 r195395 536 536 end 537 537 538 def summary(mode )538 def summary(mode, order) 539 539 remaining = screenWidth 540 540 … … 619 619 $bytecodes.sort { 620 620 | a, b | 621 b.totalMaxTopExecutionCount <=> a.totalMaxTopExecutionCount 621 case order 622 when :bytecode 623 b.totalMaxTopExecutionCount <=> a.totalMaxTopExecutionCount 624 when :machine 625 b.totalMaxBottomExecutionCount <=> a.totalMaxBottomExecutionCount 626 else 627 raise 628 end 622 629 }.each { 623 630 | bytecode | … … 739 746 exit 0 740 747 when "summary", "s" 741 summary(:summary )748 summary(:summary, :bytecode) 742 749 when "full", "f" 743 summary(:full) 750 if args[0] and (args[0] == "m" or args[0] == "machine") 751 summary(:full, :machine) 752 else 753 summary(:full, :bytecode) 754 end 744 755 when "source" 745 756 if args.length != 1
Note: See TracChangeset
for help on using the changeset viewer.