Changeset 243885 in webkit
- Timestamp:
- Apr 4, 2019, 11:53:08 AM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
dfg/DFGByteCodeParser.cpp (modified) (2 diffs)
-
runtime/FuzzerAgent.cpp (modified) (1 diff)
-
runtime/FuzzerAgent.h (modified) (2 diffs)
-
runtime/RandomizingFuzzerAgent.cpp (modified) (3 diffs)
-
runtime/RandomizingFuzzerAgent.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243875 r243885 1 2019-04-04 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Pass CodeOrigin to FuzzerAgent 4 https://bugs.webkit.org/show_bug.cgi?id=196590 5 6 Reviewed by Saam Barati. 7 8 Pass CodeOrigin instead of bytecodeIndex. CodeOrigin includes richer information (InlineCallFrame*). 9 We also mask prediction with SpecBytecodeTop in DFGByteCodeParser. The fuzzer can produce any SpeculatedTypes, 10 but DFGByteCodeParser should only see predictions that can be actually produced from the bytecode execution. 11 12 * dfg/DFGByteCodeParser.cpp: 13 (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): 14 * runtime/FuzzerAgent.cpp: 15 (JSC::FuzzerAgent::getPrediction): 16 * runtime/FuzzerAgent.h: 17 * runtime/RandomizingFuzzerAgent.cpp: 18 (JSC::RandomizingFuzzerAgent::getPrediction): 19 * runtime/RandomizingFuzzerAgent.h: 20 1 21 2019-04-04 Caio Lima <ticaiolima@gmail.com> 2 22 -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r243832 r243885 833 833 SpeculatedType getPredictionWithoutOSRExit(unsigned bytecodeIndex) 834 834 { 835 auto getValueProfilePredictionFromForCodeBlockAndBytecodeOffset = [&] (CodeBlock* codeBlock, int bytecodeIndex)835 auto getValueProfilePredictionFromForCodeBlockAndBytecodeOffset = [&] (CodeBlock* codeBlock, const CodeOrigin& codeOrigin) 836 836 { 837 837 SpeculatedType prediction; 838 838 { 839 839 ConcurrentJSLocker locker(codeBlock->m_lock); 840 prediction = codeBlock->valueProfilePredictionForBytecodeOffset(locker, bytecodeIndex);840 prediction = codeBlock->valueProfilePredictionForBytecodeOffset(locker, codeOrigin.bytecodeIndex()); 841 841 } 842 842 auto* fuzzerAgent = m_vm->fuzzerAgent(); 843 843 if (UNLIKELY(fuzzerAgent)) 844 return fuzzerAgent->getPrediction(codeBlock, bytecodeIndex, prediction);844 return fuzzerAgent->getPrediction(codeBlock, codeOrigin, prediction) & SpecBytecodeTop; 845 845 return prediction; 846 846 }; 847 847 848 SpeculatedType prediction = getValueProfilePredictionFromForCodeBlockAndBytecodeOffset(m_inlineStackTop->m_profiledBlock, bytecodeIndex);848 SpeculatedType prediction = getValueProfilePredictionFromForCodeBlockAndBytecodeOffset(m_inlineStackTop->m_profiledBlock, CodeOrigin(bytecodeIndex, inlineCallFrame())); 849 849 if (prediction != SpecNone) 850 850 return prediction; … … 880 880 stack = stack->m_caller; 881 881 882 return getValueProfilePredictionFromForCodeBlockAndBytecodeOffset(stack->m_profiledBlock, codeOrigin->bytecodeIndex());882 return getValueProfilePredictionFromForCodeBlockAndBytecodeOffset(stack->m_profiledBlock, *codeOrigin); 883 883 } 884 884 -
trunk/Source/JavaScriptCore/runtime/FuzzerAgent.cpp
r243832 r243885 33 33 } 34 34 35 SpeculatedType FuzzerAgent::getPrediction(CodeBlock*, int, SpeculatedType result)35 SpeculatedType FuzzerAgent::getPrediction(CodeBlock*, const CodeOrigin&, SpeculatedType result) 36 36 { 37 37 return result; -
trunk/Source/JavaScriptCore/runtime/FuzzerAgent.h
r243832 r243885 26 26 #pragma once 27 27 28 #include "CodeOrigin.h" 28 29 #include "SpeculatedType.h" 29 #include <wtf/Locker.h>30 30 31 31 namespace JSC { … … 37 37 JS_EXPORT_PRIVATE virtual ~FuzzerAgent(); 38 38 39 JS_EXPORT_PRIVATE virtual SpeculatedType getPrediction(CodeBlock*, int bytecodeOffset, SpeculatedType);39 JS_EXPORT_PRIVATE virtual SpeculatedType getPrediction(CodeBlock*, const CodeOrigin&, SpeculatedType); 40 40 }; 41 41 -
trunk/Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp
r243857 r243885 28 28 29 29 #include "CodeBlock.h" 30 #include <wtf/Locker.h> 30 31 31 32 namespace JSC { … … 36 37 } 37 38 38 SpeculatedType RandomizingFuzzerAgent::getPrediction(CodeBlock* codeBlock, int bytecodeIndex, SpeculatedType original)39 SpeculatedType RandomizingFuzzerAgent::getPrediction(CodeBlock* codeBlock, const CodeOrigin& codeOrigin, SpeculatedType original) 39 40 { 40 41 auto locker = holdLock(m_lock); … … 43 44 SpeculatedType generated = static_cast<SpeculatedType>((static_cast<uint64_t>(high) << 32) | low) & SpecFullTop; 44 45 if (Options::dumpRandomizingFuzzerAgentPredictions()) 45 dataLogLn("getPrediction name:(", codeBlock->inferredName(), "#", codeBlock->hashAsStringIfPossible(), "),bytecodeIndex:(", bytecodeIndex, "),original:(", SpeculationDump(original), "),generated:(", SpeculationDump(generated), ")");46 dataLogLn("getPrediction name:(", codeBlock->inferredName(), "#", codeBlock->hashAsStringIfPossible(), "),bytecodeIndex:(", codeOrigin.bytecodeIndex(), "),original:(", SpeculationDump(original), "),generated:(", SpeculationDump(generated), ")"); 46 47 return generated; 47 48 } -
trunk/Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.h
r243832 r243885 38 38 RandomizingFuzzerAgent(VM&); 39 39 40 SpeculatedType getPrediction(CodeBlock*, int bytecodeOffset, SpeculatedType) override;40 SpeculatedType getPrediction(CodeBlock*, const CodeOrigin&, SpeculatedType) override; 41 41 42 42 private:
Note:
See TracChangeset
for help on using the changeset viewer.