Changeset 233893 in webkit


Ignore:
Timestamp:
Jul 17, 2018 1:20:21 PM (6 years ago)
Author:
mark.lam@apple.com
Message:

CodeBlock::baselineVersion() should account for executables with purged codeBlocks.
https://bugs.webkit.org/show_bug.cgi?id=187736
<rdar://problem/42114371>

Reviewed by Michael Saboff.

CodeBlock::baselineVersion() currently checks for a null replacement but does not
account for the fact that that the replacement can also be null due to the
executable having being purged of its codeBlocks due to a memory event (see
ExecutableBase::clearCode()). This patch adds code to account for this.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::baselineVersion):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r233862 r233893  
     12018-07-17  Mark Lam  <mark.lam@apple.com>
     2
     3        CodeBlock::baselineVersion() should account for executables with purged codeBlocks.
     4        https://bugs.webkit.org/show_bug.cgi?id=187736
     5        <rdar://problem/42114371>
     6
     7        Reviewed by Michael Saboff.
     8
     9        CodeBlock::baselineVersion() currently checks for a null replacement but does not
     10        account for the fact that that the replacement can also be null due to the
     11        executable having being purged of its codeBlocks due to a memory event (see
     12        ExecutableBase::clearCode()).  This patch adds code to account for this.
     13
     14        * bytecode/CodeBlock.cpp:
     15        (JSC::CodeBlock::baselineVersion):
     16
    1172018-07-16  Yusuke Suzuki  <utatane.tea@gmail.com>
    218
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r233772 r233893  
    16381638{
    16391639#if ENABLE(JIT)
    1640     if (JITCode::isBaselineCode(jitType()))
     1640    JITCode::JITType selfJITType = jitType();
     1641    if (JITCode::isBaselineCode(selfJITType))
    16411642        return this;
    16421643    CodeBlock* result = replacement();
    16431644    if (!result) {
    1644         // This can happen if we're creating the original CodeBlock for an executable.
    1645         // Assume that we're the baseline CodeBlock.
    1646         RELEASE_ASSERT(jitType() == JITCode::None);
    1647         return this;
     1645        if (JITCode::isOptimizingJIT(selfJITType)) {
     1646            // The replacement can be null if we've had a memory clean up and the executable
     1647            // has been purged of its codeBlocks (see ExecutableBase::clearCode()). Regardless,
     1648            // the current codeBlock is still live on the stack, and as an optimizing JIT
     1649            // codeBlock, it will keep its baselineAlternative() alive for us to fetch below.
     1650            result = this;
     1651        } else {
     1652            // This can happen if we're creating the original CodeBlock for an executable.
     1653            // Assume that we're the baseline CodeBlock.
     1654            RELEASE_ASSERT(selfJITType == JITCode::None);
     1655            return this;
     1656        }
    16481657    }
    16491658    result = result->baselineAlternative();
     1659    ASSERT(result);
    16501660    return result;
    16511661#else
Note: See TracChangeset for help on using the changeset viewer.