Changeset 244241 in webkit


Ignore:
Timestamp:
Apr 13, 2019 1:54:19 AM (5 years ago)
Author:
Tadeu Zagallo
Message:

CodeCache should check that the UnlinkedCodeBlock was successfully created before caching it
https://bugs.webkit.org/show_bug.cgi?id=196880

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/bytecode-cache-syntax-error.js: Added.

(catch):

Source/JavaScriptCore:

CodeCache should not tell the SourceProvider to cache the bytecode if it failed
to create the UnlinkedCodeBlock.

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getUnlinkedGlobalCodeBlock):

Tools:

Add a new function for bytecode cache tests that does not forceDiskCache
for the second run: runBytecodeCacheNoAssetion. This is necessary for the
test added in this patch, since the code is invalid and therefore won't be
cached. It should also be useful for tests that evaluate dynamically
generated code.

  • Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh:
  • Scripts/run-jsc-stress-tests:
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r244238 r244241  
     12019-04-13  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        CodeCache should check that the UnlinkedCodeBlock was successfully created before caching it
     4        https://bugs.webkit.org/show_bug.cgi?id=196880
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * stress/bytecode-cache-syntax-error.js: Added.
     9        (catch):
     10
    1112019-04-12  Saam barati  <sbarati@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r244238 r244241  
     12019-04-13  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        CodeCache should check that the UnlinkedCodeBlock was successfully created before caching it
     4        https://bugs.webkit.org/show_bug.cgi?id=196880
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        CodeCache should not tell the SourceProvider to cache the bytecode if it failed
     9        to create the UnlinkedCodeBlock.
     10
     11        * runtime/CodeCache.cpp:
     12        (JSC::CodeCache::getUnlinkedGlobalCodeBlock):
     13
    1142019-04-12  Saam barati  <sbarati@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/CodeCache.cpp

    r244143 r244241  
    8181    unlinkedCodeBlock = generateUnlinkedCodeBlock<UnlinkedCodeBlockType, ExecutableType>(vm, executable, source, strictMode, scriptMode, debuggerMode, error, evalContextType, &variablesUnderTDZ);
    8282
    83     if (unlinkedCodeBlock && Options::useCodeCache())
     83    if (unlinkedCodeBlock && Options::useCodeCache()) {
    8484        m_sourceCode.addCache(key, SourceCodeValue(vm, unlinkedCodeBlock, m_sourceCode.age()));
    8585
    86     key.source().provider().cacheBytecode([&] {
    87         return encodeCodeBlock(vm, key, unlinkedCodeBlock);
    88     });
     86        key.source().provider().cacheBytecode([&] {
     87            return encodeCodeBlock(vm, key, unlinkedCodeBlock);
     88        });
     89    }
    8990
    9091    return unlinkedCodeBlock;
  • trunk/Tools/ChangeLog

    r244223 r244241  
     12019-04-13  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        CodeCache should check that the UnlinkedCodeBlock was successfully created before caching it
     4        https://bugs.webkit.org/show_bug.cgi?id=196880
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        Add a new function for bytecode cache tests that does not forceDiskCache
     9        for the second run: runBytecodeCacheNoAssetion. This is necessary for the
     10        test added in this patch, since the code is invalid and therefore won't be
     11        cached. It should also be useful for tests that evaluate dynamically
     12        generated code.
     13
     14        * Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh:
     15        * Scripts/run-jsc-stress-tests:
     16
    1172019-04-12  Eric Carlson  <eric.carlson@apple.com>
    218
  • trunk/Tools/Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh

    r244143 r244241  
    4646export JSC_diskCachePath=$diskCachePath
    4747mysys "$pathToVM" "$inputFile" "${extraOptions[@]}"
    48 export JSC_forceDiskCache=true
     48
     49if [ -z "$JSC_forceDiskCache" ]; then
     50    export JSC_forceDiskCache=true
     51fi
    4952mysys "$pathToVM" "$inputFile" "${extraOptions[@]}"
    50 
  • trunk/Tools/Scripts/run-jsc-stress-tests

    r244000 r244241  
    657657end
    658658
    659 def runBytecodeCache(*optionalTestSpecificOptions)
     659def runBytecodeCacheImpl(optionalTestSpecificOptions, *additionalEnv)
    660660    unless $hostOS == "darwin"
    661661        skip
     
    663663    end
    664664    options = BASE_OPTIONS + $testSpecificRequiredOptions + FTL_OPTIONS + optionalTestSpecificOptions
    665     addRunCommand("bytecode-cache", ["sh", (pathToHelpers + "bytecode-cache-test-helper.sh").to_s, pathToVM.to_s, $benchmark.to_s] + options, silentOutputHandler, simpleErrorHandler)
     665    addRunCommand("bytecode-cache", ["sh", (pathToHelpers + "bytecode-cache-test-helper.sh").to_s, pathToVM.to_s, $benchmark.to_s] + options, silentOutputHandler, simpleErrorHandler, *additionalEnv)
     666end
     667
     668def runBytecodeCache(*optionalTestSpecificOptions)
     669    runBytecodeCacheImpl(optionalTestSpecificOptions)
     670end
     671
     672def runBytecodeCacheNoAssertion(*optionalTestSpecificOptions)
     673    runBytecodeCacheImpl(optionalTestSpecificOptions, "JSC_forceDiskCache=false")
    666674end
    667675
Note: See TracChangeset for help on using the changeset viewer.