Changeset 245239 in webkit
- Timestamp:
- May 13, 2019 10:32:31 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r245214 r245239 1 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Compress miscelaneous JIT related data structures with Packed<> 4 https://bugs.webkit.org/show_bug.cgi?id=197830 5 6 Reviewed by Saam Barati. 7 8 This patch leverages Packed<> to compress miscelaneous data structures related to JIT. 9 10 1. JIT IC data structures 11 12 2. ValueRecovery 13 14 We use Packed<> for EncodedJSValue in ValueRecovery. This means that conservative GC cannot find 15 these values. But this is OK anyway since ValueRecovery's constant should be already registered 16 in DFG graph. From 16 (alignment 8) to 9 (alignment 1). 17 18 3. FTL::ExitValue 19 20 We use Packed<> for EncodedJSValue in FTL::ExitValue. This is also OK since this constant should 21 be already registered by DFG/FTL graph. From 16 (alignment 8) to 9 (alignment 1). 22 23 * assembler/CodeLocation.h: 24 * bytecode/ByValInfo.h: 25 * bytecode/CallLinkInfo.cpp: 26 (JSC::CallLinkInfo::CallLinkInfo): 27 (JSC::CallLinkInfo::callReturnLocation): 28 * bytecode/CallLinkInfo.h: 29 (JSC::CallLinkInfo::nearCallMode const): 30 * bytecode/CodeBlock.cpp: 31 (JSC::CodeBlock::addJITAddIC): 32 (JSC::CodeBlock::addJITMulIC): 33 (JSC::CodeBlock::addJITSubIC): 34 (JSC::CodeBlock::addJITNegIC): 35 * bytecode/CodeBlock.h: 36 (JSC::CodeBlock::addMathIC): 37 * bytecode/InlineCallFrame.h: 38 (JSC::InlineCallFrame::InlineCallFrame): 39 * bytecode/ValueRecovery.h: 40 (JSC::ValueRecovery::inGPR): 41 (JSC::ValueRecovery::inPair): 42 (JSC::ValueRecovery::inFPR): 43 (JSC::ValueRecovery::displacedInJSStack): 44 (JSC::ValueRecovery::constant): 45 (JSC::ValueRecovery::directArgumentsThatWereNotCreated): 46 (JSC::ValueRecovery::clonedArgumentsThatWereNotCreated): 47 (JSC::ValueRecovery::gpr const): 48 (JSC::ValueRecovery::tagGPR const): 49 (JSC::ValueRecovery::payloadGPR const): 50 (JSC::ValueRecovery::fpr const): 51 (JSC::ValueRecovery::virtualRegister const): 52 (JSC::ValueRecovery::withLocalsOffset const): 53 (JSC::ValueRecovery::constant const): 54 (JSC::ValueRecovery::nodeID const): 55 * dfg/DFGSpeculativeJIT.cpp: 56 (JSC::DFG::SpeculativeJIT::compileValueAdd): 57 (JSC::DFG::SpeculativeJIT::compileValueSub): 58 (JSC::DFG::SpeculativeJIT::compileValueNegate): 59 (JSC::DFG::SpeculativeJIT::compileValueMul): 60 * ftl/FTLExitValue.cpp: 61 (JSC::FTL::ExitValue::materializeNewObject): 62 * ftl/FTLExitValue.h: 63 (JSC::FTL::ExitValue::inJSStack): 64 (JSC::FTL::ExitValue::inJSStackAsInt32): 65 (JSC::FTL::ExitValue::inJSStackAsInt52): 66 (JSC::FTL::ExitValue::inJSStackAsDouble): 67 (JSC::FTL::ExitValue::constant): 68 (JSC::FTL::ExitValue::exitArgument): 69 (JSC::FTL::ExitValue::exitArgument const): 70 (JSC::FTL::ExitValue::adjustStackmapLocationsIndexByOffset): 71 (JSC::FTL::ExitValue::constant const): 72 (JSC::FTL::ExitValue::virtualRegister const): 73 (JSC::FTL::ExitValue::objectMaterialization const): 74 (JSC::FTL::ExitValue::withVirtualRegister const): 75 * ftl/FTLLowerDFGToB3.cpp: 76 (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd): 77 (JSC::FTL::DFG::LowerDFGToB3::compileValueSub): 78 (JSC::FTL::DFG::LowerDFGToB3::compileValueMul): 79 (JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC): 80 (JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC): 81 (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub): 82 (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate): 83 * jit/CachedRecovery.h: 84 * jit/CallFrameShuffleData.h: 85 * jit/JITArithmetic.cpp: 86 (JSC::JIT::emit_op_negate): 87 (JSC::JIT::emit_op_add): 88 (JSC::JIT::emit_op_mul): 89 (JSC::JIT::emit_op_sub): 90 * jit/JITMathIC.h: 91 (JSC::isProfileEmpty): 92 (JSC::JITBinaryMathIC::JITBinaryMathIC): 93 (JSC::JITUnaryMathIC::JITUnaryMathIC): 94 * jit/PolymorphicCallStubRoutine.h: 95 (JSC::PolymorphicCallNode::hasCallLinkInfo): 96 * jit/SnippetOperand.h: 97 (JSC::SnippetOperand::asRawBits const): 98 (JSC::SnippetOperand::asConstInt32 const): 99 (JSC::SnippetOperand::asConstDouble const): 100 (JSC::SnippetOperand::setConstInt32): 101 (JSC::SnippetOperand::setConstDouble): 102 1 103 2019-05-12 Yusuke Suzuki <ysuzuki@apple.com> 2 104 -
trunk/Source/JavaScriptCore/assembler/CodeLocation.h
r233070 r245239 32 32 namespace JSC { 33 33 34 enum NearCallMode{ Regular, Tail };34 enum class NearCallMode : uint8_t { Regular, Tail }; 35 35 36 36 template<PtrTag> class CodeLocationInstruction; … … 154 154 NearCallMode callMode() { return m_callMode; } 155 155 private: 156 NearCallMode m_callMode = NearCallMode::Regular;156 NearCallMode m_callMode { NearCallMode::Regular }; 157 157 }; 158 158 -
trunk/Source/JavaScriptCore/bytecode/ByValInfo.h
r243232 r245239 40 40 class StructureStubInfo; 41 41 42 enum JITArrayMode {42 enum JITArrayMode : uint8_t { 43 43 JITInt32, 44 44 JITDouble, -
trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp
r243966 r245239 64 64 , m_callType(None) 65 65 , m_calleeGPR(255) 66 , m_maxNumArguments(0)67 , m_slowPathCount(0)68 66 { 69 67 } … … 101 99 { 102 100 RELEASE_ASSERT(!isDirect()); 103 return CodeLocationNearCall<JSInternalPtrTag>(m_callReturnLocationOrPatchableJump, Regular);101 return CodeLocationNearCall<JSInternalPtrTag>(m_callReturnLocationOrPatchableJump, NearCallMode::Regular); 104 102 } 105 103 -
trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h
r243626 r245239 42 42 struct CallFrameShuffleData; 43 43 44 class CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {44 class CallLinkInfo : public PackedRawSentinelNode<CallLinkInfo> { 45 45 public: 46 46 enum CallType { … … 147 147 NearCallMode nearCallMode() const 148 148 { 149 return isTailCall() ? Tail :Regular;149 return isTailCall() ? NearCallMode::Tail : NearCallMode::Regular; 150 150 } 151 151 … … 348 348 349 349 private: 350 uint32_t m_maxNumArguments { 0 }; // For varargs: the profiled maximum number of arguments. For direct: the number of stack slots allocated for arguments. 350 351 CodeLocationLabel<JSInternalPtrTag> m_callReturnLocationOrPatchableJump; 351 352 CodeLocationLabel<JSInternalPtrTag> m_hotPathBeginOrSlowPathStart; … … 356 357 RefPtr<JITStubRoutine> m_slowStub; 357 358 std::unique_ptr<CallFrameShuffleData> m_frameShuffleData; 359 CodeOrigin m_codeOrigin; 358 360 bool m_hasSeenShouldRepatch : 1; 359 361 bool m_hasSeenClosure : 1; … … 364 366 unsigned m_callType : 4; // CallType 365 367 unsigned m_calleeGPR : 8; 366 uint32_t m_maxNumArguments; // For varargs: the profiled maximum number of arguments. For direct: the number of stack slots allocated for arguments. 367 uint32_t m_slowPathCount; 368 CodeOrigin m_codeOrigin; 368 uint32_t m_slowPathCount { 0 }; 369 369 }; 370 370 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r245213 r245239 1428 1428 } 1429 1429 1430 JITAddIC* CodeBlock::addJITAddIC(ArithProfile* arithProfile , const Instruction* instruction)1430 JITAddIC* CodeBlock::addJITAddIC(ArithProfile* arithProfile) 1431 1431 { 1432 1432 ConcurrentJSLocker locker(m_lock); 1433 return ensureJITData(locker).m_addICs.add(arithProfile , instruction);1434 } 1435 1436 JITMulIC* CodeBlock::addJITMulIC(ArithProfile* arithProfile , const Instruction* instruction)1433 return ensureJITData(locker).m_addICs.add(arithProfile); 1434 } 1435 1436 JITMulIC* CodeBlock::addJITMulIC(ArithProfile* arithProfile) 1437 1437 { 1438 1438 ConcurrentJSLocker locker(m_lock); 1439 return ensureJITData(locker).m_mulICs.add(arithProfile , instruction);1440 } 1441 1442 JITSubIC* CodeBlock::addJITSubIC(ArithProfile* arithProfile , const Instruction* instruction)1439 return ensureJITData(locker).m_mulICs.add(arithProfile); 1440 } 1441 1442 JITSubIC* CodeBlock::addJITSubIC(ArithProfile* arithProfile) 1443 1443 { 1444 1444 ConcurrentJSLocker locker(m_lock); 1445 return ensureJITData(locker).m_subICs.add(arithProfile , instruction);1446 } 1447 1448 JITNegIC* CodeBlock::addJITNegIC(ArithProfile* arithProfile , const Instruction* instruction)1445 return ensureJITData(locker).m_subICs.add(arithProfile); 1446 } 1447 1448 JITNegIC* CodeBlock::addJITNegIC(ArithProfile* arithProfile) 1449 1449 { 1450 1450 ConcurrentJSLocker locker(m_lock); 1451 return ensureJITData(locker).m_negICs.add(arithProfile , instruction);1451 return ensureJITData(locker).m_negICs.add(arithProfile); 1452 1452 } 1453 1453 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r245050 r245239 262 262 Bag<ByValInfo> m_byValInfos; 263 263 Bag<CallLinkInfo> m_callLinkInfos; 264 SentinelLinkedList<CallLinkInfo, BasicRawSentinelNode<CallLinkInfo>> m_incomingCalls;265 SentinelLinkedList<PolymorphicCallNode, BasicRawSentinelNode<PolymorphicCallNode>> m_incomingPolymorphicCalls;264 SentinelLinkedList<CallLinkInfo, PackedRawSentinelNode<CallLinkInfo>> m_incomingCalls; 265 SentinelLinkedList<PolymorphicCallNode, PackedRawSentinelNode<PolymorphicCallNode>> m_incomingPolymorphicCalls; 266 266 SegmentedVector<RareCaseProfile, 8> m_rareCaseProfiles; 267 267 std::unique_ptr<PCToCodeOriginMap> m_pcToCodeOriginMap; … … 278 278 JITData& ensureJITDataSlow(const ConcurrentJSLocker&); 279 279 280 JITAddIC* addJITAddIC(ArithProfile* , const Instruction*);281 JITMulIC* addJITMulIC(ArithProfile* , const Instruction*);282 JITNegIC* addJITNegIC(ArithProfile* , const Instruction*);283 JITSubIC* addJITSubIC(ArithProfile* , const Instruction*);280 JITAddIC* addJITAddIC(ArithProfile*); 281 JITMulIC* addJITMulIC(ArithProfile*); 282 JITNegIC* addJITNegIC(ArithProfile*); 283 JITSubIC* addJITSubIC(ArithProfile*); 284 284 285 285 template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITAddGenerator>::value>::type> 286 JITAddIC* addMathIC(ArithProfile* profile , const Instruction* instruction) { return addJITAddIC(profile, instruction); }286 JITAddIC* addMathIC(ArithProfile* profile) { return addJITAddIC(profile); } 287 287 288 288 template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITMulGenerator>::value>::type> 289 JITMulIC* addMathIC(ArithProfile* profile , const Instruction* instruction) { return addJITMulIC(profile, instruction); }289 JITMulIC* addMathIC(ArithProfile* profile) { return addJITMulIC(profile); } 290 290 291 291 template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITNegGenerator>::value>::type> 292 JITNegIC* addMathIC(ArithProfile* profile , const Instruction* instruction) { return addJITNegIC(profile, instruction); }292 JITNegIC* addMathIC(ArithProfile* profile) { return addJITNegIC(profile); } 293 293 294 294 template <typename Generator, typename = typename std::enable_if<std::is_same<Generator, JITSubGenerator>::value>::type> 295 JITSubIC* addMathIC(ArithProfile* profile , const Instruction* instruction) { return addJITSubIC(profile, instruction); }295 JITSubIC* addMathIC(ArithProfile* profile) { return addJITSubIC(profile); } 296 296 297 297 StructureStubInfo* addStubInfo(AccessType); -
trunk/Source/JavaScriptCore/bytecode/InlineCallFrame.h
r244764 r245239 178 178 Vector<ValueRecovery> argumentsWithFixup; // Includes 'this' and arity fixups. 179 179 WriteBarrier<CodeBlock> baselineCodeBlock; 180 ValueRecovery calleeRecovery;181 180 CodeOrigin directCaller; 182 181 183 unsigned argumentCountIncludingThis ; // Do not include fixups.182 unsigned argumentCountIncludingThis { 0 }; // Do not include fixups. 184 183 signed stackOffset : 28; 185 184 unsigned kind : 3; // real type is Kind 186 185 bool isClosureCall : 1; // If false then we know that callee/scope are constants and the DFG won't treat them as variables, i.e. they have to be recovered manually. 187 186 VirtualRegister argumentCountRegister; // Only set when we inline a varargs call. 187 188 ValueRecovery calleeRecovery; 188 189 189 190 // There is really no good notion of a "default" set of values for … … 191 192 // we forgot to initialize explicitly. 192 193 InlineCallFrame() 193 : argumentCountIncludingThis(0) 194 , stackOffset(0) 194 : stackOffset(0) 195 195 , kind(Call) 196 196 , isClosureCall(false) -
trunk/Source/JavaScriptCore/bytecode/ValueRecovery.h
r244578 r245239 44 44 // Describes how to recover a given bytecode virtual register at a given 45 45 // code point. 46 enum ValueRecoveryTechnique {46 enum ValueRecoveryTechnique : uint8_t { 47 47 // It's in a register. 48 48 InGPR, … … 117 117 else 118 118 result.m_technique = InGPR; 119 result.m_source.gpr = gpr; 119 UnionType u; 120 u.gpr = gpr; 121 result.m_source = WTFMove(u); 120 122 return result; 121 123 } … … 126 128 ValueRecovery result; 127 129 result.m_technique = InPair; 128 result.m_source.pair.tagGPR = tagGPR; 129 result.m_source.pair.payloadGPR = payloadGPR; 130 UnionType u; 131 u.pair.tagGPR = tagGPR; 132 u.pair.payloadGPR = payloadGPR; 133 result.m_source = WTFMove(u); 130 134 return result; 131 135 } … … 140 144 else 141 145 result.m_technique = InFPR; 142 result.m_source.fpr = fpr; 146 UnionType u; 147 u.fpr = fpr; 148 result.m_source = WTFMove(u); 143 149 return result; 144 150 } … … 177 183 break; 178 184 } 179 result.m_source.virtualReg = virtualReg.offset(); 185 UnionType u; 186 u.virtualReg = virtualReg.offset(); 187 result.m_source = WTFMove(u); 180 188 return result; 181 189 } … … 185 193 ValueRecovery result; 186 194 result.m_technique = Constant; 187 result.m_source.constant = JSValue::encode(value); 195 UnionType u; 196 u.constant = JSValue::encode(value); 197 result.m_source = WTFMove(u); 188 198 return result; 189 199 } … … 193 203 ValueRecovery result; 194 204 result.m_technique = DirectArgumentsThatWereNotCreated; 195 result.m_source.nodeID = id.bits(); 205 UnionType u; 206 u.nodeID = id.bits(); 207 result.m_source = WTFMove(u); 196 208 return result; 197 209 } … … 201 213 ValueRecovery result; 202 214 result.m_technique = ClonedArgumentsThatWereNotCreated; 203 result.m_source.nodeID = id.bits(); 215 UnionType u; 216 u.nodeID = id.bits(); 217 result.m_source = WTFMove(u); 204 218 return result; 205 219 } … … 293 307 { 294 308 ASSERT(isInGPR()); 295 return m_source.g pr;309 return m_source.get().gpr; 296 310 } 297 311 … … 300 314 { 301 315 ASSERT(m_technique == InPair); 302 return m_source. pair.tagGPR;316 return m_source.get().pair.tagGPR; 303 317 } 304 318 … … 306 320 { 307 321 ASSERT(m_technique == InPair); 308 return m_source. pair.payloadGPR;322 return m_source.get().pair.payloadGPR; 309 323 } 310 324 … … 331 345 { 332 346 ASSERT(isInFPR()); 333 return m_source. fpr;347 return m_source.get().fpr; 334 348 } 335 349 … … 337 351 { 338 352 ASSERT(isInJSStack()); 339 return VirtualRegister(m_source. virtualReg);353 return VirtualRegister(m_source.get().virtualReg); 340 354 } 341 355 … … 352 366 ValueRecovery result; 353 367 result.m_technique = m_technique; 354 result.m_source.virtualReg = m_source.virtualReg + offset; 368 UnionType u; 369 u.virtualReg = m_source.get().virtualReg + offset; 370 result.m_source = WTFMove(u); 355 371 return result; 356 372 } … … 364 380 { 365 381 ASSERT(isConstant()); 366 return JSValue::decode(m_source. constant);382 return JSValue::decode(m_source.get().constant); 367 383 } 368 384 … … 370 386 { 371 387 ASSERT(m_technique == DirectArgumentsThatWereNotCreated || m_technique == ClonedArgumentsThatWereNotCreated); 372 return DFG::MinifiedID::fromBits(m_source. nodeID);388 return DFG::MinifiedID::fromBits(m_source.get().nodeID); 373 389 } 374 390 … … 409 425 private: 410 426 ValueRecoveryTechnique m_technique; 411 union {427 union UnionType { 412 428 MacroAssembler::RegisterID gpr; 413 429 MacroAssembler::FPRegisterID fpr; … … 421 437 EncodedJSValue constant; 422 438 unsigned nodeID; 423 } m_source; 439 }; 440 Packed<UnionType> m_source; 424 441 }; 442 static_assert(alignof(ValueRecovery) == 1); 425 443 426 444 } // namespace JSC -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r245064 r245239 3954 3954 unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex(); 3955 3955 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 3956 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr(); 3957 JITAddIC* addIC = m_jit.codeBlock()->addJITAddIC(arithProfile, instruction); 3956 JITAddIC* addIC = m_jit.codeBlock()->addJITAddIC(arithProfile); 3958 3957 auto repatchingFunction = operationValueAddOptimize; 3959 3958 auto nonRepatchingFunction = operationValueAdd; … … 3979 3978 unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex(); 3980 3979 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 3981 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr(); 3982 JITSubIC* subIC = m_jit.codeBlock()->addJITSubIC(arithProfile, instruction); 3980 JITSubIC* subIC = m_jit.codeBlock()->addJITSubIC(arithProfile); 3983 3981 auto repatchingFunction = operationValueSubOptimize; 3984 3982 auto nonRepatchingFunction = operationValueSub; … … 4574 4572 unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex(); 4575 4573 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 4576 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr(); 4577 JITNegIC* negIC = m_jit.codeBlock()->addJITNegIC(arithProfile, instruction); 4574 JITNegIC* negIC = m_jit.codeBlock()->addJITNegIC(arithProfile); 4578 4575 auto repatchingFunction = operationArithNegateOptimize; 4579 4576 auto nonRepatchingFunction = operationArithNegate; … … 4798 4795 unsigned bytecodeIndex = node->origin.semantic.bytecodeIndex(); 4799 4796 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 4800 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr(); 4801 JITMulIC* mulIC = m_jit.codeBlock()->addJITMulIC(arithProfile, instruction); 4797 JITMulIC* mulIC = m_jit.codeBlock()->addJITMulIC(arithProfile); 4802 4798 auto repatchingFunction = operationValueMulOptimize; 4803 4799 auto nonRepatchingFunction = operationValueMul; -
trunk/Source/JavaScriptCore/ftl/FTLExitValue.cpp
r243959 r245239 39 39 ExitValue result; 40 40 result.m_kind = ExitValueMaterializeNewObject; 41 result.u.newObjectMaterializationData = data; 41 UnionType u; 42 u.newObjectMaterializationData = data; 43 result.m_value = WTFMove(u); 42 44 return result; 43 45 } -
trunk/Source/JavaScriptCore/ftl/FTLExitValue.h
r243959 r245239 46 46 // the call. 47 47 48 enum ExitValueKind {48 enum ExitValueKind : uint8_t { 49 49 InvalidExitValue, 50 50 ExitValueDead, … … 80 80 ExitValue result; 81 81 result.m_kind = ExitValueInJSStack; 82 result.u.virtualRegister = reg.offset(); 82 UnionType u; 83 u.virtualRegister = reg.offset(); 84 result.m_value = WTFMove(u); 83 85 return result; 84 86 } … … 88 90 ExitValue result; 89 91 result.m_kind = ExitValueInJSStackAsInt32; 90 result.u.virtualRegister = reg.offset(); 92 UnionType u; 93 u.virtualRegister = reg.offset(); 94 result.m_value = WTFMove(u); 91 95 return result; 92 96 } … … 96 100 ExitValue result; 97 101 result.m_kind = ExitValueInJSStackAsInt52; 98 result.u.virtualRegister = reg.offset(); 102 UnionType u; 103 u.virtualRegister = reg.offset(); 104 result.m_value = WTFMove(u); 99 105 return result; 100 106 } … … 104 110 ExitValue result; 105 111 result.m_kind = ExitValueInJSStackAsDouble; 106 result.u.virtualRegister = reg.offset(); 112 UnionType u; 113 u.virtualRegister = reg.offset(); 114 result.m_value = WTFMove(u); 107 115 return result; 108 116 } … … 112 120 ExitValue result; 113 121 result.m_kind = ExitValueConstant; 114 result.u.constant = JSValue::encode(value); 122 UnionType u; 123 u.constant = JSValue::encode(value); 124 result.m_value = WTFMove(u); 115 125 return result; 116 126 } … … 120 130 ExitValue result; 121 131 result.m_kind = ExitValueArgument; 122 result.u.argument = argument.representation(); 132 UnionType u; 133 u.argument = argument.representation(); 134 result.m_value = WTFMove(u); 123 135 return result; 124 136 } … … 149 161 { 150 162 ASSERT(isArgument()); 151 return ExitArgument( u.argument);163 return ExitArgument(m_value.get().argument); 152 164 } 153 165 … … 156 168 ASSERT(hasIndexInStackmapLocations()); 157 169 ASSERT(isArgument()); 170 UnionType u = m_value.get(); 158 171 u.argument.argument += offset; 172 m_value = WTFMove(u); 159 173 } 160 174 … … 162 176 { 163 177 ASSERT(isConstant()); 164 return JSValue::decode( u.constant);178 return JSValue::decode(m_value.get().constant); 165 179 } 166 180 … … 168 182 { 169 183 ASSERT(isInJSStackSomehow()); 170 return VirtualRegister( u.virtualRegister);184 return VirtualRegister(m_value.get().virtualRegister); 171 185 } 172 186 … … 174 188 { 175 189 ASSERT(isObjectMaterialization()); 176 return u.newObjectMaterializationData;190 return m_value.get().newObjectMaterializationData; 177 191 } 178 192 … … 182 196 ExitValue result; 183 197 result.m_kind = m_kind; 184 result.u.virtualRegister = virtualRegister.offset(); 198 UnionType u; 199 u.virtualRegister = virtualRegister.offset(); 200 result.m_value = WTFMove(u); 185 201 return result; 186 202 } … … 201 217 private: 202 218 ExitValueKind m_kind; 203 union {219 union UnionType { 204 220 ExitArgumentRepresentation argument; 205 221 EncodedJSValue constant; 206 222 int virtualRegister; 207 223 ExitTimeObjectMaterialization* newObjectMaterializationData; 208 } u; 224 }; 225 Packed<UnionType> m_value; 209 226 }; 210 227 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r245168 r245239 2071 2071 unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex(); 2072 2072 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 2073 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr();2074 2073 auto repatchingFunction = operationValueAddOptimize; 2075 2074 auto nonRepatchingFunction = operationValueAdd; 2076 compileBinaryMathIC<JITAddGenerator>(arithProfile, instruction,repatchingFunction, nonRepatchingFunction);2075 compileBinaryMathIC<JITAddGenerator>(arithProfile, repatchingFunction, nonRepatchingFunction); 2077 2076 } 2078 2077 … … 2091 2090 unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex(); 2092 2091 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 2093 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr();2094 2092 auto repatchingFunction = operationValueSubOptimize; 2095 2093 auto nonRepatchingFunction = operationValueSub; 2096 compileBinaryMathIC<JITSubGenerator>(arithProfile, instruction,repatchingFunction, nonRepatchingFunction);2094 compileBinaryMathIC<JITSubGenerator>(arithProfile, repatchingFunction, nonRepatchingFunction); 2097 2095 } 2098 2096 … … 2111 2109 unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex(); 2112 2110 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 2113 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr();2114 2111 auto repatchingFunction = operationValueMulOptimize; 2115 2112 auto nonRepatchingFunction = operationValueMul; 2116 compileBinaryMathIC<JITMulGenerator>(arithProfile, instruction,repatchingFunction, nonRepatchingFunction);2113 compileBinaryMathIC<JITMulGenerator>(arithProfile, repatchingFunction, nonRepatchingFunction); 2117 2114 } 2118 2115 2119 2116 template <typename Generator, typename Func1, typename Func2, 2120 2117 typename = std::enable_if_t<std::is_function<typename std::remove_pointer<Func1>::type>::value && std::is_function<typename std::remove_pointer<Func2>::type>::value>> 2121 void compileUnaryMathIC(ArithProfile* arithProfile, const Instruction* instruction,Func1 repatchingFunction, Func2 nonRepatchingFunction)2118 void compileUnaryMathIC(ArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction) 2122 2119 { 2123 2120 Node* node = m_node; … … 2145 2142 2146 2143 Box<MathICGenerationState> mathICGenerationState = Box<MathICGenerationState>::create(); 2147 JITUnaryMathIC<Generator>* mathIC = jit.codeBlock()->addMathIC<Generator>(arithProfile , instruction);2144 JITUnaryMathIC<Generator>* mathIC = jit.codeBlock()->addMathIC<Generator>(arithProfile); 2148 2145 mathIC->m_generator = Generator(JSValueRegs(params[0].gpr()), JSValueRegs(params[1].gpr()), params.gpScratch(0)); 2149 2146 … … 2205 2202 template <typename Generator, typename Func1, typename Func2, 2206 2203 typename = std::enable_if_t<std::is_function<typename std::remove_pointer<Func1>::type>::value && std::is_function<typename std::remove_pointer<Func2>::type>::value>> 2207 void compileBinaryMathIC(ArithProfile* arithProfile, const Instruction* instruction,Func1 repatchingFunction, Func2 nonRepatchingFunction)2204 void compileBinaryMathIC(ArithProfile* arithProfile, Func1 repatchingFunction, Func2 nonRepatchingFunction) 2208 2205 { 2209 2206 Node* node = m_node; … … 2239 2236 2240 2237 Box<MathICGenerationState> mathICGenerationState = Box<MathICGenerationState>::create(); 2241 JITBinaryMathIC<Generator>* mathIC = jit.codeBlock()->addMathIC<Generator>(arithProfile , instruction);2238 JITBinaryMathIC<Generator>* mathIC = jit.codeBlock()->addMathIC<Generator>(arithProfile); 2242 2239 mathIC->m_generator = Generator(leftOperand, rightOperand, JSValueRegs(params[0].gpr()), 2243 2240 JSValueRegs(params[1].gpr()), JSValueRegs(params[2].gpr()), params.fpScratch(0), … … 2373 2370 unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex(); 2374 2371 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 2375 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr();2376 2372 auto repatchingFunction = operationValueSubOptimize; 2377 2373 auto nonRepatchingFunction = operationValueSub; 2378 compileBinaryMathIC<JITSubGenerator>(arithProfile, instruction,repatchingFunction, nonRepatchingFunction);2374 compileBinaryMathIC<JITSubGenerator>(arithProfile, repatchingFunction, nonRepatchingFunction); 2379 2375 break; 2380 2376 } … … 3024 3020 unsigned bytecodeIndex = m_node->origin.semantic.bytecodeIndex(); 3025 3021 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(bytecodeIndex); 3026 const Instruction* instruction = baselineCodeBlock->instructions().at(bytecodeIndex).ptr();3027 3022 auto repatchingFunction = operationArithNegateOptimize; 3028 3023 auto nonRepatchingFunction = operationArithNegate; 3029 compileUnaryMathIC<JITNegGenerator>(arithProfile, instruction,repatchingFunction, nonRepatchingFunction);3024 compileUnaryMathIC<JITNegGenerator>(arithProfile, repatchingFunction, nonRepatchingFunction); 3030 3025 } 3031 3026 -
trunk/Source/JavaScriptCore/jit/CachedRecovery.h
r209764 r245239 124 124 FPRReg wantedFPR() const { return m_wantedFPR; } 125 125 private: 126 Vector<VirtualRegister, 1> m_targets; 126 127 ValueRecovery m_recovery; 127 128 JSValueRegs m_wantedJSValueRegs; 128 129 FPRReg m_wantedFPR { InvalidFPRReg }; 129 Vector<VirtualRegister, 1> m_targets;130 130 }; 131 131 -
trunk/Source/JavaScriptCore/jit/CallFrameShuffleData.h
r242812 r245239 36 36 WTF_MAKE_FAST_ALLOCATED; 37 37 public: 38 ValueRecovery callee;39 38 Vector<ValueRecovery> args; 40 39 unsigned numLocals { UINT_MAX }; … … 46 45 void setupCalleeSaveRegisters(CodeBlock*); 47 46 #endif 47 ValueRecovery callee; 48 48 }; 49 49 -
trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp
r241849 r245239 454 454 { 455 455 ArithProfile* arithProfile = ¤tInstruction->as<OpNegate>().metadata(m_codeBlock).m_arithProfile; 456 JITNegIC* negateIC = m_codeBlock->addJITNegIC(arithProfile , currentInstruction);456 JITNegIC* negateIC = m_codeBlock->addJITNegIC(arithProfile); 457 457 m_instructionToMathIC.add(currentInstruction, negateIC); 458 458 emitMathICFast<OpNegate>(negateIC, currentInstruction, operationArithNegateProfiled, operationArithNegate); … … 642 642 { 643 643 ArithProfile* arithProfile = ¤tInstruction->as<OpAdd>().metadata(m_codeBlock).m_arithProfile; 644 JITAddIC* addIC = m_codeBlock->addJITAddIC(arithProfile , currentInstruction);644 JITAddIC* addIC = m_codeBlock->addJITAddIC(arithProfile); 645 645 m_instructionToMathIC.add(currentInstruction, addIC); 646 646 emitMathICFast<OpAdd>(addIC, currentInstruction, operationValueAddProfiled, operationValueAdd); … … 961 961 { 962 962 ArithProfile* arithProfile = ¤tInstruction->as<OpMul>().metadata(m_codeBlock).m_arithProfile; 963 JITMulIC* mulIC = m_codeBlock->addJITMulIC(arithProfile , currentInstruction);963 JITMulIC* mulIC = m_codeBlock->addJITMulIC(arithProfile); 964 964 m_instructionToMathIC.add(currentInstruction, mulIC); 965 965 emitMathICFast<OpMul>(mulIC, currentInstruction, operationValueMulProfiled, operationValueMul); … … 977 977 { 978 978 ArithProfile* arithProfile = ¤tInstruction->as<OpSub>().metadata(m_codeBlock).m_arithProfile; 979 JITSubIC* subIC = m_codeBlock->addJITSubIC(arithProfile , currentInstruction);979 JITSubIC* subIC = m_codeBlock->addJITSubIC(arithProfile); 980 980 m_instructionToMathIC.add(currentInstruction, subIC); 981 981 emitMathICFast<OpSub>(subIC, currentInstruction, operationValueSubProfiled, operationValueSub); -
trunk/Source/JavaScriptCore/jit/JITMathIC.h
r238439 r245239 57 57 WTF_MAKE_FAST_ALLOCATED; 58 58 public: 59 JITMathIC(ArithProfile* arithProfile , const Instruction* instruction)59 JITMathIC(ArithProfile* arithProfile) 60 60 : m_arithProfile(arithProfile) 61 , m_instruction(instruction)62 61 { 63 62 } … … 226 225 227 226 ArithProfile* arithProfile() const { return m_arithProfile; } 228 const Instruction* instruction() const { return m_instruction; }229 227 230 228 #if ENABLE(MATH_IC_STATS) … … 240 238 241 239 ArithProfile* m_arithProfile; 242 const Instruction* m_instruction;243 240 MacroAssemblerCodeRef<JITStubRoutinePtrTag> m_code; 244 241 CodeLocationLabel<JSInternalPtrTag> m_inlineStart; … … 257 254 class JITBinaryMathIC : public JITMathIC<GeneratorType, isBinaryProfileEmpty> { 258 255 public: 259 JITBinaryMathIC(ArithProfile* arithProfile , const Instruction* instruction)260 : JITMathIC<GeneratorType, isBinaryProfileEmpty>(arithProfile , instruction)256 JITBinaryMathIC(ArithProfile* arithProfile) 257 : JITMathIC<GeneratorType, isBinaryProfileEmpty>(arithProfile) 261 258 { 262 259 } … … 275 272 class JITUnaryMathIC : public JITMathIC<GeneratorType, isUnaryProfileEmpty> { 276 273 public: 277 JITUnaryMathIC(ArithProfile* arithProfile , const Instruction* instruction)278 : JITMathIC<GeneratorType, isUnaryProfileEmpty>(arithProfile , instruction)274 JITUnaryMathIC(ArithProfile* arithProfile) 275 : JITMathIC<GeneratorType, isUnaryProfileEmpty>(arithProfile) 279 276 { 280 277 } -
trunk/Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.h
r234086 r245239 39 39 class CallLinkInfo; 40 40 41 class PolymorphicCallNode : public BasicRawSentinelNode<PolymorphicCallNode> {41 class PolymorphicCallNode : public PackedRawSentinelNode<PolymorphicCallNode> { 42 42 WTF_MAKE_NONCOPYABLE(PolymorphicCallNode); 43 43 public: … … 51 51 void unlink(VM&); 52 52 53 bool hasCallLinkInfo(CallLinkInfo* info) { return m_callLinkInfo == info; }53 bool hasCallLinkInfo(CallLinkInfo* info) { return m_callLinkInfo.get() == info; } 54 54 void clearCallLinkInfo(); 55 55 56 56 private: 57 CallLinkInfo*m_callLinkInfo;57 PackedPtr<CallLinkInfo> m_callLinkInfo; 58 58 }; 59 59 -
trunk/Source/JavaScriptCore/jit/SnippetOperand.h
r206525 r245239 29 29 30 30 #include "ResultType.h" 31 #include <wtf/Packed.h> 31 32 32 33 namespace JSC { 33 34 34 35 class SnippetOperand { 35 enum ConstOrVarType {36 enum ConstOrVarType : uint8_t { 36 37 Variable, 37 38 ConstInt32, … … 56 57 bool isPositiveConstInt32() const { return isConstInt32() && asConstInt32() > 0; } 57 58 58 int64_t asRawBits() const { return m_val. rawBits; }59 int64_t asRawBits() const { return m_val.get().rawBits; } 59 60 60 61 int32_t asConstInt32() const 61 62 { 62 63 ASSERT(m_type == ConstInt32); 63 return m_val. int32Val;64 return m_val.get().int32Val; 64 65 } 65 66 … … 67 68 { 68 69 ASSERT(m_type == ConstDouble); 69 return m_val. doubleVal;70 return m_val.get().doubleVal; 70 71 } 71 72 … … 81 82 { 82 83 m_type = ConstInt32; 83 m_val.int32Val = value; 84 UnionType u; 85 u.int32Val = value; 86 m_val = WTFMove(u); 84 87 } 85 88 … … 87 90 { 88 91 m_type = ConstDouble; 89 m_val.doubleVal = value; 92 UnionType u; 93 u.doubleVal = value; 94 m_val = WTFMove(u); 90 95 } 91 96 … … 93 98 ResultType m_resultType; 94 99 ConstOrVarType m_type { Variable }; 95 union {100 union UnionType { 96 101 int32_t int32Val; 97 102 double doubleVal; 98 103 int64_t rawBits; 99 } m_val; 104 }; 105 Packed<UnionType> m_val; 100 106 }; 107 static_assert(alignof(SnippetOperand) == 1); 101 108 102 109 } // namespace JSC -
trunk/Source/WTF/ChangeLog
r245234 r245239 1 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Compress miscelaneous JIT related data structures with Packed<> 4 https://bugs.webkit.org/show_bug.cgi?id=197830 5 6 Reviewed by Saam Barati. 7 8 * wtf/Packed.h: 9 (WTF::alignof): 10 1 11 2019-05-13 Michael Catanzaro <mcatanzaro@igalia.com> 2 12 -
trunk/Source/WTF/wtf/Packed.h
r245214 r245239 162 162 T& operator*() const { return *get(); } 163 163 bool operator!() const { return !get(); } 164 explicit operator bool() const { return get(); } 164 165 165 166 PackedAlignedPtr& operator=(T* value)
Note: See TracChangeset
for help on using the changeset viewer.