RESOLVED FIXED 209363
hasObservableSideEffectsForRegExpSplit doesn't check for @@match override
https://bugs.webkit.org/show_bug.cgi?id=209363
Summary hasObservableSideEffectsForRegExpSplit doesn't check for @@match override
Ross Kirsling
Reported 2020-03-20 15:09:01 PDT
hasObservableSideEffectsForRegExpSplit doesn't check for @@match override
Attachments
Patch (6.39 KB, patch)
2020-03-20 15:15 PDT, Ross Kirsling
no flags
Ross Kirsling
Comment 1 2020-03-20 15:15:59 PDT
Radar WebKit Bug Importer
Comment 2 2020-03-20 15:31:52 PDT
Michael Saboff
Comment 3 2020-03-20 15:57:11 PDT
Comment on attachment 394136 [details] Patch r=me. Looks good.
Ross Kirsling
Comment 4 2020-03-20 16:06:04 PDT
(In reply to Michael Saboff from comment #3) > Comment on attachment 394136 [details] > Patch > > r=me. Looks good. Thanks, Michael!
EWS
Comment 5 2020-03-20 17:38:52 PDT
Committed r258801: <https://trac.webkit.org/changeset/258801> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394136 [details].
Yusuke Suzuki
Comment 6 2020-03-22 18:08:52 PDT
Comment on attachment 394136 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394136&action=review > Source/JavaScriptCore/builtins/RegExpPrototype.js:467 > + if (regexp.@@match !== @regExpPrototypeSymbolMatch) > + return true; Why don't we use @tryGetById for this access?
Ross Kirsling
Comment 7 2020-03-22 19:01:03 PDT
(In reply to Yusuke Suzuki from comment #6) > Comment on attachment 394136 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394136&action=review > > > Source/JavaScriptCore/builtins/RegExpPrototype.js:467 > > + if (regexp.@@match !== @regExpPrototypeSymbolMatch) > > + return true; > > Why don't we use @tryGetById for this access? I was just mimicking this: https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/builtins/StringPrototype.js#L222 https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/builtins/StringPrototype.js#L249 I didn't realize @tryGetById worked with symbols, but I can make an update if you prefer.
Yusuke Suzuki
Comment 8 2020-03-22 19:10:04 PDT
(In reply to Ross Kirsling from comment #7) > (In reply to Yusuke Suzuki from comment #6) > > Comment on attachment 394136 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=394136&action=review > > > > > Source/JavaScriptCore/builtins/RegExpPrototype.js:467 > > > + if (regexp.@@match !== @regExpPrototypeSymbolMatch) > > > + return true; > > > > Why don't we use @tryGetById for this access? > > I was just mimicking this: > https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/builtins/ > StringPrototype.js#L222 > https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/builtins/ > StringPrototype.js#L249 > > I didn't realize @tryGetById worked with symbols, but I can make an update > if you prefer. While @tryGetById is not observable to users, usual get can be observable by setting a getter here. So if this check is not observable to users, we need to use @tryGetById. For example, String#replace is accessing @@replace explicitly in an observable way in https://tc39.es/ecma262/#sec-string.prototype.replace. So, xxx.@@replace is fine. On the other hand, I think hasObservableSideEffectsForRegExpSplit should not be observable to users. So we need to use @tryGetById.
Ross Kirsling
Comment 9 2020-03-22 19:15:45 PDT
(In reply to Yusuke Suzuki from comment #8) > While @tryGetById is not observable to users, usual get can be observable by > setting a getter here. > So if this check is not observable to users, we need to use @tryGetById. > > For example, String#replace is accessing @@replace explicitly in an > observable way in https://tc39.es/ecma262/#sec-string.prototype.replace. So, > xxx.@@replace is fine. > > On the other hand, I think hasObservableSideEffectsForRegExpSplit should not > be observable to users. > So we need to use @tryGetById. Oh! You're quite right, thanks for that explanation. Will fix.
Ross Kirsling
Comment 10 2020-03-23 12:05:38 PDT
(In reply to Ross Kirsling from comment #9) > Oh! You're quite right, thanks for that explanation. Will fix. Committed r258865: <https://trac.webkit.org/changeset/258865>
Saam Barati
Comment 11 2020-03-24 15:45:37 PDT
(In reply to Ross Kirsling from comment #10) > (In reply to Ross Kirsling from comment #9) > > Oh! You're quite right, thanks for that explanation. Will fix. > > Committed r258865: <https://trac.webkit.org/changeset/258865> In your fix, it feels like the else in your ternary should assert it's looking at a symbol.
Yusuke Suzuki
Comment 12 2020-03-24 16:12:38 PDT
(In reply to Saam Barati from comment #11) > (In reply to Ross Kirsling from comment #10) > > (In reply to Ross Kirsling from comment #9) > > > Oh! You're quite right, thanks for that explanation. Will fix. > > > > Committed r258865: <https://trac.webkit.org/changeset/258865> > > In your fix, it feels like the else in your ternary should assert it's > looking at a symbol. Yeah, I think this is not good. Super easiest way to fix this problem is having @tryGetByIdWellKnownSymbol(..., "match"), and emit try_get_by_id with well-known symbol.
Ross Kirsling
Comment 13 2020-03-24 16:15:43 PDT
(In reply to Yusuke Suzuki from comment #12) > (In reply to Saam Barati from comment #11) > > (In reply to Ross Kirsling from comment #10) > > > (In reply to Ross Kirsling from comment #9) > > > > Oh! You're quite right, thanks for that explanation. Will fix. > > > > > > Committed r258865: <https://trac.webkit.org/changeset/258865> > > > > In your fix, it feels like the else in your ternary should assert it's > > looking at a symbol. > > Yeah, I think this is not good. Super easiest way to fix this problem is > having @tryGetByIdWellKnownSymbol(..., "match"), and emit try_get_by_id with > well-known symbol. Is this better than asserting identifier().isPrivateName() for the ResolveNode case?
Yusuke Suzuki
Comment 14 2020-03-24 16:45:17 PDT
Discussed with Ross in slack, we will open a bug to fix the above issue.
Ross Kirsling
Comment 15 2020-03-24 17:15:09 PDT
(In reply to Yusuke Suzuki from comment #14) > Discussed with Ross in slack, we will open a bug to fix the above issue. Opened bug 209524.
Note You need to log in before you can comment on or make changes to this bug.