WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
195498
[JSC] Reduce # of structures in JSGlobalObject initialization
https://bugs.webkit.org/show_bug.cgi?id=195498
Summary
[JSC] Reduce # of structures in JSGlobalObject initialization
Yusuke Suzuki
Reported
2019-03-08 17:09:51 PST
[JSC] Reduce # of structures in JSGlobalObject initialization
Attachments
Patch
(39.03 KB, patch)
2019-03-08 17:20 PST
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(39.00 KB, patch)
2019-03-08 17:21 PST
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(39.01 KB, patch)
2019-03-08 18:34 PST
,
Yusuke Suzuki
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2019-03-08 17:20:24 PST
Created
attachment 364095
[details]
Patch
Yusuke Suzuki
Comment 2
2019-03-08 17:21:41 PST
Created
attachment 364096
[details]
Patch
Yusuke Suzuki
Comment 3
2019-03-08 18:34:51 PST
Created
attachment 364106
[details]
Patch
Darin Adler
Comment 4
2019-03-10 13:53:08 PDT
Comment on
attachment 364106
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364106&action=review
I presume there is enough regression test coverage of these things that we have some good confidence we got them all right.
> Source/JavaScriptCore/runtime/ArrayPrototype.cpp:130 > + const Identifier unscopableNames[] = {
There is some reference count churn initializing an array of Identifier. Might be nice to look for an idiom with less wasted work. For example, it would be slightly more efficient to make an array of const Identifier* and then dereference all of them to avoid 9 ref/deref pairs.
> Source/JavaScriptCore/runtime/VM.h:572 > + Structure* setIteratorStructure() > + { > + if (LIKELY(m_setIteratorStructure)) > + return m_setIteratorStructure.get(); > + return setIteratorStructureSlow(); > + }
I prefer an idiom where we don’t have so many multiline function bodies in a class definition. For me they interfere with my ability to use the class definition to get an overview of what’s in the class. The pattern is also easy to avoid by moving inlines function bodies down in the header, outside the class definition, but with the cost of not being able to see immediately what each function does by seeing its implementation. But it seems that VM already has tons of these. So I don’t think more are going to make things worse.
Yusuke Suzuki
Comment 5
2019-03-11 13:55:18 PDT
Comment on
attachment 364106
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=364106&action=review
>> Source/JavaScriptCore/runtime/ArrayPrototype.cpp:130 >> + const Identifier unscopableNames[] = { > > There is some reference count churn initializing an array of Identifier. Might be nice to look for an idiom with less wasted work. For example, it would be slightly more efficient to make an array of const Identifier* and then dereference all of them to avoid 9 ref/deref pairs.
`const Identifier*` sounds better. Fixed.
>> Source/JavaScriptCore/runtime/VM.h:572 >> + } > > I prefer an idiom where we don’t have so many multiline function bodies in a class definition. For me they interfere with my ability to use the class definition to get an overview of what’s in the class. The pattern is also easy to avoid by moving inlines function bodies down in the header, outside the class definition, but with the cost of not being able to see immediately what each function does by seeing its implementation. But it seems that VM already has tons of these. So I don’t think more are going to make things worse.
I leave it as is since (1) as you said, VM already has bunch of inlined functions in class declaration, and (2) it is aligned to the existing lazy allocation methods in VM. I think we can clean up VM at some point.
Yusuke Suzuki
Comment 6
2019-03-11 14:55:05 PDT
Committed
r242742
: <
https://trac.webkit.org/changeset/242742
>
Radar WebKit Bug Importer
Comment 7
2019-03-11 14:56:29 PDT
<
rdar://problem/48784197
>
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