WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
203276
BytecodeIndex should be a proper C++ class
https://bugs.webkit.org/show_bug.cgi?id=203276
Summary
BytecodeIndex should be a proper C++ class
Keith Miller
Reported
2019-10-22 14:48:08 PDT
BytecodeIndex should be a proper C++ class
Attachments
Patch
(333.29 KB, patch)
2019-10-22 15:02 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Patch
(325.78 KB, patch)
2019-10-22 15:07 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Patch
(325.75 KB, patch)
2019-10-22 15:11 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Patch
(325.76 KB, patch)
2019-10-22 15:17 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Patch for landing
(326.28 KB, patch)
2019-10-22 15:55 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Keith Miller
Comment 1
2019-10-22 15:02:07 PDT
Created
attachment 381615
[details]
Patch
Keith Miller
Comment 2
2019-10-22 15:07:25 PDT
Created
attachment 381616
[details]
Patch
Keith Miller
Comment 3
2019-10-22 15:11:11 PDT
Created
attachment 381617
[details]
Patch
Keith Miller
Comment 4
2019-10-22 15:17:04 PDT
Created
attachment 381618
[details]
Patch
Mark Lam
Comment 5
2019-10-22 15:40:20 PDT
Comment on
attachment 381618
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=381618&action=review
r=me with fixes.
> Source/JavaScriptCore/bytecode/BytecodeIndex.h:53 > + explicit operator bool() const { return m_offset != std::numeric_limits<uint32_t>::max(); }
Can you use a "static constexpr InvalidOffset = std::numeric_limits<uint32_t>::max();" and use InvalidOffset here instead? I think it will read better.
> Source/JavaScriptCore/bytecode/BytecodeIndex.h:66 > + uint32_t m_offset { std::numeric_limits<uint32_t>::max() };
Ditto. Use InvalidOffset here.
> Source/JavaScriptCore/bytecode/InstructionStream.h:80 > + inline Offset offset() const { return m_index; }
Rename m_index to m_offset? This cross-mixed naming is going to be a source of confusion. You can do this in a follow up patch.
> Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h:48 > - : m_bytecodeOffset(0) // 0 = empty value > + : m_bytecodeIndex(0) // 0 = empty value > , m_operand(VirtualRegister()) // not a valid operand index in our current scheme > { > } > > LazyOperandValueProfileKey(WTF::HashTableDeletedValueType) > - : m_bytecodeOffset(1) // 1 = deleted value > + : m_bytecodeIndex(1) // 1 = deleted value
These feels like they deserve a comment as to why you can't use the default empty and deleted value instead of 0 and 1. I presume the default values will cause problems? The comment will prevent someone naive (like myself) coming along in the future and changing them thus.
> Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp:55 > + RELEASE_ASSERT(bytecodeIndex.offset());
Shouldn't this be RELEASE_ASSERT(bytecodeIndex)?
Keith Miller
Comment 6
2019-10-22 15:55:59 PDT
Created
attachment 381622
[details]
Patch for landing
Keith Miller
Comment 7
2019-10-22 15:56:21 PDT
Comment on
attachment 381618
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=381618&action=review
>> Source/JavaScriptCore/bytecode/BytecodeIndex.h:53 >> + explicit operator bool() const { return m_offset != std::numeric_limits<uint32_t>::max(); } > > Can you use a "static constexpr InvalidOffset = std::numeric_limits<uint32_t>::max();" and use InvalidOffset here instead? I think it will read better.
Done.
>> Source/JavaScriptCore/bytecode/InstructionStream.h:80 >> + inline Offset offset() const { return m_index; } > > Rename m_index to m_offset? This cross-mixed naming is going to be a source of confusion. You can do this in a follow up patch.
Sure.
>> Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h:48 >> + : m_bytecodeIndex(1) // 1 = deleted value > > These feels like they deserve a comment as to why you can't use the default empty and deleted value instead of 0 and 1. I presume the default values will cause problems? The comment will prevent someone naive (like myself) coming along in the future and changing them thus.
I think I just left it because that's how it was before. I don't think it will cause any problems. I can change it.
>> Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp:55 >> + RELEASE_ASSERT(bytecodeIndex.offset()); > > Shouldn't this be RELEASE_ASSERT(bytecodeIndex)?
No, the old line above now covers the != UINT_MAX case. This covers the bytecodeIndex.offset() == 0 case.
Mark Lam
Comment 8
2019-10-22 15:59:35 PDT
Comment on
attachment 381618
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=381618&action=review
>>> Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp:55 >>> + RELEASE_ASSERT(bytecodeIndex.offset()); >> >> Shouldn't this be RELEASE_ASSERT(bytecodeIndex)? > > No, the old line above now covers the != UINT_MAX case. This covers the bytecodeIndex.offset() == 0 case.
Oh, I see.
Keith Miller
Comment 9
2019-10-22 17:55:45 PDT
Committed
r251468
: <
https://trac.webkit.org/changeset/251468
>
Radar WebKit Bug Importer
Comment 10
2019-10-22 17:56:21 PDT
<
rdar://problem/56523782
>
Yusuke Suzuki
Comment 11
2019-10-22 20:06:34 PDT
Committed
r251471
: <
https://trac.webkit.org/changeset/251471
>
Keith Miller
Comment 12
2019-10-22 20:10:38 PDT
(In reply to Yusuke Suzuki from
comment #11
)
> Committed
r251471
: <
https://trac.webkit.org/changeset/251471
>
Ah, thanks. Unfortunately, the WinCairo EWS wasn't working.
Yusuke Suzuki
Comment 13
2019-10-22 20:14:27 PDT
(In reply to Keith Miller from
comment #12
)
> (In reply to Yusuke Suzuki from
comment #11
) > > Committed
r251471
: <
https://trac.webkit.org/changeset/251471
> > > Ah, thanks. Unfortunately, the WinCairo EWS wasn't working.
And, maybe, we also need to update 32bit things (but EWS is not working, sad :(). 32bit had different implementation of CallSiteIndex. We should remove this difference I think.
Jonathan Bedard
Comment 14
2019-10-24 07:40:52 PDT
Just an FYI, this change broke a bunch of our Windows testers, Zan fixed it in <
https://trac.webkit.org/changeset/251534
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug