Changeset 255987 in webkit
- Timestamp:
- Feb 6, 2020, 3:25:01 PM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r255905 r255987 1 2020-02-06 Yusuke Suzuki <[email protected]> 2 3 [JSC] CodeBlock::shrinkToFit should shrink m_constantRegisters and m_constantsSourceCodeRepresentation in 64bit architectures 4 https://bugs.webkit.org/show_bug.cgi?id=207356 5 6 Reviewed by Mark Lam. 7 8 Only 32bit architectures are using m_constantRegisters's address. 64bit architectures are not relying on m_constantRegisters's address. 9 This patches fixes the thing so that CodeBlock::shrinkToFit will shrink m_constantRegisters and m_constantsSourceCodeRepresentation 10 regardless of whether this is EarlyShrink or not. We also move DFG/FTL's LateShrink call to the place after calling DFGCommon reallyAdd 11 since they can add more constant registers. 12 13 * bytecode/CodeBlock.cpp: 14 (JSC::CodeBlock::shrinkToFit): 15 * bytecode/CodeBlock.h: 16 * dfg/DFGJITCompiler.cpp: 17 (JSC::DFG::JITCompiler::compile): 18 (JSC::DFG::JITCompiler::compileFunction): 19 * dfg/DFGJITFinalizer.cpp: 20 (JSC::DFG::JITFinalizer::finalizeCommon): 21 * dfg/DFGPlan.cpp: 22 (JSC::DFG::Plan::compileInThreadImpl): 23 (JSC::DFG::Plan::finalizeWithoutNotifyingCallback): 24 * jit/JIT.cpp: 25 (JSC::JIT::link): 26 * jit/JIT.h: 27 * jit/JITInlines.h: 28 (JSC::JIT::emitLoadDouble): 29 (JSC::JIT::emitLoadInt32ToDouble): Deleted. 30 1 31 2020-02-05 Don Olmstead <[email protected]> 2 32 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r255887 r255987 1954 1954 } 1955 1955 1956 void CodeBlock::shrinkToFit( ShrinkMode shrinkMode)1956 void CodeBlock::shrinkToFit(const ConcurrentJSLocker&, ShrinkMode shrinkMode) 1957 1957 { 1958 1958 ConcurrentJSLocker locker(m_lock); 1959 1959 1960 if (shrinkMode == EarlyShrink) { 1960 #if USE(JSVALUE32_64) 1961 // Only 32bit Baseline JIT is touching m_constantRegisters address directly. 1962 if (shrinkMode == ShrinkMode::EarlyShrink) 1961 1963 m_constantRegisters.shrinkToFit(); 1962 m_constantsSourceCodeRepresentation.shrinkToFit(); 1963 1964 #else 1965 m_constantRegisters.shrinkToFit(); 1966 #endif 1967 m_constantsSourceCodeRepresentation.shrinkToFit(); 1968 1969 if (shrinkMode == ShrinkMode::EarlyShrink) { 1964 1970 if (m_rareData) { 1965 1971 m_rareData->m_switchJumpTables.shrinkToFit(); -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r255687 r255987 636 636 DirectEvalCodeCache& directEvalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_directEvalCodeCache; } 637 637 638 enum ShrinkMode {638 enum class ShrinkMode { 639 639 // Shrink prior to generating machine code that may point directly into vectors. 640 640 EarlyShrink, … … 643 643 // and appending to others. At this time it is not safe to shrink certain vectors 644 644 // because we would have generated machine code that references them directly. 645 LateShrink 645 LateShrink, 646 646 }; 647 void shrinkToFit( ShrinkMode);647 void shrinkToFit(const ConcurrentJSLocker&, ShrinkMode); 648 648 649 649 // Functions for controlling when JITting kicks in, in a mixed mode -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r255540 r255987 393 393 m_speculative->linkOSREntries(*linkBuffer); 394 394 395 codeBlock()->shrinkToFit(CodeBlock::LateShrink);396 397 395 disassemble(*linkBuffer); 398 396 … … 494 492 m_speculative->linkOSREntries(*linkBuffer); 495 493 496 codeBlock()->shrinkToFit(CodeBlock::LateShrink);497 498 494 if (requiresArityFixup) 499 495 linkBuffer->link(callArityFixup, FunctionPtr<JITThunkPtrTag>(vm().getCTIStub(arityFixupGenerator).code())); -
trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp
r254464 r255987 84 84 CodeBlock* codeBlock = m_plan.codeBlock(); 85 85 86 // Some JIT finalizers may have added more constants. Shrink-to-fit those things now.87 {88 ConcurrentJSLocker locker(codeBlock->m_lock);89 codeBlock->constants().shrinkToFit();90 codeBlock->constantsSourceCodeRepresentation().shrinkToFit();91 }92 93 86 #if ENABLE(FTL_JIT) 94 87 m_jitCode->optimizeAfterWarmUp(codeBlock); -
trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp
r255542 r255987 280 280 // powerful than a late one. It's safe to do so because we haven't generated any code 281 281 // that references any of the tables directly, yet. 282 m_codeBlock->shrinkToFit(CodeBlock::EarlyShrink); 282 { 283 ConcurrentJSLocker locker(m_codeBlock->m_lock); 284 m_codeBlock->shrinkToFit(locker, CodeBlock::ShrinkMode::EarlyShrink); 285 } 283 286 284 287 if (validationEnabled()) … … 618 621 ConcurrentJSLocker locker(m_codeBlock->m_lock); 619 622 m_codeBlock->jitCode()->shrinkToFit(locker); 623 m_codeBlock->shrinkToFit(locker, CodeBlock::ShrinkMode::LateShrink); 620 624 } 621 625 -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r255541 r255987 944 944 static_cast<double>(m_codeBlock->instructionsSize())); 945 945 946 m_codeBlock->shrinkToFit(CodeBlock::LateShrink); 946 { 947 ConcurrentJSLocker locker(m_codeBlock->m_lock); 948 m_codeBlock->shrinkToFit(locker, CodeBlock::ShrinkMode::LateShrink); 949 } 947 950 m_codeBlock->setJITCode( 948 951 adoptRef(*new DirectJITCode(result, withArityCheck, JITType::BaselineJIT))); -
trunk/Source/JavaScriptCore/jit/JIT.h
r255541 r255987 338 338 bool isOperandConstantDouble(VirtualRegister); 339 339 340 void emitLoadDouble(VirtualRegister, FPRegisterID value);341 void emitLoadInt32ToDouble(VirtualRegister, FPRegisterID value);342 343 340 enum WriteBarrierMode { UnconditionalWriteBarrier, ShouldFilterBase, ShouldFilterValue, ShouldFilterBaseAndValue }; 344 341 // value register in write barrier is used before any scratch registers … … 418 415 bool getOperandConstantInt(VirtualRegister op1, VirtualRegister op2, VirtualRegister& op, int32_t& constant); 419 416 417 void emitLoadDouble(VirtualRegister, FPRegisterID value); 420 418 void emitLoadTag(VirtualRegister, RegisterID tag); 421 419 void emitLoadPayload(VirtualRegister, RegisterID payload); -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r255040 r255987 378 378 #if USE(JSVALUE32_64) 379 379 380 inline void JIT::emitLoadDouble(VirtualRegister reg, FPRegisterID value) 381 { 382 if (reg.isConstant()) { 383 WriteBarrier<Unknown>& inConstantPool = m_codeBlock->constantRegister(reg); 384 loadDouble(TrustedImmPtr(&inConstantPool), value); 385 } else 386 loadDouble(addressFor(reg), value); 387 } 388 380 389 inline void JIT::emitLoadTag(VirtualRegister reg, RegisterID tag) 381 390 { … … 439 448 emitLoad(reg2, tag2, payload2); 440 449 emitLoad(reg1, tag1, payload1); 441 }442 443 inline void JIT::emitLoadDouble(VirtualRegister reg, FPRegisterID value)444 {445 if (reg.isConstant()) {446 WriteBarrier<Unknown>& inConstantPool = m_codeBlock->constantRegister(reg);447 loadDouble(TrustedImmPtr(&inConstantPool), value);448 } else449 loadDouble(addressFor(reg), value);450 }451 452 inline void JIT::emitLoadInt32ToDouble(VirtualRegister reg, FPRegisterID value)453 {454 if (reg.isConstant()) {455 WriteBarrier<Unknown>& inConstantPool = m_codeBlock->constantRegister(reg);456 char* bytePointer = reinterpret_cast<char*>(&inConstantPool);457 convertInt32ToDouble(AbsoluteAddress(bytePointer + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), value);458 } else459 convertInt32ToDouble(payloadFor(reg), value);460 450 } 461 451 … … 615 605 } 616 606 617 inline void JIT::emitLoadDouble(VirtualRegister reg, FPRegisterID value)618 {619 if (reg.isConstant()) {620 WriteBarrier<Unknown>& inConstantPool = m_codeBlock->constantRegister(reg);621 loadDouble(TrustedImmPtr(&inConstantPool), value);622 } else623 loadDouble(addressFor(reg), value);624 }625 626 inline void JIT::emitLoadInt32ToDouble(VirtualRegister reg, FPRegisterID value)627 {628 if (reg.isConstant()) {629 ASSERT(isOperandConstantInt(reg));630 convertInt32ToDouble(Imm32(getConstantOperand(reg).asInt32()), value);631 } else632 convertInt32ToDouble(addressFor(reg), value);633 }634 635 607 ALWAYS_INLINE JIT::PatchableJump JIT::emitPatchableJumpIfNotInt(RegisterID reg) 636 608 {
Note:
See TracChangeset
for help on using the changeset viewer.