WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
185695
DFG should inline InstanceOf ICs
https://bugs.webkit.org/show_bug.cgi?id=185695
Summary
DFG should inline InstanceOf ICs
Filip Pizlo
Reported
2018-05-16 13:48:58 PDT
...
Attachments
it begins
(18.87 KB, patch)
2018-05-18 11:09 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
a bit more
(31.52 KB, patch)
2018-05-18 12:04 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
maye it is written
(39.67 KB, patch)
2018-05-18 13:09 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
it did things
(55.60 KB, patch)
2018-05-18 14:50 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
it's a nice speed-up
(63.20 KB, patch)
2018-05-18 15:30 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(63.35 KB, patch)
2018-05-18 15:55 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(63.41 KB, patch)
2018-05-18 16:15 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(63.41 KB, patch)
2018-05-18 16:23 PDT
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(63.98 KB, patch)
2018-05-18 16:41 PDT
,
Filip Pizlo
ysuzuki
: review+
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Filip Pizlo
Comment 1
2018-05-18 11:09:24 PDT
Created
attachment 340714
[details]
it begins
Filip Pizlo
Comment 2
2018-05-18 12:04:24 PDT
Created
attachment 340724
[details]
a bit more
Radar WebKit Bug Importer
Comment 3
2018-05-18 12:13:14 PDT
<
rdar://problem/40373500
>
Filip Pizlo
Comment 4
2018-05-18 13:09:18 PDT
Created
attachment 340731
[details]
maye it is written
Filip Pizlo
Comment 5
2018-05-18 14:50:13 PDT
Created
attachment 340740
[details]
it did things
Filip Pizlo
Comment 6
2018-05-18 15:30:04 PDT
Created
attachment 340748
[details]
it's a nice speed-up
Filip Pizlo
Comment 7
2018-05-18 15:55:35 PDT
Created
attachment 340751
[details]
the patch
EWS Watchlist
Comment 8
2018-05-18 15:57:56 PDT
Attachment 340751
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:38: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:39: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:40: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] Total errors found: 5 in 36 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 9
2018-05-18 16:15:01 PDT
Created
attachment 340755
[details]
the patch
EWS Watchlist
Comment 10
2018-05-18 16:18:47 PDT
Attachment 340755
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:38: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:39: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:40: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] Total errors found: 5 in 36 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 11
2018-05-18 16:23:53 PDT
Created
attachment 340756
[details]
the patch
EWS Watchlist
Comment 12
2018-05-18 16:26:15 PDT
Attachment 340756
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:38: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:39: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:40: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] Total errors found: 5 in 36 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 13
2018-05-18 16:41:24 PDT
Created
attachment 340759
[details]
the patch
EWS Watchlist
Comment 14
2018-05-18 16:44:33 PDT
Attachment 340759
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:37: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:38: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:39: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/bytecode/InstanceOfVariant.cpp:40: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] Total errors found: 5 in 37 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 15
2018-05-19 12:38:04 PDT
Comment on
attachment 340759
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=340759&action=review
r=me with nits.
> Source/JavaScriptCore/bytecode/InstanceOfVariant.h:37 > + InstanceOfVariant() { }
Use `InstanceOfVariant() = default;`
> Source/JavaScriptCore/bytecode/InstanceOfVariant.h:61 > + JSObject* m_prototype = nullptr;
Make this `JSObject* m_prototype { nullptr }`.
> Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:3389 > + if (base.m_structure.isInfinite() || baseSet.size() < base.m_structure.size())
Is `baseSet.size() < base.m_structure.size()` condition correct? If node->matchStructureData().variants have so many structures, which includes all the base.m_structure, baseSet.size() == base.m_structure.size(), but we have a chance to reduce # of variants.
> Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:3390 > + m_state.setFoundConstants(true);
I think we have a chance to clear NodeMustGenerate in constant folding phase if the given abstract value's structure set is finite and all the structures are covered by MatchStructure's set.
> Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:520 > + RegisteredStructureSet structureSet; > + for (MatchStructureVariant& variant : data.variants) > + structureSet.add(variant.structure); > + addBaseCheck(indexInBlock, node, baseValue, structureSet); > + m_graph.convertToConstant( > + node, m_graph.freeze(jsBoolean(result == BooleanLattice::True)));
`changed = true`?
> Source/WTF/wtf/BooleanLattice.h:42 > +inline BooleanLattice lubBooleanLattice(BooleanLattice a, BooleanLattice b) > +{ > + return static_cast<BooleanLattice>(static_cast<uint8_t>(a) | static_cast<uintptr_t>(b)); > +}
I think `leastUpperBoundOfBooleanLattices` is better since we already have bunch of `leastUpperBoundXXX` functions.
Filip Pizlo
Comment 16
2018-05-19 12:47:34 PDT
(In reply to Yusuke Suzuki from
comment #15
)
> Comment on
attachment 340759
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=340759&action=review
> > r=me with nits. > > > Source/JavaScriptCore/bytecode/InstanceOfVariant.h:37 > > + InstanceOfVariant() { } > > Use `InstanceOfVariant() = default;`
Fixed. Can you tell me what the advantage of this is?
> > > Source/JavaScriptCore/bytecode/InstanceOfVariant.h:61 > > + JSObject* m_prototype = nullptr; > > Make this `JSObject* m_prototype { nullptr }`.
Fixed.
> > > Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:3389 > > + if (base.m_structure.isInfinite() || baseSet.size() < base.m_structure.size()) > > Is `baseSet.size() < base.m_structure.size()` condition correct? If > node->matchStructureData().variants have so many structures, which includes > all the base.m_structure, baseSet.size() == base.m_structure.size(), but we > have a chance to reduce # of variants.
You're right. This should be baseSet.size() < node->matchStructureData().variants.size(). I fixed it and will retest perf.
> > > Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:3390 > > + m_state.setFoundConstants(true); > > I think we have a chance to clear NodeMustGenerate in constant folding phase > if the given abstract value's structure set is finite and all the structures > are covered by MatchStructure's set.
We don't usually clear NodeMustGenerate in other cases where this happens, so I didn't do it here. In FTL mode, it really doesn't matter, since we rely on B3 to do the real DCE.
> > > Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:520 > > + RegisteredStructureSet structureSet; > > + for (MatchStructureVariant& variant : data.variants) > > + structureSet.add(variant.structure); > > + addBaseCheck(indexInBlock, node, baseValue, structureSet); > > + m_graph.convertToConstant( > > + node, m_graph.freeze(jsBoolean(result == BooleanLattice::True))); > > `changed = true`?
You're right! Fixed.
> > > Source/WTF/wtf/BooleanLattice.h:42 > > +inline BooleanLattice lubBooleanLattice(BooleanLattice a, BooleanLattice b) > > +{ > > + return static_cast<BooleanLattice>(static_cast<uint8_t>(a) | static_cast<uintptr_t>(b)); > > +} > > I think `leastUpperBoundOfBooleanLattices` is better since we already have > bunch of `leastUpperBoundXXX` functions.
Right. Fixed.
Yusuke Suzuki
Comment 17
2018-05-19 12:55:23 PDT
Comment on
attachment 340759
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=340759&action=review
>>> Source/JavaScriptCore/bytecode/InstanceOfVariant.h:37 >>> + InstanceOfVariant() { } >> >> Use `InstanceOfVariant() = default;` > > Fixed. Can you tell me what the advantage of this is?
The compiler can offer a good information without adding an explicit annotation. For example, if all the members are constexpr-initialized, constructor becomes `constexpr` constructor :)
Filip Pizlo
Comment 18
2018-05-19 15:01:30 PDT
Landed in
https://trac.webkit.org/changeset/232000/webkit
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