RESOLVED FIXED162941
[DOMJIT] Add initial CheckDOM and CallDOM implementations
https://bugs.webkit.org/show_bug.cgi?id=162941
Summary [DOMJIT] Add initial CheckDOM and CallDOM implementations
Yusuke Suzuki
Reported 2016-10-04 14:48:51 PDT
[DOMJIT] Add initial CheckDOM and CallDOM implementations
Attachments
Patch (51.74 KB, patch)
2016-10-04 14:49 PDT, Yusuke Suzuki
no flags
Patch (64.67 KB, patch)
2016-10-04 17:35 PDT, Yusuke Suzuki
no flags
Patch (67.62 KB, patch)
2016-10-04 18:41 PDT, Yusuke Suzuki
no flags
Patch (67.34 KB, patch)
2016-10-04 18:53 PDT, Yusuke Suzuki
no flags
Patch (62.41 KB, patch)
2016-10-04 18:56 PDT, Yusuke Suzuki
no flags
Patch (62.41 KB, patch)
2016-10-04 19:00 PDT, Yusuke Suzuki
no flags
Patch (62.39 KB, patch)
2016-10-04 19:05 PDT, Yusuke Suzuki
no flags
Patch (69.97 KB, patch)
2016-10-04 23:38 PDT, Yusuke Suzuki
no flags
Patch (69.82 KB, patch)
2016-10-04 23:42 PDT, Yusuke Suzuki
fpizlo: review+
Yusuke Suzuki
Comment 1 2016-10-04 14:49:13 PDT
Created attachment 290649 [details] Patch WIP
WebKit Commit Bot
Comment 2 2016-10-04 15:00:02 PDT
Attachment 290649 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGOpInfo.h:46: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/dfg/DFGNode.h:2458: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 35 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 3 2016-10-04 17:35:42 PDT
Created attachment 290674 [details] Patch WIP
WebKit Commit Bot
Comment 4 2016-10-04 17:38:49 PDT
Attachment 290674 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGOpInfo.h:46: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/dfg/DFGNode.h:2458: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 37 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 5 2016-10-04 18:41:04 PDT
WebKit Commit Bot
Comment 6 2016-10-04 18:43:21 PDT
Attachment 290678 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGOpInfo.h:46: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/dfg/DFGNode.h:2458: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 38 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 7 2016-10-04 18:44:57 PDT
Comment on attachment 290678 [details] Patch Fix build.
Yusuke Suzuki
Comment 8 2016-10-04 18:53:55 PDT
Yusuke Suzuki
Comment 9 2016-10-04 18:56:52 PDT
Yusuke Suzuki
Comment 10 2016-10-04 18:57:54 PDT
Comment on attachment 290681 [details] Patch Oops. Still fixing.
Yusuke Suzuki
Comment 11 2016-10-04 19:00:31 PDT
WebKit Commit Bot
Comment 12 2016-10-04 19:02:01 PDT
Attachment 290682 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGOpInfo.h:46: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/dfg/DFGNode.h:2458: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 37 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 13 2016-10-04 19:05:45 PDT
WebKit Commit Bot
Comment 14 2016-10-04 19:09:00 PDT
Attachment 290683 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGOpInfo.h:46: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/dfg/DFGNode.h:2458: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 37 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 15 2016-10-04 19:14:05 PDT
Comment on attachment 290683 [details] Patch Still fixing.......
Yusuke Suzuki
Comment 16 2016-10-04 23:38:22 PDT
Yusuke Suzuki
Comment 17 2016-10-04 23:39:58 PDT
Rebasing
Yusuke Suzuki
Comment 18 2016-10-04 23:42:28 PDT
WebKit Commit Bot
Comment 19 2016-10-04 23:44:36 PDT
Attachment 290692 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/bytecode/GetByIdStatus.h:47: One space before end of line comments [whitespace/comments] [5] ERROR: Source/JavaScriptCore/dfg/DFGOpInfo.h:46: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/dfg/DFGNode.h:2458: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 3 in 40 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 20 2016-10-05 01:41:30 PDT
Comment on attachment 290692 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290692&action=review > Source/JavaScriptCore/ChangeLog:14 > + JSNode::info(). Fan fact: This CheckDOM is almost always eliminated. We typically write some DOM operation like, node.firstChild OR document.getElementById("..."); At that time, for node.firstChild GetById access, we typically emit CheckStructure for node. AI in this patch completely recognizes it and drop CheckDOM if filtered Structures are subclass of ClassInfo. But still CheckDOM is useful if we would like to handle super polymorphic case (Dromaeo's firstChild use).
Alex Christensen
Comment 21 2016-10-05 08:54:39 PDT
cool!
Filip Pizlo
Comment 22 2016-10-05 15:38:59 PDT
Comment on attachment 290692 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290692&action=review Nice!! > Source/JavaScriptCore/b3/B3Effects.h:81 > + static Effects forCheck() This is great! > Source/JavaScriptCore/b3/B3Value.cpp:617 > + result = Effects::forCheck(); Nice. > Source/JavaScriptCore/dfg/DFGAbstractValue.cpp:315 > + m_structure.filterClassInfo(classInfo); I like this. Can you file a bug about putting a ClassInfo field into AbstractValue. Then AI could do type-based tracking of value sets even better than now. When merging we would pick the lowest common ancestor. No need to do it now. Worth a fixme and bug. > Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:2688 > + addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(variant.structureSet())), thisNode); This is a bit unfortunate. Is there any way to only have the CheckDOM and not the structure check? > Source/JavaScriptCore/domjit/DOMJITReg.h:41 > +class Reg { Crazy! I think it's a good idea to have this separate from JSC::Reg/JSValueRegs for now but it sure seems like the rest of JSC will want this eventually. Can you file a bug and put a fixme for eventually moving this to JSC so others can use it? For example B3::ValueRep does some of the same stuff, maybe it could delegate to your Reg class eventually.
Yusuke Suzuki
Comment 23 2016-10-05 16:45:48 PDT
Comment on attachment 290692 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=290692&action=review Thanks! >> Source/JavaScriptCore/dfg/DFGAbstractValue.cpp:315 >> + m_structure.filterClassInfo(classInfo); > > I like this. Can you file a bug about putting a ClassInfo field into AbstractValue. Then AI could do type-based tracking of value sets even better than now. When merging we would pick the lowest common ancestor. > > No need to do it now. Worth a fixme and bug. Sure! I've just opened the bug for this. https://bugs.webkit.org/show_bug.cgi?id=162989 And noted FIXME here with this URL. >> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:2688 >> + addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(variant.structureSet())), thisNode); > > This is a bit unfortunate. Is there any way to only have the CheckDOM and not the structure check? Yes! This mechanism should be fixed definitely. This CheckStrucutre guards against Object.defineProperty(object, 'customGetter', { ... }) case. But as you know, due to this check, we give up optimization in Dromaeo dom-traverse. This is because we encounter bunch of Structures here (HTMLDivElement, HTMLAnchorElement, etc.). After initial DOMJIT accessor is implemented in WebCore, I'm planning to implement some mechanism to allow optimization here. It should involve AccessCases etc. I discussed with rniwa and keith_miller before. At that time, we come up with one idea: putting bloom filter in each Structure that tells us this Structure *must not* have properties related to the given name. I'll mail to you and Saam about the idea. >> Source/JavaScriptCore/domjit/DOMJITReg.h:41 >> +class Reg { > > Crazy! I think it's a good idea to have this separate from JSC::Reg/JSValueRegs for now but it sure seems like the rest of JSC will want this eventually. Can you file a bug and put a fixme for eventually moving this to JSC so others can use it? For example B3::ValueRep does some of the same stuff, maybe it could delegate to your Reg class eventually. Yup! Filed. https://bugs.webkit.org/show_bug.cgi?id=162990
Yusuke Suzuki
Comment 24 2016-10-05 22:22:48 PDT
Yusuke Suzuki
Comment 25 2016-10-05 22:41:22 PDT
Yusuke Suzuki
Comment 26 2016-10-05 22:54:25 PDT
Note You need to log in before you can comment on or make changes to this bug.