⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243843 in webkit


Ignore:
Timestamp:
Apr 3, 2019, 6:28:49 PM (7 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Add dump feature for RandomizingFuzzerAgent
https://bugs.webkit.org/show_bug.cgi?id=196586

Reviewed by Saam Barati.

Towards deterministic tests for the results from randomizing fuzzer agent, this patch adds Options::dumpRandomizingFuzzerAgentPredictions, which dumps the generated types.
The results is like this.

getPrediction name:(#C2q9xD),bytecodeIndex:(22),original:(Array),generated:(OtherObj|Array|Float64Array|BigInt|NonIntAsDouble)
getPrediction name:(makeUnwriteableUnconfigurableObject#AiEJv1),bytecodeIndex:(14),original:(OtherObj),generated:(Final|Uint8Array|Float64Array|SetObject|WeakSetObject|BigInt|NonIntAsDouble)

  • runtime/Options.cpp:

(JSC::recomputeDependentOptions):

  • runtime/Options.h:
  • runtime/RandomizingFuzzerAgent.cpp:

(JSC::RandomizingFuzzerAgent::getPrediction):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r243841 r243843  
     12019-04-03  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Add dump feature for RandomizingFuzzerAgent
     4        https://bugs.webkit.org/show_bug.cgi?id=196586
     5
     6        Reviewed by Saam Barati.
     7
     8        Towards deterministic tests for the results from randomizing fuzzer agent, this patch adds Options::dumpRandomizingFuzzerAgentPredictions, which dumps the generated types.
     9        The results is like this.
     10
     11            getPrediction name:(#C2q9xD),bytecodeIndex:(22),original:(Array),generated:(OtherObj|Array|Float64Array|BigInt|NonIntAsDouble)
     12            getPrediction name:(makeUnwriteableUnconfigurableObject#AiEJv1),bytecodeIndex:(14),original:(OtherObj),generated:(Final|Uint8Array|Float64Array|SetObject|WeakSetObject|BigInt|NonIntAsDouble)
     13
     14        * runtime/Options.cpp:
     15        (JSC::recomputeDependentOptions):
     16        * runtime/Options.h:
     17        * runtime/RandomizingFuzzerAgent.cpp:
     18        (JSC::RandomizingFuzzerAgent::getPrediction):
     19
    1202019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
    221
  • trunk/Source/JavaScriptCore/runtime/Options.cpp

    r243312 r243843  
    452452        || Options::verboseCFA()
    453453        || Options::verboseDFGFailure()
    454         || Options::verboseFTLFailure())
     454        || Options::verboseFTLFailure()
     455        || Options::dumpRandomizingFuzzerAgentPredictions())
    455456        Options::alwaysComputeHash() = true;
    456457   
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r243832 r243843  
    437437    v(bool, useRandomizingFuzzerAgent, false, Normal, nullptr) \
    438438    v(unsigned, seedOfRandomizingFuzzerAgent, 1, Normal, nullptr) \
     439    v(bool, dumpRandomizingFuzzerAgentPredictions, false, Normal, nullptr) \
    439440    \
    440441    v(bool, logPhaseTimes, false, Normal, nullptr) \
  • trunk/Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp

    r243832 r243843  
    3434}
    3535
    36 SpeculatedType RandomizingFuzzerAgent::getPrediction(CodeBlock*, int, SpeculatedType)
     36SpeculatedType RandomizingFuzzerAgent::getPrediction(CodeBlock* codeBlock, int bytecodeIndex, SpeculatedType original)
    3737{
    3838    auto locker = holdLock(m_lock);
    3939    uint32_t high = m_random.getUint32();
    4040    uint32_t low = m_random.getUint32();
    41     uint64_t result = (static_cast<uint64_t>(high) << 32) | low;
    42     return static_cast<SpeculatedType>(result) & SpecFullTop;
     41    SpeculatedType generated = static_cast<SpeculatedType>((static_cast<uint64_t>(high) << 32) | low) & SpecFullTop;
     42    if (Options::dumpRandomizingFuzzerAgentPredictions())
     43        dataLogLn("getPrediction name:(", codeBlock->inferredName(), "#", codeBlock->hashAsStringIfPossible(), "),bytecodeIndex:(", bytecodeIndex, "),original:(", SpeculationDump(original), "),generated:(", SpeculationDump(generated), ")");
     44    return generated;
    4345}
    4446
Note: See TracChangeset for help on using the changeset viewer.