Changeset 245270 in webkit
- Timestamp:
- May 13, 2019 7:34:28 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r245258 r245270 1 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Compress JIT related data more by using Packed<> 4 https://bugs.webkit.org/show_bug.cgi?id=197866 5 6 Reviewed by Saam Barati. 7 8 This patch leverages Packed<> more to reduce JIT related data size. When we measure memory usage on Gmail, we found that a lot of memory is 9 consumed in DFG data. This patch attempts to reduce that size by using Packed<> to make various data structure's alignment 1. 10 11 * dfg/DFGCommonData.cpp: 12 (JSC::DFG::CommonData::shrinkToFit): Add more shrinkToFit. 13 * dfg/DFGMinifiedID.h: Make alignment = 1. 14 (JSC::DFG::MinifiedID::operator! const): 15 (JSC::DFG::MinifiedID::operator== const): 16 (JSC::DFG::MinifiedID::operator!= const): 17 (JSC::DFG::MinifiedID::operator< const): 18 (JSC::DFG::MinifiedID::operator> const): 19 (JSC::DFG::MinifiedID::operator<= const): 20 (JSC::DFG::MinifiedID::operator>= const): 21 (JSC::DFG::MinifiedID::hash const): 22 (JSC::DFG::MinifiedID::dump const): 23 (JSC::DFG::MinifiedID::isHashTableDeletedValue const): 24 (JSC::DFG::MinifiedID::bits const): 25 * dfg/DFGMinifiedIDInlines.h: 26 (JSC::DFG::MinifiedID::MinifiedID): 27 * dfg/DFGMinifiedNode.cpp: 28 (JSC::DFG::MinifiedNode::fromNode): Make sizeof(MinifiedNode) from 16 to 13 with alignment = 1. 29 * dfg/DFGMinifiedNode.h: 30 (JSC::DFG::MinifiedNode::id const): 31 (JSC::DFG::MinifiedNode::hasConstant const): 32 (JSC::DFG::MinifiedNode::constant const): 33 (JSC::DFG::MinifiedNode::isPhantomDirectArguments const): 34 (JSC::DFG::MinifiedNode::isPhantomClonedArguments const): 35 (JSC::DFG::MinifiedNode::hasInlineCallFrame const): 36 (JSC::DFG::MinifiedNode::inlineCallFrame const): 37 (JSC::DFG::MinifiedNode::op const): Deleted. 38 (JSC::DFG::MinifiedNode::hasInlineCallFrame): Deleted. 39 * dfg/DFGVariableEvent.h: Make sizeof(VariableEvent) from 12 to 10 with alignment = 1. 40 (JSC::DFG::VariableEvent::fillGPR): 41 (JSC::DFG::VariableEvent::fillPair): 42 (JSC::DFG::VariableEvent::fillFPR): 43 (JSC::DFG::VariableEvent::birth): 44 (JSC::DFG::VariableEvent::spill): 45 (JSC::DFG::VariableEvent::death): 46 (JSC::DFG::VariableEvent::setLocal): 47 (JSC::DFG::VariableEvent::movHint): 48 (JSC::DFG::VariableEvent::id const): 49 (JSC::DFG::VariableEvent::gpr const): 50 (JSC::DFG::VariableEvent::tagGPR const): 51 (JSC::DFG::VariableEvent::payloadGPR const): 52 (JSC::DFG::VariableEvent::fpr const): 53 (JSC::DFG::VariableEvent::spillRegister const): 54 (JSC::DFG::VariableEvent::bytecodeRegister const): 55 (JSC::DFG::VariableEvent::machineRegister const): 56 (JSC::DFG::VariableEvent::variableRepresentation const): 57 * dfg/DFGVariableEventStream.cpp: 58 (JSC::DFG::tryToSetConstantRecovery): 59 1 60 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 61 -
trunk/Source/JavaScriptCore/dfg/DFGCommonData.cpp
r241613 r245270 86 86 { 87 87 codeOrigins.shrinkToFit(); 88 dfgIdentifiers.shrinkToFit(); 88 89 weakReferences.shrinkToFit(); 90 weakStructureReferences.shrinkToFit(); 89 91 transitions.shrinkToFit(); 90 92 catchEntrypoints.shrinkToFit(); 93 jumpReplacements.shrinkToFit(); 91 94 } 92 95 -
trunk/Source/JavaScriptCore/dfg/DFGMinifiedID.h
r244578 r245270 43 43 explicit MinifiedID(Node* node); 44 44 45 bool operator!() const { return m_index == invalidIndex(); }45 bool operator!() const { return m_index.get() == invalidIndex(); } 46 46 47 bool operator==(const MinifiedID& other) const { return m_index == other.m_index; }48 bool operator!=(const MinifiedID& other) const { return m_index != other.m_index; }49 bool operator<(const MinifiedID& other) const { return m_index < other.m_index; }50 bool operator>(const MinifiedID& other) const { return m_index > other.m_index; }51 bool operator<=(const MinifiedID& other) const { return m_index <= other.m_index; }52 bool operator>=(const MinifiedID& other) const { return m_index >= other.m_index; }47 bool operator==(const MinifiedID& other) const { return m_index.get() == other.m_index.get(); } 48 bool operator!=(const MinifiedID& other) const { return m_index.get() != other.m_index.get(); } 49 bool operator<(const MinifiedID& other) const { return m_index.get() < other.m_index.get(); } 50 bool operator>(const MinifiedID& other) const { return m_index.get() > other.m_index.get(); } 51 bool operator<=(const MinifiedID& other) const { return m_index.get() <= other.m_index.get(); } 52 bool operator>=(const MinifiedID& other) const { return m_index.get() >= other.m_index.get(); } 53 53 54 unsigned hash() const { return WTF::IntHash<unsigned>::hash(m_index ); }54 unsigned hash() const { return WTF::IntHash<unsigned>::hash(m_index.get()); } 55 55 56 void dump(PrintStream& out) const { out.print(m_index ); }56 void dump(PrintStream& out) const { out.print(m_index.get()); } 57 57 58 bool isHashTableDeletedValue() const { return m_index == otherInvalidIndex(); }58 bool isHashTableDeletedValue() const { return m_index.get() == otherInvalidIndex(); } 59 59 60 60 static MinifiedID fromBits(unsigned value) … … 65 65 } 66 66 67 unsigned bits() const { return m_index ; }67 unsigned bits() const { return m_index.get(); } 68 68 69 69 private: … … 73 73 static constexpr unsigned otherInvalidIndex() { return static_cast<unsigned>(-2); } 74 74 75 unsignedm_index { invalidIndex() };75 Packed<unsigned> m_index { invalidIndex() }; 76 76 }; 77 77 -
trunk/Source/JavaScriptCore/dfg/DFGMinifiedIDInlines.h
r244578 r245270 36 36 : m_index(node->index()) 37 37 { 38 RELEASE_ASSERT(m_index != invalidIndex() && m_index!= otherInvalidIndex());38 RELEASE_ASSERT(m_index.get() != invalidIndex() && m_index.get() != otherInvalidIndex()); 39 39 } 40 40 -
trunk/Source/JavaScriptCore/dfg/DFGMinifiedNode.cpp
r244578 r245270 40 40 MinifiedNode result; 41 41 result.m_id = MinifiedID(node); 42 result.m_op = node->op(); 42 result.m_hasConstant = hasConstant(node->op()); 43 result.m_isPhantomDirectArguments = node->op() == PhantomDirectArguments; 44 result.m_isPhantomClonedArguments = node->op() == PhantomClonedArguments; 43 45 if (hasConstant(node->op())) 44 46 result.m_info = JSValue::encode(node->asJSValue()); -
trunk/Source/JavaScriptCore/dfg/DFGMinifiedNode.h
r244580 r245270 58 58 59 59 MinifiedID id() const { return m_id; } 60 NodeType op() const { return m_op; }61 60 62 bool hasConstant() const { return hasConstant(m_op); }61 bool hasConstant() const { return m_hasConstant; } 63 62 64 63 JSValue constant() const 65 64 { 66 return JSValue::decode(bitwise_cast<EncodedJSValue>(m_info ));65 return JSValue::decode(bitwise_cast<EncodedJSValue>(m_info.get())); 67 66 } 68 67 69 bool hasInlineCallFrame() const { return hasInlineCallFrame(m_op); } 68 bool isPhantomDirectArguments() const { return m_isPhantomDirectArguments; } 69 bool isPhantomClonedArguments() const { return m_isPhantomClonedArguments; } 70 bool hasInlineCallFrame() const { return m_isPhantomDirectArguments || m_isPhantomClonedArguments; } 70 71 71 72 InlineCallFrame* inlineCallFrame() const 72 73 { 73 return bitwise_cast<InlineCallFrame*>(static_cast<uintptr_t>(m_info ));74 return bitwise_cast<InlineCallFrame*>(static_cast<uintptr_t>(m_info.get())); 74 75 } 75 76 … … 86 87 } 87 88 88 static bool hasInlineCallFrame(NodeType type) 89 { 90 return type == PhantomDirectArguments || type == PhantomClonedArguments; 91 } 92 93 uint64_t m_info; 89 Packed<uint64_t> m_info; 94 90 MinifiedID m_id; 95 NodeType m_op; 91 bool m_hasConstant : 1; 92 bool m_isPhantomDirectArguments : 1; 93 bool m_isPhantomClonedArguments : 1; 96 94 }; 97 95 -
trunk/Source/JavaScriptCore/dfg/DFGVariableEvent.h
r244578 r245270 36 36 namespace JSC { namespace DFG { 37 37 38 enum VariableEventKind {38 enum VariableEventKind : uint8_t { 39 39 // Marks the beginning of a checkpoint. If you interpret the variable 40 40 // events starting at a Reset point then you'll get everything you need. … … 102 102 #endif 103 103 VariableEvent event; 104 event.m_which.id = id.bits(); 105 event.m_representation.gpr = gpr; 104 WhichType which; 105 which.id = id.bits(); 106 VariableRepresentation representation; 107 representation.gpr = gpr; 106 108 event.m_kind = kind; 107 109 event.m_dataFormat = dataFormat; 110 event.m_which = WTFMove(which); 111 event.m_representation = WTFMove(representation); 108 112 return event; 109 113 } … … 114 118 ASSERT(kind == BirthToFill || kind == Fill); 115 119 VariableEvent event; 116 event.m_which.id = id.bits(); 117 event.m_representation.pair.tagGPR = tagGPR; 118 event.m_representation.pair.payloadGPR = payloadGPR; 120 WhichType which; 121 which.id = id.bits(); 122 VariableRepresentation representation; 123 representation.pair.tagGPR = tagGPR; 124 representation.pair.payloadGPR = payloadGPR; 119 125 event.m_kind = kind; 120 126 event.m_dataFormat = DataFormatJS; 127 event.m_which = WTFMove(which); 128 event.m_representation = WTFMove(representation); 121 129 return event; 122 130 } … … 127 135 ASSERT(kind == BirthToFill || kind == Fill); 128 136 VariableEvent event; 129 event.m_which.id = id.bits(); 130 event.m_representation.fpr = fpr; 137 WhichType which; 138 which.id = id.bits(); 139 VariableRepresentation representation; 140 representation.fpr = fpr; 131 141 event.m_kind = kind; 132 142 event.m_dataFormat = DataFormatDouble; 143 event.m_which = WTFMove(which); 144 event.m_representation = WTFMove(representation); 133 145 return event; 134 146 } … … 137 149 { 138 150 VariableEvent event; 139 event.m_which.id = id.bits(); 151 WhichType which; 152 which.id = id.bits(); 140 153 event.m_kind = Birth; 154 event.m_which = WTFMove(which); 141 155 return event; 142 156 } … … 146 160 ASSERT(kind == BirthToSpill || kind == Spill); 147 161 VariableEvent event; 148 event.m_which.id = id.bits(); 149 event.m_representation.virtualReg = virtualRegister.offset(); 162 WhichType which; 163 which.id = id.bits(); 164 VariableRepresentation representation; 165 representation.virtualReg = virtualRegister.offset(); 150 166 event.m_kind = kind; 151 167 event.m_dataFormat = format; 168 event.m_which = WTFMove(which); 169 event.m_representation = WTFMove(representation); 152 170 return event; 153 171 } … … 156 174 { 157 175 VariableEvent event; 158 event.m_which.id = id.bits(); 176 WhichType which; 177 which.id = id.bits(); 159 178 event.m_kind = Death; 179 event.m_which = WTFMove(which); 160 180 return event; 161 181 } … … 165 185 { 166 186 VariableEvent event; 167 event.m_which.virtualReg = machineReg.offset(); 168 event.m_representation.virtualReg = bytecodeReg.offset(); 187 WhichType which; 188 which.virtualReg = machineReg.offset(); 189 VariableRepresentation representation; 190 representation.virtualReg = bytecodeReg.offset(); 169 191 event.m_kind = SetLocalEvent; 170 192 event.m_dataFormat = format; 193 event.m_which = WTFMove(which); 194 event.m_representation = WTFMove(representation); 171 195 return event; 172 196 } … … 175 199 { 176 200 VariableEvent event; 177 event.m_which.id = id.bits(); 178 event.m_representation.virtualReg = bytecodeReg.offset(); 201 WhichType which; 202 which.id = id.bits(); 203 VariableRepresentation representation; 204 representation.virtualReg = bytecodeReg.offset(); 179 205 event.m_kind = MovHintEvent; 206 event.m_which = WTFMove(which); 207 event.m_representation = WTFMove(representation); 180 208 return event; 181 209 } … … 191 219 m_kind == BirthToFill || m_kind == Fill || m_kind == BirthToSpill || m_kind == Spill 192 220 || m_kind == Death || m_kind == MovHintEvent || m_kind == Birth); 193 return MinifiedID::fromBits(m_which. id);221 return MinifiedID::fromBits(m_which.get().id); 194 222 } 195 223 … … 210 238 ASSERT(!(m_dataFormat & DataFormatJS)); 211 239 #endif 212 return m_representation.g pr;240 return m_representation.get().gpr; 213 241 } 214 242 … … 218 246 ASSERT(m_kind == BirthToFill || m_kind == Fill); 219 247 ASSERT(m_dataFormat & DataFormatJS); 220 return m_representation. pair.tagGPR;248 return m_representation.get().pair.tagGPR; 221 249 } 222 250 MacroAssembler::RegisterID payloadGPR() const … … 224 252 ASSERT(m_kind == BirthToFill || m_kind == Fill); 225 253 ASSERT(m_dataFormat & DataFormatJS); 226 return m_representation. pair.payloadGPR;254 return m_representation.get().pair.payloadGPR; 227 255 } 228 256 #endif // USE(JSVALUE32_64) … … 232 260 ASSERT(m_kind == BirthToFill || m_kind == Fill); 233 261 ASSERT(m_dataFormat == DataFormatDouble); 234 return m_representation. fpr;262 return m_representation.get().fpr; 235 263 } 236 264 … … 238 266 { 239 267 ASSERT(m_kind == BirthToSpill || m_kind == Spill); 240 return VirtualRegister(m_representation. virtualReg);268 return VirtualRegister(m_representation.get().virtualReg); 241 269 } 242 270 … … 244 272 { 245 273 ASSERT(m_kind == SetLocalEvent || m_kind == MovHintEvent); 246 return VirtualRegister(m_representation. virtualReg);274 return VirtualRegister(m_representation.get().virtualReg); 247 275 } 248 276 … … 250 278 { 251 279 ASSERT(m_kind == SetLocalEvent); 252 return VirtualRegister(m_which. virtualReg);253 } 254 255 const VariableRepresentation& variableRepresentation() const { return m_representation; }280 return VirtualRegister(m_which.get().virtualReg); 281 } 282 283 VariableRepresentation variableRepresentation() const { return m_representation.get(); } 256 284 257 285 void dump(PrintStream&) const; … … 261 289 void dumpSpillInfo(const char* name, PrintStream&) const; 262 290 263 union {291 union WhichType { 264 292 int virtualReg; 265 293 unsigned id; 266 } m_which; 294 }; 295 Packed<WhichType> m_which; 267 296 268 297 // For BirthToFill, Fill: … … 274 303 // For Death: 275 304 // - Unused. 276 VariableRepresentationm_representation;277 278 int8_tm_kind;305 Packed<VariableRepresentation> m_representation; 306 307 VariableEventKind m_kind; 279 308 DataFormat m_dataFormat { DataFormatNone }; 280 309 }; -
trunk/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp
r244764 r245270 102 102 } 103 103 104 if (node-> op() == PhantomDirectArguments) {104 if (node->isPhantomDirectArguments()) { 105 105 recovery = ValueRecovery::directArgumentsThatWereNotCreated(node->id()); 106 106 return true; 107 107 } 108 108 109 if (node-> op() == PhantomClonedArguments) {109 if (node->isPhantomClonedArguments()) { 110 110 recovery = ValueRecovery::clonedArgumentsThatWereNotCreated(node->id()); 111 111 return true;
Note: See TracChangeset
for help on using the changeset viewer.