Changeset 196616 in webkit
- Timestamp:
- Feb 15, 2016 8:51:20 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r196594 r196616 1 2016-02-15 Benjamin Poulain <bpoulain@apple.com> 2 3 [JSC] BranchAdd can override arguments of its stackmap 4 https://bugs.webkit.org/show_bug.cgi?id=154274 5 6 Reviewed by Filip Pizlo. 7 8 With the 3 operands BranchAdd added in r196513, we can run into 9 a register allocation such that the destination register is also 10 used by a value in the stack map. 11 12 It use to be that BranchAdd was a 2 operand instruction. 13 In that form, the destination is also one of the source and 14 can be recovered through Sub. There is no conflict between 15 destination and the stackmap. 16 17 After r196513, the destination has its own value. It is uncommon 18 on x86 because of the aggressive aliasing but that can happen. 19 On ARM, that's a standard form since there is no need for aliasing. 20 21 Since the arguments of the stackmap are of type EarlyUse, 22 they appeared as not interfering with the destination. When the register 23 allocator gives the same register to the destination and something in 24 the stack map, the result of BranchAdd destroys the value kept alive 25 for the stackmap. 26 27 In this patch, I introduce a concept very similar to ForceLateUse 28 to keep the argument of the stackmap live in CheckAdd. The new 29 role is "ForceLateUseUnlessRecoverable". 30 31 In this mode, anything that is not also an input argument becomes 32 LateUse. As such, it interferes with the destination of CheckAdd. 33 The arguments are recovered by the slow patch of CheckAdd. They 34 remain Early use. 35 36 This new modes ensure that destination can be aliased to the source 37 when that's useful, while making sure it is not aliased with another 38 value that needs to be live on exit. 39 40 * b3/B3CheckSpecial.cpp: 41 (JSC::B3::CheckSpecial::forEachArg): 42 * b3/B3LowerToAir.cpp: 43 (JSC::B3::Air::LowerToAir::lower): 44 * b3/B3PatchpointSpecial.cpp: 45 (JSC::B3::PatchpointSpecial::forEachArg): 46 * b3/B3StackmapSpecial.cpp: 47 (JSC::B3::StackmapSpecial::forEachArgImpl): 48 (WTF::printInternal): 49 * b3/B3StackmapSpecial.h: 50 * b3/B3StackmapValue.h: 51 1 52 2016-02-15 Joseph Pecoraro <pecoraro@apple.com> 2 53 -
trunk/Source/JavaScriptCore/b3/B3CheckSpecial.cpp
r196573 r196616 114 114 callback(inst.args[1 + index], role, type, width); 115 115 }); 116 forEachArgImpl(numB3Args(inst), m_numCheckArgs + 1, inst, m_stackmapRole, callback); 116 117 Optional<unsigned> firstRecoverableIndex; 118 if (m_checkOpcode == BranchAdd32 || m_checkOpcode == BranchAdd64) 119 firstRecoverableIndex = 1; 120 forEachArgImpl(numB3Args(inst), m_numCheckArgs + 1, inst, m_stackmapRole, firstRecoverableIndex, callback); 117 121 } 118 122 -
trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
r196513 r196616 2121 2121 case CheckAdd: 2122 2122 opcode = opcodeForType(BranchAdd32, BranchAdd64, m_value->type()); 2123 stackmapRole = StackmapSpecial::ForceLateUseUnlessRecoverable; 2123 2124 commutativity = Commutative; 2124 2125 break; -
trunk/Source/JavaScriptCore/b3/B3PatchpointSpecial.cpp
r194542 r196616 52 52 callback(inst.args[argIndex++], Arg::Def, inst.origin->airType(), inst.origin->airWidth()); 53 53 54 forEachArgImpl(0, argIndex, inst, SameAsRep, callback);54 forEachArgImpl(0, argIndex, inst, SameAsRep, Nullopt, callback); 55 55 argIndex += inst.origin->numChildren(); 56 56 -
trunk/Source/JavaScriptCore/b3/B3StackmapSpecial.cpp
r195139 r196616 74 74 void StackmapSpecial::forEachArgImpl( 75 75 unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, 76 Inst& inst, RoleMode roleMode, const ScopedLambda<Inst::EachArgCallback>& callback) 76 Inst& inst, RoleMode roleMode, Optional<unsigned> firstRecoverableIndex, 77 const ScopedLambda<Inst::EachArgCallback>& callback) 77 78 { 78 79 StackmapValue* value = inst.origin->as<StackmapValue>(); … … 90 91 Arg::Role role; 91 92 switch (roleMode) { 93 case ForceLateUseUnlessRecoverable: 94 ASSERT(firstRecoverableIndex); 95 if (arg != inst.args[*firstRecoverableIndex] && arg != inst.args[*firstRecoverableIndex + 1]) { 96 role = Arg::LateColdUse; 97 break; 98 } 99 FALLTHROUGH; 92 100 case SameAsRep: 93 101 switch (child.rep().kind()) { … … 274 282 out.print("SameAsRep"); 275 283 return; 284 case StackmapSpecial::ForceLateUseUnlessRecoverable: 285 out.print("ForceLateUseUnlessRecoverable"); 286 return; 276 287 case StackmapSpecial::ForceLateUse: 277 288 out.print("ForceLateUse"); -
trunk/Source/JavaScriptCore/b3/B3StackmapSpecial.h
r194542 r196616 48 48 enum RoleMode : int8_t { 49 49 SameAsRep, 50 ForceLateUseUnlessRecoverable, 50 51 ForceLateUse 51 52 }; … … 60 61 void forEachArgImpl( 61 62 unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, 62 Air::Inst&, RoleMode, const ScopedLambda<Air::Inst::EachArgCallback>&); 63 Air::Inst&, RoleMode, Optional<unsigned> firstRecoverableIndex, 64 const ScopedLambda<Air::Inst::EachArgCallback>&); 63 65 64 66 bool isValidImpl( -
trunk/Source/JavaScriptCore/b3/B3StackmapValue.h
r196032 r196616 92 92 appendVectorWithRep(vector, ValueRep::ColdAny); 93 93 } 94 template<typename VectorType> 95 void appendLateColdAnys(const VectorType& vector) 96 { 97 appendVectorWithRep(vector, ValueRep::LateColdAny); 98 } 94 99 95 100 // This is a helper for something you might do a lot of: append a value that should be constrained
Note: See TracChangeset
for help on using the changeset viewer.