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

Changeset 286580 in webkit


Ignore:
Timestamp:
Dec 6, 2021, 5:13:33 PM (5 years ago)
Author:
keith_miller@apple.com
Message:

TypeInfo should be materializable from Structures as a single load.
https://bugs.webkit.org/show_bug.cgi?id=233875

Reviewed by Mark Lam.

This is mostly just the members of Structure and JSCell so that
JSType and InlineTypeFlags are at the end of the JSCell header.

  • assembler/testmasm.cpp:

(JSC::testBranchIfType):
(JSC::testBranchIfNotType):

  • ftl/FTLAbstractHeapRepository.cpp:

(JSC::FTL::AbstractHeapRepository::AbstractHeapRepository):

  • runtime/JSCell.h:
  • runtime/JSCellInlines.h:

(JSC::JSCell::JSCell):

  • runtime/Structure.h:

(JSC::Structure::typeInfo const):

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r286572 r286580  
     12021-12-06  Keith Miller  <keith_miller@apple.com>
     2
     3        TypeInfo should be materializable from Structures as a single load.
     4        https://bugs.webkit.org/show_bug.cgi?id=233875
     5
     6        Reviewed by Mark Lam.
     7
     8        This is mostly just the members of Structure and JSCell so that
     9        JSType and InlineTypeFlags are at the end of the JSCell header.
     10
     11        * assembler/testmasm.cpp:
     12        (JSC::testBranchIfType):
     13        (JSC::testBranchIfNotType):
     14        * ftl/FTLAbstractHeapRepository.cpp:
     15        (JSC::FTL::AbstractHeapRepository::AbstractHeapRepository):
     16        * runtime/JSCell.h:
     17        * runtime/JSCellInlines.h:
     18        (JSC::JSCell::JSCell):
     19        * runtime/Structure.h:
     20        (JSC::Structure::typeInfo const):
     21
    1222021-12-06  Mark Lam  <mark.lam@apple.com>
    223
  • trunk/Source/JavaScriptCore/assembler/testmasm.cpp

    r286020 r286580  
    56145614        uint32_t structureID;
    56155615        uint8_t indexingType;
     5616        uint8_t cellState;
    56165617        JSType type;
    56175618    };
     
    56485649        uint32_t structureID;
    56495650        uint8_t indexingType;
     5651        uint8_t cellState;
    56505652        JSType type;
    56515653    };
  • trunk/Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp

    r262338 r286580  
    7979    // Make sure that our explicit assumptions about the StructureIDBlob match reality.
    8080    RELEASE_ASSERT(!(JSCell_indexingTypeAndMisc.offset() & (sizeof(int32_t) - 1)));
    81     RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 1 == JSCell_typeInfoType.offset());
    82     RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 2 == JSCell_typeInfoFlags.offset());
    83     RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 3 == JSCell_cellState.offset());
     81    RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 1 == JSCell_cellState.offset());
     82    RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 2 == JSCell_typeInfoType.offset());
     83    RELEASE_ASSERT(JSCell_indexingTypeAndMisc.offset() + 3 == JSCell_typeInfoFlags.offset());
    8484
    8585    JSCell_structureID.changeParent(&JSCell_header);
  • trunk/Source/JavaScriptCore/runtime/JSCell.h

    r286345 r286580  
    267267    StructureID m_structureID;
    268268    IndexingType m_indexingTypeAndMisc; // DO NOT store to this field. Always CAS.
     269    CellState m_cellState;
    269270    JSType m_type;
    270271    TypeInfo::InlineTypeFlags m_flags;
    271     CellState m_cellState;
    272272};
    273273
  • trunk/Source/JavaScriptCore/runtime/JSCellInlines.h

    r286572 r286580  
    5959    : m_structureID(structure->id())
    6060    , m_indexingTypeAndMisc(structure->indexingModeIncludingHistory())
     61    , m_cellState(CellState::DefinitelyWhite)
    6162    , m_type(structure->typeInfo().type())
    6263    , m_flags(structure->typeInfo().inlineTypeFlags())
    63     , m_cellState(CellState::DefinitelyWhite)
    6464{
    6565    ASSERT(!isCompilationThread());
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r286502 r286580  
    262262   
    263263    // Type accessors.
     264#if CPU(NEEDS_ALIGNED_ACCESS)
    264265    TypeInfo typeInfo() const { return TypeInfo(m_cellHeaderType, m_cellHeaderInlineTypeFlags, m_outOfLineTypeFlags); }
     266#else
     267    TypeInfo typeInfo() const { return *reinterpret_cast_ptr<const TypeInfo*>(&m_cellHeaderType); }
     268#endif
    265269    bool isObject() const { return typeInfo().isObject(); }
    266270protected:
     
    857861    // JSCell.
    858862    IndexingType m_cellHeaderIndexingModeIncludingHistory;
     863    const CellState m_cellHeaderDefaultCellState { CellState::DefinitelyWhite };
    859864    const JSType m_cellHeaderType;
    860865    TypeInfo::InlineTypeFlags m_cellHeaderInlineTypeFlags;
    861     const CellState m_cellHeaderDefaultCellState { CellState::DefinitelyWhite };
    862866    TypeInfo::OutOfLineTypeFlags m_outOfLineTypeFlags;
    863867
Note: See TracChangeset for help on using the changeset viewer.