[webkit-reviews] review granted: [Bug 207616] [JSC] Compact StructureTransitionTable : [Attachment 390496] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Feb 12 11:09:33 PST 2020
Mark Lam <mark.lam at apple.com> has granted Yusuke Suzuki <ysuzuki at apple.com>'s
request for review:
Bug 207616: [JSC] Compact StructureTransitionTable
https://bugs.webkit.org/show_bug.cgi?id=207616
Attachment 390496: Patch
https://bugs.webkit.org/attachment.cgi?id=390496&action=review
--- Comment #4 from Mark Lam <mark.lam at apple.com> ---
Comment on attachment 390496
--> https://bugs.webkit.org/attachment.cgi?id=390496
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=390496&action=review
r=me
> Source/JavaScriptCore/ChangeLog:8
> + Some of StructureTransitionTable are shown as very large HashMap and
we can compact it by enconding key.
/enconding/encoding/
>> Source/JavaScriptCore/runtime/Structure.cpp:130
>> +
map()->set(StructureTransitionTable::Hash::Key(structure->m_transitionPropertyN
ame.get(), +structure->transitionPropertyAttributes(),
!structure->isPropertyDeletionTransition()), structure);
>
> is the + needed on +structure->transitionPropertyAttributes() and if it
isn't, should the comment above be removed? (I was able to build jsc with your
patch but with the + removed.)
I think this + is just accidental and can be removed.
> Source/JavaScriptCore/runtime/StructureTransitionTable.h:149
> + // using Key = std::tuple<UniquedStringImpl*, unsigned, bool>;
Can you make this std::tuple<UniquedStringImpl*, unsigned
transitionPropertyAttributes, bool isAddition> to better document the intended
purpose of those parameters?
> Source/JavaScriptCore/runtime/StructureTransitionTable.h:153
> + static constexpr uintptr_t stringMask = ((1ULL << 48) - 1) &
(~1ULL);
> + static constexpr uintptr_t isAdditionMask = 1ULL;
Let's swap these 2 and change stringMask to be:
static constexpr uintptr_t stringMask = ((1ULL << 48) - 1) &
(~isAdditionMask);
This helps document that the lowest bit is where we store the isAddition flag.
> Source/JavaScriptCore/runtime/StructureTransitionTable.h:160
> + // Higher 16 bits for TransitionPropertyAttributes.
> + // Lower 1 bit for isAddition flag.
/Higher 16 bits for/Highest 16 bits are for/
/Lower 1 bit for/Lowest 1 bit is for/
> Source/JavaScriptCore/runtime/StructureTransitionTable.h:161
> + // Remaiing bits for UniquedStringImpl*.
/Remaiing bits for/Remaining bits are for/
> Source/JavaScriptCore/runtime/StructureTransitionTable.h:192
> + uintptr_t m_encodedData { 0 };
Let's make this private. If needed, make struct Hash a friend.
More information about the webkit-reviews
mailing list