Bug 163005 - [DOMJIT] Implement Node accessors in DOMJIT
Summary: [DOMJIT] Implement Node accessors in DOMJIT
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on: 162978 163144
Blocks: 162544 163226 163223 163224
  Show dependency treegraph
 
Reported: 2016-10-06 03:33 PDT by Yusuke Suzuki
Modified: 2016-10-10 13:00 PDT (History)
6 users (show)

See Also:


Attachments
Patch (39.47 KB, patch)
2016-10-06 22:18 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (961.96 KB, application/zip)
2016-10-06 23:33 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (948.78 KB, application/zip)
2016-10-06 23:38 PDT, Build Bot
no flags Details
Patch (42.14 KB, patch)
2016-10-07 00:06 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (48.66 KB, patch)
2016-10-07 00:49 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-yosemite (822.20 KB, application/zip)
2016-10-07 02:07 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (935.78 KB, application/zip)
2016-10-07 02:10 PDT, Build Bot
no flags Details
Patch (47.97 KB, patch)
2016-10-07 10:42 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (49.15 KB, patch)
2016-10-07 10:55 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (1.10 MB, application/zip)
2016-10-07 12:23 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-yosemite (1.03 MB, application/zip)
2016-10-07 12:33 PDT, Build Bot
no flags Details
Patch (51.67 KB, patch)
2016-10-07 13:12 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (60.00 KB, patch)
2016-10-07 17:08 PDT, Yusuke Suzuki
fpizlo: review+
Details | Formatted Diff | Diff
Patch for landing (59.02 KB, patch)
2016-10-10 12:19 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2016-10-06 03:33:06 PDT
Let's implement DOMJIT Patchpoints for

firstChild, lastChild, nextSibling, previousSibling, parentNode.
Comment 1 Yusuke Suzuki 2016-10-06 22:18:01 PDT
Created attachment 290894 [details]
Patch

WIP: initial working prototype
Comment 2 WebKit Commit Bot 2016-10-06 22:19:40 PDT
Attachment 290894 [details] did not pass style-queue:


ERROR: Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpoint.h:0:  No copyright message found.  You should have a line: "Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
ERROR: Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpointParams.h:0:  No copyright message found.  You should have a line: "Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
Total errors found: 2 in 23 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Build Bot 2016-10-06 23:33:53 PDT
Comment on attachment 290894 [details]
Patch

Attachment 290894 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2235633

New failing tests:
imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
Comment 4 Build Bot 2016-10-06 23:33:57 PDT
Created attachment 290902 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 5 Build Bot 2016-10-06 23:38:10 PDT
Comment on attachment 290894 [details]
Patch

Attachment 290894 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2235646

New failing tests:
imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
Comment 6 Build Bot 2016-10-06 23:38:13 PDT
Created attachment 290903 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 7 Yusuke Suzuki 2016-10-07 00:06:39 PDT
Created attachment 290907 [details]
Patch
Comment 8 WebKit Commit Bot 2016-10-07 00:18:05 PDT
Attachment 290907 [details] did not pass style-queue:


ERROR: Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpoint.h:0:  No copyright message found.  You should have a line: "Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
ERROR: Source/WebCore/ForwardingHeaders/domjit/DOMJITPatchpointParams.h:0:  No copyright message found.  You should have a line: "Copyright [year] <Copyright Owner>"  [legal/copyright] [5]
Total errors found: 2 in 25 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Yusuke Suzuki 2016-10-07 00:49:07 PDT
Created attachment 290908 [details]
Patch
Comment 10 Build Bot 2016-10-07 02:07:21 PDT
Comment on attachment 290908 [details]
Patch

Attachment 290908 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2236277

New failing tests:
imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
Comment 11 Build Bot 2016-10-07 02:07:24 PDT
Created attachment 290914 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 12 Build Bot 2016-10-07 02:10:40 PDT
Comment on attachment 290908 [details]
Patch

Attachment 290908 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2236285

New failing tests:
imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
Comment 13 Build Bot 2016-10-07 02:10:43 PDT
Created attachment 290915 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 14 Yusuke Suzuki 2016-10-07 10:42:18 PDT
Created attachment 290942 [details]
Patch
Comment 15 Yusuke Suzuki 2016-10-07 10:55:26 PDT
Created attachment 290945 [details]
Patch
Comment 16 Build Bot 2016-10-07 12:23:09 PDT
Comment on attachment 290945 [details]
Patch

Attachment 290945 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2239016

New failing tests:
imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
Comment 17 Build Bot 2016-10-07 12:23:13 PDT
Created attachment 290954 [details]
Archive of layout-test-results from ews106 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 18 Build Bot 2016-10-07 12:33:18 PDT
Comment on attachment 290945 [details]
Patch

Attachment 290945 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2239060

New failing tests:
imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
Comment 19 Build Bot 2016-10-07 12:33:22 PDT
Created attachment 290956 [details]
Archive of layout-test-results from ews101 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 20 Yusuke Suzuki 2016-10-07 13:12:36 PDT
Created attachment 290960 [details]
Patch
Comment 21 Yusuke Suzuki 2016-10-07 17:08:53 PDT
Created attachment 290985 [details]
Patch
Comment 22 Sam Weinig 2016-10-07 18:34:13 PDT
Cool!
Comment 23 Filip Pizlo 2016-10-10 11:05:38 PDT
Comment on attachment 290985 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=290985&action=review

> Source/JavaScriptCore/domjit/DOMJITPatchpoint.h:65
> +    bool useTagMaskRegister { true };
> +    bool useTagTypeNumberRegister { true };

Can we just make these always true and remove them?

> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:8737
> +        if (domJIT->useTagMaskRegister)
> +            patchpoint->append(m_tagMask, ValueRep::lateReg(GPRInfo::tagMaskRegister));
> +        if (domJIT->useTagTypeNumberRegister)
> +            patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));

It's relatively cheap to do this, so we could just do it all of the time.  I think that's what the get_by_id/put_by_id patchpoints do, for example.  Heck I think we also do it for ValueAdd and friends when emitting them in snippet (i.e. patchpoint) mode.

Also, why are you making them late registers?  I think it's correct, but stronger than what we need.  If the result is Void then you don't have to worry about them interfering with result.  If the result is not Void and you are already using SomeEarlyRegister for the result, then the result is already going to interfere with early uses.  Also, early uses already interfere with scratches.  It's OK to keep the code this way, since it's telling a sound truth, but I'm curious if you needed it to solve some bug!

> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:8784
> +        if (domJIT->useTagMaskRegister)
> +            patchpoint->append(m_tagMask, ValueRep::lateReg(GPRInfo::tagMaskRegister));
> +        if (domJIT->useTagTypeNumberRegister)
> +            patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));

Ditto.

> Source/WTF/wtf/StdLibExtras.h:71
> +#define CAST_OFFSET(from, to) (reinterpret_cast<uintptr_t>(static_cast<to>((reinterpret_cast<from>(0x4000)))) - 0x4000)

Nice.  That's so evil.

> Source/WebCore/domjit/DOMJITHelpers.h:42
> +inline CCallHelpers::Jump branchIfNotWorldIsNormal(CCallHelpers& jit, GPRReg globalObject)

I love this style.  I wish that we had written CCallHelpers and AssemblyHelpers this way.
Comment 24 Yusuke Suzuki 2016-10-10 11:50:51 PDT
Comment on attachment 290985 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=290985&action=review

>> Source/JavaScriptCore/domjit/DOMJITPatchpoint.h:65
>> +    bool useTagTypeNumberRegister { true };
> 
> Can we just make these always true and remove them?

OK. Dropped.

>> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:8737
>> +            patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));
> 
> It's relatively cheap to do this, so we could just do it all of the time.  I think that's what the get_by_id/put_by_id patchpoints do, for example.  Heck I think we also do it for ValueAdd and friends when emitting them in snippet (i.e. patchpoint) mode.
> 
> Also, why are you making them late registers?  I think it's correct, but stronger than what we need.  If the result is Void then you don't have to worry about them interfering with result.  If the result is not Void and you are already using SomeEarlyRegister for the result, then the result is already going to interfere with early uses.  Also, early uses already interfere with scratches.  It's OK to keep the code this way, since it's telling a sound truth, but I'm curious if you needed it to solve some bug!

Right. resultConstraint change is used to make the patchpoint environment in FTL closer to one in DFG: the result reg interferes with early uses.
On the other hand, this change does not fix any bugs. The previous one just works.
And you're right. This patchpoint already said that the result is SomeEarlyRegister. So we can just use ValueRep::reg() and they interfere with the other early uses and the result.

Changed it to ValueRep::reg and always added this constraint.

>> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:8784
>> +            patchpoint->append(m_tagTypeNumber, ValueRep::lateReg(GPRInfo::tagTypeNumberRegister));
> 
> Ditto.

Fixed.

>> Source/WebCore/domjit/DOMJITHelpers.h:42
>> +inline CCallHelpers::Jump branchIfNotWorldIsNormal(CCallHelpers& jit, GPRReg globalObject)
> 
> I love this style.  I wish that we had written CCallHelpers and AssemblyHelpers this way.

Yeah, this allows us to extend helpers easily in everywhere (including outside of JSC like WebCore)
Comment 25 Yusuke Suzuki 2016-10-10 12:19:30 PDT
Created attachment 291136 [details]
Patch for landing
Comment 26 Yusuke Suzuki 2016-10-10 13:00:34 PDT
Committed r207013: <http://trac.webkit.org/changeset/207013>