WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
231436
SourceID should have a type name and only be 32-bits
https://bugs.webkit.org/show_bug.cgi?id=231436
Summary
SourceID should have a type name and only be 32-bits
Keith Miller
Reported
2021-10-08 09:02:22 PDT
SourceID should have a type name and only be 32-bits
Attachments
Patch
(28.66 KB, patch)
2021-10-08 09:05 PDT
,
Keith Miller
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(35.92 KB, patch)
2021-10-08 10:25 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Patch for landing
(40.47 KB, patch)
2021-10-11 07:17 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Patch for landing
(40.55 KB, patch)
2021-10-11 07:18 PDT
,
Keith Miller
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing
(42.23 KB, patch)
2021-10-11 07:34 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Patch for landing
(42.24 KB, patch)
2021-10-11 08:32 PDT
,
Keith Miller
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Keith Miller
Comment 1
2021-10-08 09:05:17 PDT
Created
attachment 440627
[details]
Patch
Keith Miller
Comment 2
2021-10-08 10:25:58 PDT
Created
attachment 440637
[details]
Patch
Mark Lam
Comment 3
2021-10-08 10:54:02 PDT
Comment on
attachment 440637
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=440637&action=review
r=me also with fix.
> Source/JavaScriptCore/debugger/DebuggerPrimitives.h:33 > -using SourceID = size_t; > +using SourceID = uint32_t; > constexpr SourceID noSourceID = 0;
Can we put these in a SourceID.h or perhaps an ID.h if we want to put other IDs (like the BreakpointID and BreakpointActionID below) in it as well? Looks like we need this declaration / definition in more than 1 place. It's best to have one source of truth instead of having code duplication.
> Source/JavaScriptCore/interpreter/StackVisitor.h:49 > +using SourceID = uint32_t;
nit: code duplication like this is error prone. Can we #include a SourceID.h instead?
> Source/JavaScriptCore/parser/SourceCode.h:35 > +using SourceID = uint32_t;
Duplication again.
> Source/JavaScriptCore/parser/SourceCode.h:37 > +class SourceCode : public UnlinkedSourceCode {
I presume the only change for this code is just the un-indent + main providerID() return SourceID.
> Source/JavaScriptCore/parser/SourceProvider.h:51 > + using SourceID = uint32_t;
Again!
> Source/JavaScriptCore/runtime/FunctionHasExecutedCache.h:34 > +using SourceID = uint32_t;
Ditto.
Keith Miller
Comment 4
2021-10-08 11:43:02 PDT
Comment on
attachment 440637
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=440637&action=review
m
>> Source/JavaScriptCore/debugger/DebuggerPrimitives.h:33 >> constexpr SourceID noSourceID = 0; > > Can we put these in a SourceID.h or perhaps an ID.h if we want to put other IDs (like the BreakpointID and BreakpointActionID below) in it as well? Looks like we need this declaration / definition in more than 1 place. It's best to have one source of truth instead of having code duplication.
Yeah, I can put it in the new Forward.h at least until it becomes a real class or something. On the other hand, I don't think it's as error prone as you think as non-equilevent definitions are a compiler error.
>> Source/JavaScriptCore/parser/SourceCode.h:37 >> +class SourceCode : public UnlinkedSourceCode { > > I presume the only change for this code is just the un-indent + main providerID() return SourceID.
Yeah, I'm so used to classes being on the first line I get confused these days so I've started un-indenting them in clean up patches. I'll add a note to the changelog too.
Keith Miller
Comment 5
2021-10-11 07:17:40 PDT
Created
attachment 440785
[details]
Patch for landing
Keith Miller
Comment 6
2021-10-11 07:18:43 PDT
Created
attachment 440786
[details]
Patch for landing
Keith Miller
Comment 7
2021-10-11 07:34:58 PDT
Created
attachment 440791
[details]
Patch for landing
EWS
Comment 8
2021-10-11 08:01:30 PDT
Patch 440786 does not build
Keith Miller
Comment 9
2021-10-11 08:32:33 PDT
Created
attachment 440797
[details]
Patch for landing
EWS
Comment 10
2021-10-11 09:58:47 PDT
Committed
r283903
(
242778@main
): <
https://commits.webkit.org/242778@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 440797
[details]
.
Radar WebKit Bug Importer
Comment 11
2021-10-11 09:59:23 PDT
<
rdar://problem/84103788
>
Darin Adler
Comment 12
2021-10-11 13:10:05 PDT
Comment on
attachment 440797
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=440797&action=review
> Source/JavaScriptCore/runtime/TypeProfiler.h:61 > + : m_sourceID(UINT_MAX)
This seems to defeat the purpose of using a named type. I would have suggested std::numeric_limits<SourceID>::max().
> Source/JavaScriptCore/runtime/TypeProfiler.h:70 > - return m_sourceID == INTPTR_MAX > + return m_sourceID == UINT_MAX > && m_divot == UINT_MAX > && m_searchDescriptor == TypeProfilerSearchDescriptorFunctionReturn;
Seems like this could check just m_sourceID; no reason to check the other two.
Keith Miller
Comment 13
2021-10-18 10:29:04 PDT
Comment on
attachment 440797
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=440797&action=review
>> Source/JavaScriptCore/runtime/TypeProfiler.h:61 >> + : m_sourceID(UINT_MAX) > > This seems to defeat the purpose of using a named type. I would have suggested std::numeric_limits<SourceID>::max().
Fair enough. Do you think it's worth making a new patch for this?
>> Source/JavaScriptCore/runtime/TypeProfiler.h:70 >> && m_searchDescriptor == TypeProfilerSearchDescriptorFunctionReturn; > > Seems like this could check just m_sourceID; no reason to check the other two.
Yeah, I agree. I just refactored the existing code without thinking too hard...
Darin Adler
Comment 14
2021-10-18 10:59:10 PDT
Comment on
attachment 440797
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=440797&action=review
>>> Source/JavaScriptCore/runtime/TypeProfiler.h:61 >>> + : m_sourceID(UINT_MAX) >> >> This seems to defeat the purpose of using a named type. I would have suggested std::numeric_limits<SourceID>::max(). > > Fair enough. Do you think it's worth making a new patch for this?
Sorry, I don’t understand the uestion.
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