Changeset 246610 in webkit


Ignore:
Timestamp:
Jun 19, 2019 2:29:48 PM (5 years ago)
Author:
Tadeu Zagallo
Message:

Some of the ASSERTs in CachedTypes.cpp should be RELEASE_ASSERTs
https://bugs.webkit.org/show_bug.cgi?id=199030

Reviewed by Mark Lam.

These assertions represent strong assumptions that the cache makes so
it's not safe to keep executing if they fail.

  • runtime/CachedTypes.cpp:

(JSC::Encoder::malloc):
(JSC::Encoder::Page::alignEnd):
(JSC::Decoder::ptrForOffsetFromBase):
(JSC::Decoder::handleForEnvironment const):
(JSC::Decoder::setHandleForEnvironment):
(JSC::CachedPtr::get const):
(JSC::CachedOptional::encode):
(JSC::CachedOptional::decodeAsPtr const): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r246596 r246610  
     12019-06-19  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        Some of the ASSERTs in CachedTypes.cpp should be RELEASE_ASSERTs
     4        https://bugs.webkit.org/show_bug.cgi?id=199030
     5
     6        Reviewed by Mark Lam.
     7
     8        These assertions represent strong assumptions that the cache makes so
     9        it's not safe to keep executing if they fail.
     10
     11        * runtime/CachedTypes.cpp:
     12        (JSC::Encoder::malloc):
     13        (JSC::Encoder::Page::alignEnd):
     14        (JSC::Decoder::ptrForOffsetFromBase):
     15        (JSC::Decoder::handleForEnvironment const):
     16        (JSC::Decoder::setHandleForEnvironment):
     17        (JSC::CachedPtr::get const):
     18        (JSC::CachedOptional::encode):
     19        (JSC::CachedOptional::decodeAsPtr const): Deleted.
     20
    1212019-06-19  Adrian Perez de Castro  <aperez@igalia.com>
    222
  • trunk/Source/JavaScriptCore/runtime/CachedTypes.cpp

    r246490 r246610  
    102102    Allocation malloc(unsigned size)
    103103    {
    104         ASSERT(size);
     104        RELEASE_ASSERT(size);
    105105        ptrdiff_t offset;
    106106        if (m_currentPage->malloc(size, offset))
     
    245245            if (size == m_offset)
    246246                return;
    247             ASSERT(static_cast<size_t>(size) <= m_capacity);
     247            RELEASE_ASSERT(static_cast<size_t>(size) <= m_capacity);
    248248            m_offset = size;
    249249        }
     
    324324const void* Decoder::ptrForOffsetFromBase(ptrdiff_t offset)
    325325{
    326 #ifndef NDEBUG
    327326    ASSERT(offset > 0 && static_cast<size_t>(offset) < m_cachedBytecode->size());
    328 #endif
    329327    return m_cachedBytecode->data() + offset;
    330328}
     
    333331{
    334332    auto it = m_environmentToHandleMap.find(environment);
    335     ASSERT(it != m_environmentToHandleMap.end());
     333    RELEASE_ASSERT(it != m_environmentToHandleMap.end());
    336334    return it->value;
    337335}
     
    340338{
    341339    auto addResult = m_environmentToHandleMap.add(environment, handle);
    342     ASSERT_UNUSED(addResult, addResult.isNewEntry);
     340    RELEASE_ASSERT(addResult.isNewEntry);
    343341}
    344342
     
    526524    const T* get() const
    527525    {
    528         if (this->isEmpty())
    529             return nullptr;
     526        RELEASE_ASSERT(!this->isEmpty());
    530527        return this->template buffer<T>();
    531528    }
     
    824821        else
    825822            encode(encoder, { *source });
    826     }
    827 
    828     SourceType<T>* decodeAsPtr(Decoder& decoder) const
    829     {
    830         if (this->isEmpty())
    831             return nullptr;
    832 
    833         return this->template buffer<T>()->decode(decoder);
    834823    }
    835824};
Note: See TracChangeset for help on using the changeset viewer.