Unreviewed, rolling out r209766.
[WebKit.git] / Source / JavaScriptCore / heap / HeapSnapshot.cpp
index 3bcf22a..34db12c 100644 (file)
@@ -121,14 +121,16 @@ void HeapSnapshot::finalize()
     for (auto& node : m_nodes) {
         ASSERT(node.cell);
         ASSERT(!(reinterpret_cast<intptr_t>(node.cell) & CellToSweepTag));
-        if (previousCell)
+        if (node.cell == previousCell) {
+            dataLog("Seeing same cell twice: ", RawPointer(previousCell), "\n");
             ASSERT(node.cell != previousCell);
+        }
         previousCell = node.cell;
     }
 #endif
 }
 
-Optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell)
+std::optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell)
 {
     ASSERT(m_finalized);
 
@@ -140,7 +142,7 @@ Optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell)
             unsigned middle = start + ((end - start) / 2);
             HeapSnapshotNode& node = m_nodes[middle];
             if (cell == node.cell)
-                return Optional<HeapSnapshotNode>(node);
+                return std::optional<HeapSnapshotNode>(node);
             if (cell < node.cell)
                 end = middle;
             else
@@ -151,32 +153,32 @@ Optional<HeapSnapshotNode> HeapSnapshot::nodeForCell(JSCell* cell)
     if (m_previous)
         return m_previous->nodeForCell(cell);
 
-    return Nullopt;
+    return std::nullopt;
 }
 
-Optional<HeapSnapshotNode> HeapSnapshot::nodeForObjectIdentifier(unsigned objectIdentifier)
+std::optional<HeapSnapshotNode> HeapSnapshot::nodeForObjectIdentifier(unsigned objectIdentifier)
 {
     if (isEmpty()) {
         if (m_previous)
             return m_previous->nodeForObjectIdentifier(objectIdentifier);
-        return Nullopt;
+        return std::nullopt;
     }
 
     if (objectIdentifier > m_lastObjectIdentifier)
-        return Nullopt;
+        return std::nullopt;
 
     if (objectIdentifier < m_firstObjectIdentifier) {
         if (m_previous)
             return m_previous->nodeForObjectIdentifier(objectIdentifier);
-        return Nullopt;
+        return std::nullopt;
     }
 
     for (auto& node : m_nodes) {
         if (node.identifier == objectIdentifier)
-            return Optional<HeapSnapshotNode>(node);
+            return std::optional<HeapSnapshotNode>(node);
     }
 
-    return Nullopt;
+    return std::nullopt;
 }
 
 } // namespace JSC