⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286033 in webkit


Ignore:
Timestamp:
Nov 18, 2021, 3:09:07 PM (5 years ago)
Author:
mark.lam@apple.com
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):

Location:
trunk/Source/JavaScriptCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r286030 r286033  
     12021-11-18  Mark Lam  <mark.lam@apple.com>
     2
     3        CellAttributes should be returned by value.
     4        https://bugs.webkit.org/show_bug.cgi?id=233335
     5        rdar://85568435
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        CellAttributes fits in 16 bits, and client code never modifies returned CellAttributes
     10        values.  Hence, there is no reason to return them by reference.
     11
     12        Also fixed a bit-rotted comment in SubSpace.h.
     13
     14        * heap/BlockDirectory.h:
     15        (JSC::BlockDirectory::attributes const):
     16        * heap/HeapCellType.h:
     17        (JSC::HeapCellType::attributes const):
     18        * heap/MarkedBlock.h:
     19        (JSC::MarkedBlock::Handle::attributes const):
     20        (JSC::MarkedBlock::attributes const):
     21        * heap/PreciseAllocation.h:
     22        (JSC::PreciseAllocation::attributes const):
     23        * heap/Subspace.h:
     24        * heap/SubspaceInlines.h:
     25        (JSC::Subspace::attributes const):
     26
    1272021-11-18  Robin Morisset  <rmorisset@apple.com>
    228
  • trunk/Source/JavaScriptCore/heap/BlockDirectory.h

    r278093 r286033  
    11/*
    2  * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7575    void assertNoUnswept();
    7676    size_t cellSize() const { return m_cellSize; }
    77     const CellAttributes& attributes() const { return m_attributes; }
     77    const CellAttributes attributes() const { return m_attributes; }
    7878    bool needsDestruction() const { return m_attributes.destruction == NeedsDestruction; }
    7979    DestructionMode destruction() const { return m_attributes.destruction; }
  • trunk/Source/JavaScriptCore/heap/HeapCellType.h

    r226822 r286033  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3737    JS_EXPORT_PRIVATE virtual ~HeapCellType();
    3838
    39     const CellAttributes& attributes() const { return m_attributes; }
     39    const CellAttributes attributes() const { return m_attributes; }
    4040
    4141    // The purpose of overriding this is to specialize the sweep for your destructors. This won't
  • trunk/Source/JavaScriptCore/heap/MarkedBlock.h

    r280195 r286033  
    162162        inline unsigned cellsPerBlock();
    163163       
    164         const CellAttributes& attributes() const;
     164        const CellAttributes attributes() const;
    165165        DestructionMode destruction() const;
    166166        bool needsDestruction() const;
     
    348348       
    349349    size_t cellSize();
    350     const CellAttributes& attributes() const;
     350    const CellAttributes attributes() const;
    351351   
    352352    bool hasAnyMarked() const;
     
    512512}
    513513
    514 inline const CellAttributes& MarkedBlock::Handle::attributes() const
     514inline const CellAttributes MarkedBlock::Handle::attributes() const
    515515{
    516516    return m_attributes;
    517517}
    518518
    519 inline const CellAttributes& MarkedBlock::attributes() const
     519inline const CellAttributes MarkedBlock::attributes() const
    520520{
    521521    return handle().attributes();
  • trunk/Source/JavaScriptCore/heap/PreciseAllocation.h

    r272825 r286033  
    122122    }
    123123   
    124     const CellAttributes& attributes() const { return m_attributes; }
     124    const CellAttributes attributes() const { return m_attributes; }
    125125   
    126126    Dependency aboutToMark(HeapVersion) { return Dependency(); }
  • trunk/Source/JavaScriptCore/heap/Subspace.h

    r273138 r286033  
    4040// The idea of subspaces is that you can provide some custom behavior for your objects if you
    4141// allocate them from a custom Subspace in which you override some of the virtual methods. This
    42 // class is the baseclass of Subspaces. Usually you will use either Subspace or FixedSizeSubspace.
     42// class is the baseclass of all subspaces e.g. CompleteSubspace, IsoSubspace.
    4343class Subspace {
    4444    WTF_MAKE_NONCOPYABLE(Subspace);
     
    5151    MarkedSpace& space() const { return m_space; }
    5252   
    53     const CellAttributes& attributes() const;
     53    const CellAttributes attributes() const;
    5454    HeapCellType* heapCellType() const { return m_heapCellType; }
    5555    AlignedMemoryAllocator* alignedMemoryAllocator() const { return m_alignedMemoryAllocator; }
  • trunk/Source/JavaScriptCore/heap/SubspaceInlines.h

    r277909 r286033  
    153153}
    154154
    155 inline const CellAttributes& Subspace::attributes() const
     155inline const CellAttributes Subspace::attributes() const
    156156{
    157157    return m_heapCellType->attributes();
Note: See TracChangeset for help on using the changeset viewer.