Bug 180988 - [DFG][FTL] regExpMatchFast should be handled
Summary: [DFG][FTL] regExpMatchFast should be handled
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-19 12:32 PST by Yusuke Suzuki
Modified: 2018-01-11 06:21 PST (History)
9 users (show)

See Also:


Attachments
Patch (25.07 KB, patch)
2017-12-19 12:39 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-elcapitan (2.46 MB, application/zip)
2017-12-19 13:47 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews113 for mac-elcapitan (3.24 MB, application/zip)
2017-12-19 14:10 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (2.73 MB, application/zip)
2017-12-19 14:34 PST, EWS Watchlist
no flags Details
Patch (23.50 KB, patch)
2017-12-20 18:19 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (23.51 KB, patch)
2017-12-20 18:27 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (24.42 KB, patch)
2017-12-20 18:32 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (24.41 KB, patch)
2018-01-04 18:47 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (22.90 KB, patch)
2018-01-04 19:00 PST, Yusuke Suzuki
mark.lam: review+
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 (2.58 MB, application/zip)
2018-01-04 20:09 PST, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2017-12-19 12:32:20 PST
[DFG][FTL] regExpMatchFast should be handled
Comment 1 Yusuke Suzuki 2017-12-19 12:39:56 PST
Created attachment 329795 [details]
Patch
Comment 2 Keith Miller 2017-12-19 13:19:53 PST
Looks like you upset the EWS. :(
Comment 3 EWS Watchlist 2017-12-19 13:47:42 PST
Comment on attachment 329795 [details]
Patch

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

New failing tests:
css3/shapes/shape-outside/values/shape-outside-ellipse-004.html
css3/shapes/shape-outside/values/shape-outside-circle-004.html
imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-ellipse-004.html
Comment 4 EWS Watchlist 2017-12-19 13:47:44 PST
Created attachment 329808 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 5 EWS Watchlist 2017-12-19 13:51:17 PST
Comment on attachment 329795 [details]
Patch

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

New failing tests:
mozilla-tests.yaml/ecma_2/String/match-001.js.mozilla-dfg-eager-no-cjit-validate-phases
stress/regress-174044.js.ftl-no-cjit-small-pool
stress/regress-174044.js.default
stress/regress-174044.js.ftl-eager-no-cjit-b3o1
mozilla-tests.yaml/ecma_2/String/match-003.js.mozilla-ftl-eager-no-cjit-validate-phases
mozilla-tests.yaml/ecma_2/String/match-001.js.mozilla-ftl-eager-no-cjit-validate-phases
mozilla-tests.yaml/ecma_2/String/match-003.js.mozilla-dfg-eager-no-cjit-validate-phases
stress/regress-174044.js.dfg-eager-no-cjit-validate
stress/regress-174044.js.ftl-no-cjit-no-put-stack-validate
stress/regress-174044.js.dfg-eager
stress/regress-174044.js.no-cjit-collect-continuously
stress/regress-174044.js.no-ftl
stress/regress-174044.js.ftl-no-cjit-b3o1
stress/regress-174044.js.no-llint
stress/regress-174044.js.ftl-eager-no-cjit
stress/regress-174044.js.ftl-no-cjit-validate-sampling-profiler
stress/regress-174044.js.ftl-eager
stress/regress-174044.js.no-cjit-validate-phases
stress/regress-174044.js.dfg-maximal-flush-validate-no-cjit
Comment 6 EWS Watchlist 2017-12-19 14:10:11 PST
Comment on attachment 329795 [details]
Patch

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

New failing tests:
css3/shapes/shape-outside/values/shape-outside-ellipse-004.html
css3/shapes/shape-outside/values/shape-outside-circle-004.html
svg/custom/object-sizing-explicit-width.xhtml
imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-ellipse-004.html
Comment 7 EWS Watchlist 2017-12-19 14:10:13 PST
Created attachment 329819 [details]
Archive of layout-test-results from ews113 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 8 EWS Watchlist 2017-12-19 14:34:51 PST
Comment on attachment 329795 [details]
Patch

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

New failing tests:
css3/shapes/shape-outside/values/shape-outside-ellipse-004.html
css3/shapes/shape-outside/values/shape-outside-circle-004.html
imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-ellipse-004.html
Comment 9 EWS Watchlist 2017-12-19 14:34:53 PST
Created attachment 329828 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 10 Yusuke Suzuki 2017-12-20 18:19:07 PST
Created attachment 329986 [details]
Patch
Comment 11 Yusuke Suzuki 2017-12-20 18:27:14 PST
Created attachment 329987 [details]
Patch
Comment 12 Yusuke Suzuki 2017-12-20 18:32:41 PST
Created attachment 329988 [details]
Patch
Comment 13 Yusuke Suzuki 2018-01-04 18:10:59 PST
Ping?
Comment 14 Joseph Pecoraro 2018-01-04 18:38:50 PST
Comment on attachment 329988 [details]
Patch

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

Neat!

> Source/JavaScriptCore/builtins/RegExpPrototype.js:85
> +    'use strict';

Style: Most of the time this is a double quoted string.
Comment 15 Yusuke Suzuki 2018-01-04 18:42:33 PST
Comment on attachment 329988 [details]
Patch

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

>> Source/JavaScriptCore/builtins/RegExpPrototype.js:85
>> +    'use strict';
> 
> Style: Most of the time this is a double quoted string.

Thanks, fixed.
Comment 16 Yusuke Suzuki 2018-01-04 18:47:41 PST
Created attachment 330509 [details]
Patch
Comment 17 Yusuke Suzuki 2018-01-04 19:00:24 PST
Created attachment 330510 [details]
Patch
Comment 18 EWS Watchlist 2018-01-04 20:09:46 PST
Comment on attachment 330510 [details]
Patch

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

New failing tests:
fast/mediastream/MediaStream-MediaElement-setObject-null.html
Comment 19 EWS Watchlist 2018-01-04 20:09:47 PST
Created attachment 330516 [details]
Archive of layout-test-results from ews106 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 20 Yusuke Suzuki 2018-01-04 21:07:44 PST
(In reply to Build Bot from comment #19)
> Created attachment 330516 [details]
> Archive of layout-test-results from ews106 for mac-elcapitan-wk2
> 
> The attached test failures were seen while running run-webkit-tests on the
> mac-wk2-ews.
> Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6

Seems unrelated.
Comment 21 Yusuke Suzuki 2018-01-08 16:55:10 PST
Ping?
Comment 22 Mark Lam 2018-01-10 11:11:02 PST
Comment on attachment 330510 [details]
Patch

r=me
Comment 23 Mark Lam 2018-01-10 11:12:55 PST
(In reply to Yusuke Suzuki from comment #20)
> (In reply to Build Bot from comment #19)
> > Created attachment 330516 [details]
> > Archive of layout-test-results from ews106 for mac-elcapitan-wk2
> > 
> > The attached test failures were seen while running run-webkit-tests on the
> > mac-wk2-ews.
> > Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
> 
> Seems unrelated.

Can you please run the failed test locally and confirm that it passes with your patch before landing?
Comment 24 Saam Barati 2018-01-10 11:20:43 PST
Comment on attachment 330510 [details]
Patch

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

> Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:1968
> +    case RegExpMatch:

This name confused me. I vote for calling this RegExpMatchFast to align w/ the intrinsic. I originally thought this was the entire match operation, but it's only the fast path.
Comment 25 Saam Barati 2018-01-10 11:26:25 PST
Comment on attachment 330510 [details]
Patch

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

LGTM too

> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:2621
> +        if (argumentCountIncludingThis != 2)
> +            return false;

Seems like this should be a release assert since this is only called by our builtins.

> Source/JavaScriptCore/dfg/DFGOperations.cpp:1026
> +EncodedJSValue JIT_OPERATION operationRegExpMatchString(ExecState* exec, JSGlobalObject* globalObject, RegExpObject* regExpObject, JSString* argument)

I would also add "fast" here to align the names.

> Source/JavaScriptCore/runtime/RegExpPrototype.cpp:-149
> -    VM& vm = exec->vm();
> -    auto scope = DECLARE_THROW_SCOPE(vm);
> -
> -    JSValue thisValue = exec->thisValue();
> -    if (!thisValue.inherits(vm, RegExpObject::info()))
> -        return throwVMTypeError(exec, scope);
> -    JSString* string = exec->argument(0).toStringOrNull(exec);
> -    EXCEPTION_ASSERT(!!scope.exception() == !string);
> -    if (!string)
> -        return encodedJSValue();
> -    if (!asRegExpObject(thisValue)->regExp()->global()) {
> -        scope.release();
> -        return JSValue::encode(asRegExpObject(thisValue)->exec(exec, exec->lexicalGlobalObject(), string));
> -    }
> -    scope.release();
> -    return JSValue::encode(asRegExpObject(thisValue)->matchGlobal(exec, exec->lexicalGlobalObject(), string));

This was all unneeded because we already do the safety checks in the builtin, right? Why was this here before then?
Comment 26 Yusuke Suzuki 2018-01-11 05:28:43 PST
Comment on attachment 330510 [details]
Patch

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

Thanks!

>> Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:1968
>> +    case RegExpMatch:
> 
> This name confused me. I vote for calling this RegExpMatchFast to align w/ the intrinsic. I originally thought this was the entire match operation, but it's only the fast path.

OK, changed it to RegExpMatchFast.

>> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:2621
>> +            return false;
> 
> Seems like this should be a release assert since this is only called by our builtins.

Right. Changed.

>> Source/JavaScriptCore/dfg/DFGOperations.cpp:1026
>> +EncodedJSValue JIT_OPERATION operationRegExpMatchString(ExecState* exec, JSGlobalObject* globalObject, RegExpObject* regExpObject, JSString* argument)
> 
> I would also add "fast" here to align the names.

Fixed.

>> Source/JavaScriptCore/runtime/RegExpPrototype.cpp:-149
>> -    return JSValue::encode(asRegExpObject(thisValue)->matchGlobal(exec, exec->lexicalGlobalObject(), string));
> 
> This was all unneeded because we already do the safety checks in the builtin, right? Why was this here before then?

Right. This function is only called if the above check is met. So this is unnecessary. I'm not sure why we have these unnecessary checks.
Comment 27 Yusuke Suzuki 2018-01-11 06:19:36 PST
(In reply to Mark Lam from comment #23)
> (In reply to Yusuke Suzuki from comment #20)
> > (In reply to Build Bot from comment #19)
> > > Created attachment 330516 [details]
> > > Archive of layout-test-results from ews106 for mac-elcapitan-wk2
> > > 
> > > The attached test failures were seen while running run-webkit-tests on the
> > > mac-wk2-ews.
> > > Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
> > 
> > Seems unrelated.
> 
> Can you please run the failed test locally and confirm that it passes with
> your patch before landing?

OK, the test runs as expected in my working copy.
Comment 28 Yusuke Suzuki 2018-01-11 06:20:51 PST
Committed r226775: <https://trac.webkit.org/changeset/226775>
Comment 29 Radar WebKit Bug Importer 2018-01-11 06:21:41 PST
<rdar://problem/36436985>