Changeset 196573 in webkit
- Timestamp:
- Feb 15, 2016 1:12:45 AM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r196562 r196573 1 2016-02-15 Benjamin Poulain <bpoulain@apple.com> 2 3 [JSC] Improve the interface of Inst::shouldTryAliasingDef() 4 https://bugs.webkit.org/show_bug.cgi?id=154227 5 6 Reviewed by Andreas Kling. 7 8 Using Optional<> instead of a bool+reference looks cleaner 9 at the call sites. 10 11 * b3/B3CheckSpecial.cpp: 12 (JSC::B3::CheckSpecial::shouldTryAliasingDef): 13 * b3/B3CheckSpecial.h: 14 * b3/air/AirCustom.h: 15 (JSC::B3::Air::PatchCustom::shouldTryAliasingDef): 16 * b3/air/AirInst.h: 17 * b3/air/AirInstInlines.h: 18 (JSC::B3::Air::Inst::shouldTryAliasingDef): 19 * b3/air/AirIteratedRegisterCoalescing.cpp: 20 * b3/air/AirSpecial.cpp: 21 (JSC::B3::Air::Special::shouldTryAliasingDef): 22 * b3/air/AirSpecial.h: 23 1 24 2016-02-14 Brian Burg <bburg@apple.com> 2 25 -
trunk/Source/JavaScriptCore/b3/B3CheckSpecial.cpp
r196513 r196573 131 131 } 132 132 133 bool CheckSpecial::shouldTryAliasingDef(Inst& inst, unsigned& defIndex) 134 { 135 if (hiddenBranch(inst).shouldTryAliasingDef(defIndex)) { 136 defIndex += 1; 137 return true; 138 } 139 return false; 133 Optional<unsigned> CheckSpecial::shouldTryAliasingDef(Inst& inst) 134 { 135 if (Optional<unsigned> branchDef = hiddenBranch(inst).shouldTryAliasingDef()) 136 return *branchDef + 1; 137 return Nullopt; 140 138 } 141 139 -
trunk/Source/JavaScriptCore/b3/B3CheckSpecial.h
r196513 r196573 127 127 bool isValid(Air::Inst&) override; 128 128 bool admitsStack(Air::Inst&, unsigned argIndex) override; 129 bool shouldTryAliasingDef(Air::Inst&, unsigned& defIndex) override;129 Optional<unsigned> shouldTryAliasingDef(Air::Inst&) override; 130 130 131 131 // NOTE: the generate method will generate the hidden branch and then register a LatePath that -
trunk/Source/JavaScriptCore/b3/air/AirCustom.h
r196513 r196573 81 81 } 82 82 83 static bool shouldTryAliasingDef(Inst& inst, unsigned& defIndex)84 { 85 return inst.args[0].special()->shouldTryAliasingDef(inst , defIndex);83 static Optional<unsigned> shouldTryAliasingDef(Inst& inst) 84 { 85 return inst.args[0].special()->shouldTryAliasingDef(inst); 86 86 } 87 87 -
trunk/Source/JavaScriptCore/b3/air/AirInst.h
r196513 r196573 181 181 CCallHelpers::Jump generate(CCallHelpers&, GenerationContext&); 182 182 183 // Returns true if the register allocator should attempt to alias the arguments with the destination 184 // for this instruction. 185 // If the method returns true, defIndex is set to the index of the destination argument. The indices 186 // (defIndex - 1) and (defIndex - 2) are the one to alias to defIndex. 187 bool shouldTryAliasingDef(unsigned& defIndex); 183 // If source arguments benefits from being aliased to a destination argument, 184 // this return the index of the destination argument. 185 // The source are assumed to be at (index - 1) and (index - 2) 186 // For example, 187 // Add Tmp1, Tmp2, Tmp3 188 // returns 2 if 0 and 1 benefit from aliasing to Tmp3. 189 Optional<unsigned> shouldTryAliasingDef(); 188 190 189 191 void dump(PrintStream&) const; -
trunk/Source/JavaScriptCore/b3/air/AirInstInlines.h
r196513 r196573 165 165 } 166 166 167 inline bool Inst::shouldTryAliasingDef(unsigned& defIndex)167 inline Optional<unsigned> Inst::shouldTryAliasingDef() 168 168 { 169 169 if (!isX86()) 170 return false;170 return Nullopt; 171 171 172 172 switch (opcode) { … … 189 189 case XorDouble: 190 190 case XorFloat: 191 if (args.size() == 3) { 192 defIndex = 2; 193 return true; 194 } 191 if (args.size() == 3) 192 return 2; 195 193 break; 196 194 case BranchAdd32: 197 195 case BranchAdd64: 198 if (args.size() == 4) { 199 defIndex = 3; 200 return true; 201 } 196 if (args.size() == 4) 197 return 3; 202 198 break; 203 199 case Patch: 204 return PatchCustom::shouldTryAliasingDef(*this , defIndex);200 return PatchCustom::shouldTryAliasingDef(*this); 205 201 default: 206 202 break; 207 203 } 208 return false;204 return Nullopt; 209 205 } 210 206 -
trunk/Source/JavaScriptCore/b3/air/AirIteratedRegisterCoalescing.cpp
r196513 r196573 993 993 for (BasicBlock* block : m_code) { 994 994 for (Inst& inst : *block) { 995 unsigned defArgIndex = 0; 996 if (inst.shouldTryAliasingDef(defArgIndex)) { 997 Arg op1 = inst.args[defArgIndex - 2]; 998 Arg op2 = inst.args[defArgIndex - 1]; 999 Arg dest = inst.args[defArgIndex]; 995 if (Optional<unsigned> defArgIndex = inst.shouldTryAliasingDef()) { 996 Arg op1 = inst.args[*defArgIndex - 2]; 997 Arg op2 = inst.args[*defArgIndex - 1]; 998 Arg dest = inst.args[*defArgIndex]; 1000 999 1001 1000 if (op1 == dest || op2 == dest) -
trunk/Source/JavaScriptCore/b3/air/AirSpecial.cpp
r196513 r196573 51 51 } 52 52 53 bool Special::shouldTryAliasingDef(Inst&, unsigned&)53 Optional<unsigned> Special::shouldTryAliasingDef(Inst&) 54 54 { 55 return false;55 return Nullopt; 56 56 } 57 57 -
trunk/Source/JavaScriptCore/b3/air/AirSpecial.h
r196513 r196573 57 57 virtual bool isValid(Inst&) = 0; 58 58 virtual bool admitsStack(Inst&, unsigned argIndex) = 0; 59 virtual bool shouldTryAliasingDef(Inst&, unsigned& defIndex);59 virtual Optional<unsigned> shouldTryAliasingDef(Inst&); 60 60 61 61 // This gets called on for each Inst that uses this Special. Note that there is no way to
Note: See TracChangeset
for help on using the changeset viewer.