Title: [246610] trunk/Source/_javascript_Core
Revision
246610
Author
[email protected]
Date
2019-06-19 14:29:48 -0700 (Wed, 19 Jun 2019)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (246609 => 246610)


--- trunk/Source/_javascript_Core/ChangeLog	2019-06-19 20:49:07 UTC (rev 246609)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-06-19 21:29:48 UTC (rev 246610)
@@ -1,3 +1,23 @@
+2019-06-19  Tadeu Zagallo  <[email protected]>
+
+        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.
+
 2019-06-19  Adrian Perez de Castro  <[email protected]>
 
         [WPE][GTK] Fix build with unified sources disabled

Modified: trunk/Source/_javascript_Core/runtime/CachedTypes.cpp (246609 => 246610)


--- trunk/Source/_javascript_Core/runtime/CachedTypes.cpp	2019-06-19 20:49:07 UTC (rev 246609)
+++ trunk/Source/_javascript_Core/runtime/CachedTypes.cpp	2019-06-19 21:29:48 UTC (rev 246610)
@@ -101,7 +101,7 @@
 
     Allocation malloc(unsigned size)
     {
-        ASSERT(size);
+        RELEASE_ASSERT(size);
         ptrdiff_t offset;
         if (m_currentPage->malloc(size, offset))
             return Allocation { m_currentPage->buffer() + offset, m_baseOffset + offset };
@@ -244,7 +244,7 @@
             ptrdiff_t size = roundUpToMultipleOf(alignof(std::max_align_t), m_offset);
             if (size == m_offset)
                 return;
-            ASSERT(static_cast<size_t>(size) <= m_capacity);
+            RELEASE_ASSERT(static_cast<size_t>(size) <= m_capacity);
             m_offset = size;
         }
 
@@ -323,9 +323,7 @@
 
 const void* Decoder::ptrForOffsetFromBase(ptrdiff_t offset)
 {
-#ifndef NDEBUG
     ASSERT(offset > 0 && static_cast<size_t>(offset) < m_cachedBytecode->size());
-#endif
     return m_cachedBytecode->data() + offset;
 }
 
@@ -332,7 +330,7 @@
 CompactVariableMap::Handle Decoder::handleForEnvironment(CompactVariableEnvironment* environment) const
 {
     auto it = m_environmentToHandleMap.find(environment);
-    ASSERT(it != m_environmentToHandleMap.end());
+    RELEASE_ASSERT(it != m_environmentToHandleMap.end());
     return it->value;
 }
 
@@ -339,7 +337,7 @@
 void Decoder::setHandleForEnvironment(CompactVariableEnvironment* environment, const CompactVariableMap::Handle& handle)
 {
     auto addResult = m_environmentToHandleMap.add(environment, handle);
-    ASSERT_UNUSED(addResult, addResult.isNewEntry);
+    RELEASE_ASSERT(addResult.isNewEntry);
 }
 
 void Decoder::addLeafExecutable(const UnlinkedFunctionExecutable* executable, ptrdiff_t offset)
@@ -525,8 +523,7 @@
 private:
     const T* get() const
     {
-        if (this->isEmpty())
-            return nullptr;
+        RELEASE_ASSERT(!this->isEmpty());
         return this->template buffer<T>();
     }
 };
@@ -824,14 +821,6 @@
         else
             encode(encoder, { *source });
     }
-
-    SourceType<T>* decodeAsPtr(Decoder& decoder) const
-    {
-        if (this->isEmpty())
-            return nullptr;
-
-        return this->template buffer<T>()->decode(decoder);
-    }
 };
 
 class CachedSimpleJumpTable : public CachedObject<UnlinkedSimpleJumpTable> {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to