Title: [286033] trunk/Source/_javascript_Core
Revision
286033
Author
[email protected]
Date
2021-11-18 15:09:07 -0800 (Thu, 18 Nov 2021)

Log Message

CellAttributes should be returned by value.
https://bugs.webkit.org/show_bug.cgi?id=233335
rdar://85568435

Reviewed by Yusuke Suzuki.

CellAttributes fits in 16 bits, and client code never modifies returned CellAttributes
values.  Hence, there is no reason to return them by reference.

Also fixed a bit-rotted comment in SubSpace.h.

* heap/BlockDirectory.h:
(JSC::BlockDirectory::attributes const):
* heap/HeapCellType.h:
(JSC::HeapCellType::attributes const):
* heap/MarkedBlock.h:
(JSC::MarkedBlock::Handle::attributes const):
(JSC::MarkedBlock::attributes const):
* heap/PreciseAllocation.h:
(JSC::PreciseAllocation::attributes const):
* heap/Subspace.h:
* heap/SubspaceInlines.h:
(JSC::Subspace::attributes const):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (286032 => 286033)


--- trunk/Source/_javascript_Core/ChangeLog	2021-11-18 23:01:57 UTC (rev 286032)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-11-18 23:09:07 UTC (rev 286033)
@@ -1,3 +1,29 @@
+2021-11-18  Mark Lam  <[email protected]>
+
+        CellAttributes should be returned by value.
+        https://bugs.webkit.org/show_bug.cgi?id=233335
+        rdar://85568435
+
+        Reviewed by Yusuke Suzuki.
+
+        CellAttributes fits in 16 bits, and client code never modifies returned CellAttributes
+        values.  Hence, there is no reason to return them by reference.
+
+        Also fixed a bit-rotted comment in SubSpace.h.
+
+        * heap/BlockDirectory.h:
+        (JSC::BlockDirectory::attributes const):
+        * heap/HeapCellType.h:
+        (JSC::HeapCellType::attributes const):
+        * heap/MarkedBlock.h:
+        (JSC::MarkedBlock::Handle::attributes const):
+        (JSC::MarkedBlock::attributes const):
+        * heap/PreciseAllocation.h:
+        (JSC::PreciseAllocation::attributes const):
+        * heap/Subspace.h:
+        * heap/SubspaceInlines.h:
+        (JSC::Subspace::attributes const):
+
 2021-11-18  Robin Morisset  <[email protected]>
 
         DFGByteCodeParser.cpp should avoid resizing the Operands<> of every BasicBlock on every inlining

Modified: trunk/Source/_javascript_Core/heap/BlockDirectory.h (286032 => 286033)


--- trunk/Source/_javascript_Core/heap/BlockDirectory.h	2021-11-18 23:01:57 UTC (rev 286032)
+++ trunk/Source/_javascript_Core/heap/BlockDirectory.h	2021-11-18 23:09:07 UTC (rev 286033)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -74,7 +74,7 @@
     void shrink();
     void assertNoUnswept();
     size_t cellSize() const { return m_cellSize; }
-    const CellAttributes& attributes() const { return m_attributes; }
+    const CellAttributes attributes() const { return m_attributes; }
     bool needsDestruction() const { return m_attributes.destruction == NeedsDestruction; }
     DestructionMode destruction() const { return m_attributes.destruction; }
     HeapCell::Kind cellKind() const { return m_attributes.cellKind; }

Modified: trunk/Source/_javascript_Core/heap/HeapCellType.h (286032 => 286033)


--- trunk/Source/_javascript_Core/heap/HeapCellType.h	2021-11-18 23:01:57 UTC (rev 286032)
+++ trunk/Source/_javascript_Core/heap/HeapCellType.h	2021-11-18 23:09:07 UTC (rev 286033)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,7 +36,7 @@
     JS_EXPORT_PRIVATE HeapCellType(CellAttributes);
     JS_EXPORT_PRIVATE virtual ~HeapCellType();
 
-    const CellAttributes& attributes() const { return m_attributes; }
+    const CellAttributes attributes() const { return m_attributes; }
 
     // The purpose of overriding this is to specialize the sweep for your destructors. This won't
     // be called for no-destructor blocks. This must call MarkedBlock::finishSweepKnowingSubspace.

Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.h (286032 => 286033)


--- trunk/Source/_javascript_Core/heap/MarkedBlock.h	2021-11-18 23:01:57 UTC (rev 286032)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.h	2021-11-18 23:09:07 UTC (rev 286033)
@@ -161,7 +161,7 @@
         size_t cellSize();
         inline unsigned cellsPerBlock();
         
-        const CellAttributes& attributes() const;
+        const CellAttributes attributes() const;
         DestructionMode destruction() const;
         bool needsDestruction() const;
         HeapCell::Kind cellKind() const;
@@ -347,7 +347,7 @@
     void resetAllocated();
         
     size_t cellSize();
-    const CellAttributes& attributes() const;
+    const CellAttributes attributes() const;
     
     bool hasAnyMarked() const;
     void noteMarked();
@@ -511,12 +511,12 @@
     return handle().cellSize();
 }
 
-inline const CellAttributes& MarkedBlock::Handle::attributes() const
+inline const CellAttributes MarkedBlock::Handle::attributes() const
 {
     return m_attributes;
 }
 
-inline const CellAttributes& MarkedBlock::attributes() const
+inline const CellAttributes MarkedBlock::attributes() const
 {
     return handle().attributes();
 }

Modified: trunk/Source/_javascript_Core/heap/PreciseAllocation.h (286032 => 286033)


--- trunk/Source/_javascript_Core/heap/PreciseAllocation.h	2021-11-18 23:01:57 UTC (rev 286032)
+++ trunk/Source/_javascript_Core/heap/PreciseAllocation.h	2021-11-18 23:09:07 UTC (rev 286033)
@@ -121,7 +121,7 @@
         return aboveLowerBound(rawPtr) && belowUpperBound(rawPtr);
     }
     
-    const CellAttributes& attributes() const { return m_attributes; }
+    const CellAttributes attributes() const { return m_attributes; }
     
     Dependency aboutToMark(HeapVersion) { return Dependency(); }
     

Modified: trunk/Source/_javascript_Core/heap/Subspace.h (286032 => 286033)


--- trunk/Source/_javascript_Core/heap/Subspace.h	2021-11-18 23:01:57 UTC (rev 286032)
+++ trunk/Source/_javascript_Core/heap/Subspace.h	2021-11-18 23:09:07 UTC (rev 286033)
@@ -39,7 +39,7 @@
 
 // The idea of subspaces is that you can provide some custom behavior for your objects if you
 // allocate them from a custom Subspace in which you override some of the virtual methods. This
-// class is the baseclass of Subspaces. Usually you will use either Subspace or FixedSizeSubspace.
+// class is the baseclass of all subspaces e.g. CompleteSubspace, IsoSubspace.
 class Subspace {
     WTF_MAKE_NONCOPYABLE(Subspace);
     WTF_MAKE_FAST_ALLOCATED;
@@ -50,7 +50,7 @@
     const char* name() const { return m_name.data(); }
     MarkedSpace& space() const { return m_space; }
     
-    const CellAttributes& attributes() const;
+    const CellAttributes attributes() const;
     HeapCellType* heapCellType() const { return m_heapCellType; }
     AlignedMemoryAllocator* alignedMemoryAllocator() const { return m_alignedMemoryAllocator; }
     

Modified: trunk/Source/_javascript_Core/heap/SubspaceInlines.h (286032 => 286033)


--- trunk/Source/_javascript_Core/heap/SubspaceInlines.h	2021-11-18 23:01:57 UTC (rev 286032)
+++ trunk/Source/_javascript_Core/heap/SubspaceInlines.h	2021-11-18 23:09:07 UTC (rev 286033)
@@ -152,7 +152,7 @@
         });
 }
 
-inline const CellAttributes& Subspace::attributes() const
+inline const CellAttributes Subspace::attributes() const
 {
     return m_heapCellType->attributes();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to