Changeset 245667 in webkit
- Timestamp:
- May 22, 2019, 6:22:33 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/array-allocation-profile-should-not-update-itself-in-concurrent-compiler.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/ArrayAllocationProfile.cpp (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/ArrayAllocationProfile.h (modified) (2 diffs)
-
Source/JavaScriptCore/bytecode/CodeBlock.cpp (modified) (3 diffs)
-
Source/JavaScriptCore/bytecode/CodeBlock.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r245655 r245667 1 2019-05-22 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] ArrayAllocationProfile should not access to butterfly in concurrent compiler 4 https://bugs.webkit.org/show_bug.cgi?id=197809 5 6 Reviewed by Michael Saboff. 7 8 * stress/array-allocation-profile-should-not-update-itself-in-concurrent-compiler.js: Added. 9 (foo): 10 1 11 2019-05-22 Ross Kirsling <ross.kirsling@sony.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r245658 r245667 1 2019-05-22 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] ArrayAllocationProfile should not access to butterfly in concurrent compiler 4 https://bugs.webkit.org/show_bug.cgi?id=197809 5 6 Reviewed by Michael Saboff. 7 8 ArrayAllocationProfile assumes that Butterfly can be accessed concurrently. But this is not correct now 9 since LargeAllocation Butterfly can be realloced. In this patch, we switch profiling array allocations 10 only in the main thread. This allocation profiling is repeatedly called in the main thread's slow path, 11 and it is also called when updating the profiles in the main thread. 12 13 We also rename updateAllPredictionsAndCountLiveness to updateAllValueProfilePredictionsAndCountLiveness 14 since it only cares ValueProfiles. 15 16 * bytecode/ArrayAllocationProfile.cpp: 17 (JSC::ArrayAllocationProfile::updateProfile): 18 * bytecode/ArrayAllocationProfile.h: 19 (JSC::ArrayAllocationProfile::selectIndexingTypeConcurrently): 20 (JSC::ArrayAllocationProfile::selectIndexingType): 21 (JSC::ArrayAllocationProfile::vectorLengthHintConcurrently): 22 (JSC::ArrayAllocationProfile::vectorLengthHint): 23 * bytecode/CodeBlock.cpp: 24 (JSC::CodeBlock::updateAllValueProfilePredictionsAndCountLiveness): 25 (JSC::CodeBlock::updateAllValueProfilePredictions): 26 (JSC::CodeBlock::shouldOptimizeNow): 27 (JSC::CodeBlock::updateAllPredictionsAndCountLiveness): Deleted. 28 * bytecode/CodeBlock.h: 29 * dfg/DFGByteCodeParser.cpp: 30 (JSC::DFG::ByteCodeParser::parseBlock): 31 1 32 2019-05-22 Yusuke Suzuki <ysuzuki@apple.com> 2 33 -
trunk/Source/JavaScriptCore/bytecode/ArrayAllocationProfile.cpp
r232070 r245667 48 48 // be freed, since we require the GC to wait until all concurrent JITing 49 49 // finishes. 50 // 51 // But one exception is vector length. We access vector length to get the vector 52 // length hint. However vector length can be accessible only from the main 53 // thread because large butterfly can be realloced in the main thread. 54 // So for now, we update the allocation profile only from the main thread. 50 55 56 ASSERT(!isCompilationThread()); 51 57 JSArray* lastArray = m_lastArray; 52 58 if (!lastArray) -
trunk/Source/JavaScriptCore/bytecode/ArrayAllocationProfile.h
r237547 r245667 40 40 } 41 41 42 IndexingType selectIndexingTypeConcurrently() 43 { 44 return m_currentIndexingType; 45 } 46 42 47 IndexingType selectIndexingType() 43 48 { 49 ASSERT(!isCompilationThread()); 44 50 JSArray* lastArray = m_lastArray; 45 51 if (lastArray && UNLIKELY(lastArray->indexingType() != m_currentIndexingType)) … … 49 55 50 56 // vector length hint becomes [0, BASE_CONTIGUOUS_VECTOR_LEN_MAX]. 57 unsigned vectorLengthHintConcurrently() 58 { 59 return m_largestSeenVectorLength; 60 } 61 51 62 unsigned vectorLengthHint() 52 63 { 64 ASSERT(!isCompilationThread()); 53 65 JSArray* lastArray = m_lastArray; 54 66 if (lastArray && (m_largestSeenVectorLength != BASE_CONTIGUOUS_VECTOR_LEN_MAX) && UNLIKELY(lastArray->getVectorLength() > m_largestSeenVectorLength)) -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r245658 r245667 2627 2627 #endif // ENABLE(DFG_JIT) 2628 2628 2629 void CodeBlock::updateAll PredictionsAndCountLiveness(unsigned& numberOfLiveNonArgumentValueProfiles, unsigned& numberOfSamplesInProfiles)2629 void CodeBlock::updateAllValueProfilePredictionsAndCountLiveness(unsigned& numberOfLiveNonArgumentValueProfiles, unsigned& numberOfSamplesInProfiles) 2630 2630 { 2631 2631 ConcurrentJSLocker locker(m_lock); … … 2665 2665 { 2666 2666 unsigned ignoredValue1, ignoredValue2; 2667 updateAll PredictionsAndCountLiveness(ignoredValue1, ignoredValue2);2667 updateAllValueProfilePredictionsAndCountLiveness(ignoredValue1, ignoredValue2); 2668 2668 } 2669 2669 … … 2699 2699 unsigned numberOfLiveNonArgumentValueProfiles; 2700 2700 unsigned numberOfSamplesInProfiles; 2701 updateAll PredictionsAndCountLiveness(numberOfLiveNonArgumentValueProfiles, numberOfSamplesInProfiles);2701 updateAllValueProfilePredictionsAndCountLiveness(numberOfLiveNonArgumentValueProfiles, numberOfSamplesInProfiles); 2702 2702 2703 2703 if (Options::verboseOSR()) { -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r245658 r245667 907 907 double optimizationThresholdScalingFactor(); 908 908 909 void updateAll PredictionsAndCountLiveness(unsigned& numberOfLiveNonArgumentValueProfiles, unsigned& numberOfSamplesInProfiles);909 void updateAllValueProfilePredictionsAndCountLiveness(unsigned& numberOfLiveNonArgumentValueProfiles, unsigned& numberOfSamplesInProfiles); 910 910 911 911 void setConstantIdentifierSetRegisters(VM&, const Vector<ConstantIdentifierSetEntry>& constants); -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r245658 r245667 4886 4886 for (int operandIdx = startOperand; operandIdx > startOperand - numOperands; --operandIdx) 4887 4887 addVarArgChild(get(VirtualRegister(operandIdx))); 4888 unsigned vectorLengthHint = std::max<unsigned>(profile.vectorLengthHint (), numOperands);4889 set(bytecode.m_dst, addToGraph(Node::VarArg, NewArray, OpInfo(profile.selectIndexingType ()), OpInfo(vectorLengthHint)));4888 unsigned vectorLengthHint = std::max<unsigned>(profile.vectorLengthHintConcurrently(), numOperands); 4889 set(bytecode.m_dst, addToGraph(Node::VarArg, NewArray, OpInfo(profile.selectIndexingTypeConcurrently()), OpInfo(vectorLengthHint))); 4890 4890 NEXT_OPCODE(op_new_array); 4891 4891 } … … 4917 4917 auto bytecode = currentInstruction->as<OpNewArrayWithSize>(); 4918 4918 ArrayAllocationProfile& profile = bytecode.metadata(codeBlock).m_arrayAllocationProfile; 4919 set(bytecode.m_dst, addToGraph(NewArrayWithSize, OpInfo(profile.selectIndexingType ()), get(bytecode.m_length)));4919 set(bytecode.m_dst, addToGraph(NewArrayWithSize, OpInfo(profile.selectIndexingTypeConcurrently()), get(bytecode.m_length))); 4920 4920 NEXT_OPCODE(op_new_array_with_size); 4921 4921 }
Note:
See TracChangeset
for help on using the changeset viewer.