Changeset 260180 in webkit
- Timestamp:
- Apr 16, 2020 5:06:49 AM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r260166 r260180 1 2020-04-15 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Use ensureStillAliveHere in FTL when content of storage should be kept alive 4 https://bugs.webkit.org/show_bug.cgi?id=210583 5 <rdar://problem/61831515> 6 7 Reviewed by Mark Lam. 8 9 The content of Butterfly / ArrayStorage is kept alive only when the owner JSCell is alive. 10 This means that we should keep the owner JSCell alive if we are loading content of storage 11 which includes JSCells. This patch inserts ensureStillAliveHere in FTL to ensure this invariant. 12 13 * ftl/FTLJITCode.cpp: 14 (JSC::FTL::JITCode::~JITCode): Found that we get crash with `dumpDisassembly` if FTL::JITCode is destroyed while it fails to generate code while testing this. 15 * ftl/FTLLowerDFGToB3.cpp: 16 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal): 17 (JSC::FTL::DFG::LowerDFGToB3::compileArrayIndexOf): 18 (JSC::FTL::DFG::LowerDFGToB3::compileArrayPop): 19 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt): 20 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharCodeAt): 21 (JSC::FTL::DFG::LowerDFGToB3::compileStringCodePointAt): 22 (JSC::FTL::DFG::LowerDFGToB3::compileGetByOffset): 23 (JSC::FTL::DFG::LowerDFGToB3::compileMultiGetByOffset): 24 1 25 2020-04-15 Keith Miller <keith_miller@apple.com> 2 26 -
trunk/Source/JavaScriptCore/ftl/FTLJITCode.cpp
r255540 r260180 44 44 { 45 45 if (FTL::shouldDumpDisassembly()) { 46 dataLog("Destroying FTL JIT code at "); 47 CommaPrinter comma; 48 dataLog(comma, m_b3Code); 49 dataLog(comma, m_arityCheckEntrypoint); 50 dataLog("\n"); 46 if (m_b3Code || m_arityCheckEntrypoint) { 47 dataLog("Destroying FTL JIT code at "); 48 CommaPrinter comma; 49 if (m_b3Code) 50 dataLog(comma, m_b3Code); 51 if (m_arityCheckEntrypoint) 52 dataLog(comma, m_arityCheckEntrypoint); 53 dataLog("\n"); 54 } 51 55 } 52 56 } -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r259786 r260180 4354 4354 } else 4355 4355 speculate(LoadFromHole, noValue(), 0, isHole); 4356 // We have to keep base alive to keep content in storage alive. 4357 if (m_node->arrayMode().type() == Array::Contiguous) 4358 ensureStillAliveHere(base); 4356 4359 setJSValue(result); 4357 4360 return; … … 4379 4382 4380 4383 m_out.appendTo(continuation, lastNext); 4384 // We have to keep base alive to keep content in storage alive. 4385 if (m_node->arrayMode().type() == Array::Contiguous) 4386 ensureStillAliveHere(base); 4381 4387 setJSValue(m_out.phi(Int64, fastResult, slowResult)); 4382 4388 return; … … 4657 4663 LValue result = m_out.load64(baseIndex(heap, storage, index, m_graph.varArgChild(m_node, 1))); 4658 4664 speculate(LoadFromHole, noValue(), 0, m_out.isZero64(result)); 4665 // We have to keep base alive to keep content in storage alive. 4666 ensureStillAliveHere(base); 4659 4667 setJSValue(result); 4660 break;4668 return; 4661 4669 } 4662 4670 … … 4682 4690 4683 4691 m_out.appendTo(continuation, lastNext); 4692 // We have to keep base alive to keep content in storage alive. 4693 ensureStillAliveHere(base); 4684 4694 setJSValue(m_out.phi(Int64, fastResult, slowResult)); 4685 4695 return; … … 5652 5662 { 5653 5663 JSGlobalObject* globalObject = m_graph.globalObjectFor(m_node->origin.semantic); 5664 LValue base = lowCell(m_graph.varArgChild(m_node, 0)); 5654 5665 LValue storage = lowStorage(m_node->numChildren() == 3 ? m_graph.varArgChild(m_node, 2) : m_graph.varArgChild(m_node, 3)); 5655 5666 LValue length = m_out.load32(storage, m_heaps.Butterfly_publicLength); … … 5754 5765 5755 5766 m_out.appendTo(continuation, lastNext); 5767 // We have to keep base alive since that keeps content of storage alive. 5768 ensureStillAliveHere(base); 5756 5769 setInt32(m_out.castToInt32(m_out.phi(pointerType(), notFoundResult, foundResult))); 5757 break;5770 return; 5758 5771 } 5759 5772 5760 5773 case StringUse: 5761 5774 ASSERT(m_node->arrayMode().type() == Array::Contiguous); 5775 // We have to keep base alive since that keeps storage alive. 5776 ensureStillAliveHere(base); 5762 5777 setInt32(m_out.castToInt32(vmCall(Int64, operationArrayIndexOfString, weakPointer(globalObject), storage, lowString(searchElementEdge), startIndex))); 5763 break;5778 return; 5764 5779 5765 5780 case UntypedUse: … … 5767 5782 case Array::Double: 5768 5783 setInt32(m_out.castToInt32(vmCall(Int64, operationArrayIndexOfValueDouble, weakPointer(globalObject), storage, lowJSValue(searchElementEdge), startIndex))); 5769 break; 5784 return; 5785 case Array::Contiguous: 5786 // We have to keep base alive since that keeps content of storage alive. 5787 ensureStillAliveHere(base); 5788 FALLTHROUGH; 5770 5789 case Array::Int32: 5771 case Array::Contiguous:5772 5790 setInt32(m_out.castToInt32(vmCall(Int64, operationArrayIndexOfValueInt32OrContiguous, weakPointer(globalObject), storage, lowJSValue(searchElementEdge), startIndex))); 5773 break;5791 return; 5774 5792 default: 5775 5793 RELEASE_ASSERT_NOT_REACHED(); 5776 break;5794 return; 5777 5795 } 5778 break;5796 return; 5779 5797 5780 5798 default: 5781 5799 RELEASE_ASSERT_NOT_REACHED(); 5782 break;5800 return; 5783 5801 } 5784 5802 } … … 5814 5832 if (m_node->arrayMode().type() != Array::Double) { 5815 5833 LValue result = m_out.load64(pointer); 5834 // We have to keep base alive to keep content in storage alive. 5835 if (m_node->arrayMode().type() == Array::Contiguous) 5836 ensureStillAliveHere(base); 5816 5837 m_out.store64(m_out.int64Zero, pointer); 5817 5838 results.append(m_out.anchor(result)); … … 5859 5880 TypedPointer pointer = m_out.baseIndex(m_heaps.ArrayStorage_vector, storage, m_out.zeroExtPtr(newLength)); 5860 5881 LValue result = m_out.load64(pointer); 5882 // We have to keep base alive to keep content in storage alive. 5883 ensureStillAliveHere(base); 5861 5884 m_out.branch(m_out.notZero64(result), usually(fastCase), rarely(slowCase)); 5862 5885 … … 7817 7840 7818 7841 m_out.appendTo(continuation, lastNext); 7842 // We have to keep base alive since that keeps storage alive. 7843 ensureStillAliveHere(base); 7819 7844 setJSValue(m_out.phi(Int64, results)); 7820 7845 } … … 7863 7888 m_out.appendTo(continuation, lastNext); 7864 7889 7890 // We have to keep base alive since that keeps storage alive. 7891 ensureStillAliveHere(base); 7865 7892 setInt32(m_out.phi(Int32, char8Bit, char16Bit)); 7866 7893 } … … 7921 7948 7922 7949 m_out.appendTo(continuation, lastNext); 7950 // We have to keep base alive since that keeps storage alive. 7951 ensureStillAliveHere(base); 7923 7952 setInt32(m_out.phi(Int32, char8Bit, char16Bit, charSurrogatePair)); 7924 7953 } … … 7973 8002 StorageAccessData& data = m_node->storageAccessData(); 7974 8003 7975 setJSValue(loadProperty( 7976 lowStorage(m_node->child1()), data.identifierNumber, data.offset)); 8004 LValue base = lowCell(m_node->child2()); 8005 LValue value = loadProperty(lowStorage(m_node->child1()), data.identifierNumber, data.offset); 8006 // We have to keep base alive since that keeps content of storage alive. 8007 ensureStillAliveHere(base); 8008 setJSValue(value); 7977 8009 } 7978 8010 … … 8056 8088 8057 8089 m_out.appendTo(continuation, lastNext); 8090 // We have to keep base alive since that keeps storage alive. 8091 ensureStillAliveHere(base); 8058 8092 setJSValue(m_out.phi(Int64, results)); 8059 8093 }
Note: See TracChangeset
for help on using the changeset viewer.