Bug 197910

Summary: [JSC] UnlinkedMetadataTable's offset table should be small
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 197940    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch saam: review+

Yusuke Suzuki
Reported 2019-05-15 02:31:00 PDT
Each one takes 208 bytes for now.
Attachments
Patch (21.31 KB, patch)
2019-05-17 19:31 PDT, Yusuke Suzuki
no flags
Patch (23.24 KB, patch)
2019-05-17 21:45 PDT, Yusuke Suzuki
no flags
Patch (26.50 KB, patch)
2019-05-18 03:03 PDT, Yusuke Suzuki
no flags
Patch (26.13 KB, patch)
2019-05-18 03:10 PDT, Yusuke Suzuki
saam: review+
Yusuke Suzuki
Comment 1 2019-05-17 19:31:23 PDT
Created attachment 370177 [details] Patch WIP
Yusuke Suzuki
Comment 2 2019-05-17 21:45:57 PDT
Created attachment 370185 [details] Patch WIP
Yusuke Suzuki
Comment 3 2019-05-18 00:49:05 PDT
16bit thing can cover almost all the thing. But 8bit version cannot cover things even if we leverage 4byte alignment. So, we should use 16bit offset table.
Yusuke Suzuki
Comment 4 2019-05-18 03:03:29 PDT
Yusuke Suzuki
Comment 5 2019-05-18 03:10:05 PDT
Tadeu Zagallo
Comment 6 2019-05-18 04:02:44 PDT
This looks great! I wonder what percentage of the UnlinkedMetadataTables in gmail fit in the 16-bit offset table.
Yusuke Suzuki
Comment 7 2019-05-18 16:33:57 PDT
(In reply to Tadeu Zagallo from comment #6) > This looks great! I wonder what percentage of the UnlinkedMetadataTables in > gmail fit in the 16-bit offset table. I don't remember the exact number of that, but when I logged the 32bit UnlinkedMetadataTable in Gmail to see it is actually used and works, it is < 100, super limited. So, it is less than 0.4% of all the UnlinkedMetadataTable in Gmail :)
Yusuke Suzuki
Comment 8 2019-05-18 18:47:48 PDT
(In reply to Yusuke Suzuki from comment #7) > (In reply to Tadeu Zagallo from comment #6) > > This looks great! I wonder what percentage of the UnlinkedMetadataTables in > > gmail fit in the 16-bit offset table. > > I don't remember the exact number of that, but when I logged the 32bit > UnlinkedMetadataTable in Gmail to see it is actually used and works, it is < > 100, super limited. So, it is less than 0.4% of all the > UnlinkedMetadataTable in Gmail :) On the other hand, 8bit version does not cover the existing MetadataTable well. When I inserted the log, it seems sooooo many MetadataTable in Gmail exceeds 1024 bytes (log does not stop...) => even if we use 4byte alignment information, this exceeds 8bit range. This makes me decide picking 16bit offset table here.
Saam Barati
Comment 9 2019-05-22 13:54:31 PDT
Comment on attachment 370190 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=370190&action=review r=me > Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.cpp:61 > + offset = roundUpToMultipleOf(metadataAlignment(static_cast<OpcodeID>(i)), offset); maybe also ASSERT metadataAlignment <= s_maxMetadataAlignment? > Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.cpp:69 > + if (m_is32Bit) { Please make sure we have tests for this code in our regression test suite. > Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.h:106 > + Offset16* offsetTable16() const { return bitwise_cast<Offset16*>(m_rawBuffer + sizeof(LinkingData)); } nit: ASSERT(!m_is32bit)? > Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.h:107 > + Offset32* offsetTable32() const { return bitwise_cast<Offset32*>(m_rawBuffer + sizeof(LinkingData) + s_offset16TableSize); } nit: ASSERT(m_is32bit)? > Source/JavaScriptCore/llint/LowLevelInterpreter.asm:185 > +const MetadataOffsetTable16 = 0 > +const MetadataOffsetTable32 = constexpr UnlinkedMetadataTable::s_offset16TableSize I think these names should have "Offset" at the end of them.
Yusuke Suzuki
Comment 10 2019-05-22 17:07:17 PDT
Comment on attachment 370190 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=370190&action=review Thanks! >> Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.cpp:61 >> + offset = roundUpToMultipleOf(metadataAlignment(static_cast<OpcodeID>(i)), offset); > > maybe also ASSERT metadataAlignment <= s_maxMetadataAlignment? Sounds nice. Fixed. >> Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.cpp:69 >> + if (m_is32Bit) { > > Please make sure we have tests for this code in our regression test suite. Thanks, added. >> Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.h:106 >> + Offset16* offsetTable16() const { return bitwise_cast<Offset16*>(m_rawBuffer + sizeof(LinkingData)); } > > nit: ASSERT(!m_is32bit)? Nice, added. >> Source/JavaScriptCore/bytecode/UnlinkedMetadataTable.h:107 >> + Offset32* offsetTable32() const { return bitwise_cast<Offset32*>(m_rawBuffer + sizeof(LinkingData) + s_offset16TableSize); } > > nit: ASSERT(m_is32bit)? Ditto. >> Source/JavaScriptCore/llint/LowLevelInterpreter.asm:185 >> +const MetadataOffsetTable32 = constexpr UnlinkedMetadataTable::s_offset16TableSize > > I think these names should have "Offset" at the end of them. Added. Nice.
Yusuke Suzuki
Comment 11 2019-05-22 18:47:36 PDT
Radar WebKit Bug Importer
Comment 12 2019-05-22 18:48:19 PDT
Note You need to log in before you can comment on or make changes to this bug.