WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
172798
[JSC] Implement String.prototype.concat in JS builtins
https://bugs.webkit.org/show_bug.cgi?id=172798
Summary
[JSC] Implement String.prototype.concat in JS builtins
Yusuke Suzuki
Reported
2017-05-31 21:55:53 PDT
[JSC] Implement String.prototype.concat in JS builtins
Attachments
Patch
(8.57 KB, patch)
2017-05-31 21:58 PDT
,
Yusuke Suzuki
sam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2017-05-31 21:58:03 PDT
Created
attachment 311683
[details]
Patch
Sam Weinig
Comment 2
2017-05-31 22:05:00 PDT
Comment on
attachment 311683
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=311683&action=review
> Source/JavaScriptCore/builtins/StringPrototype.js:311 > +function stringConcatSlowPath() > +{ > + "use strict";
Is using arguments faster than using rest parameters? (I asked Saam recently and he was on the fence I think, or maybe just hadn't benchmarked it).
Yusuke Suzuki
Comment 3
2017-05-31 22:15:19 PDT
Comment on
attachment 311683
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=311683&action=review
Thanks!
>> Source/JavaScriptCore/builtins/StringPrototype.js:311 >> + "use strict"; > > Is using arguments faster than using rest parameters? (I asked Saam recently and he was on the fence I think, or maybe just hadn't benchmarked it).
One stupid problem is that our builtin JS system currently cannot accept default and rest parameters :( We should extend our builtin JS generators (python scripts) to accept these forms. It should be easy & simple task. But, even if we do that, for builtin JS, I think we can introduce & use much better one: extending `@argument()` to accept arbitrary runtime integers instead of constant integers. By doing so, we can avoid allocation for arguments / rest parameter arrays completely for builtin JS code. So, personally, rather than extending builtin JS generators, I think we should do this thing. So, I think we do not need to use rest parameters & arguments in JS builtin code when we do the above optimization.
Yusuke Suzuki
Comment 4
2017-05-31 22:18:33 PDT
Committed
r217648
: <
http://trac.webkit.org/changeset/217648
>
Yusuke Suzuki
Comment 5
2017-05-31 23:52:02 PDT
(In reply to Yusuke Suzuki from
comment #4
)
> Committed
r217648
: <
http://trac.webkit.org/changeset/217648
>
Need to rebaseline error messages. WIP...
Yusuke Suzuki
Comment 6
2017-06-01 00:27:14 PDT
Committed
r217649
: <
http://trac.webkit.org/changeset/217649
>
Saam Barati
Comment 7
2017-06-01 09:47:03 PDT
(In reply to Yusuke Suzuki from
comment #3
)
> Comment on
attachment 311683
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=311683&action=review
> > Thanks! > > >> Source/JavaScriptCore/builtins/StringPrototype.js:311 > >> + "use strict"; > > > > Is using arguments faster than using rest parameters? (I asked Saam recently and he was on the fence I think, or maybe just hadn't benchmarked it). > > One stupid problem is that our builtin JS system currently cannot accept > default and rest parameters :( > We should extend our builtin JS generators (python scripts) to accept these > forms. > It should be easy & simple task.
Out of curiosity, why does this break the script? Does it try to validate syntax somehow?
> > But, even if we do that, for builtin JS, I think we can introduce & use much > better one: extending `@argument()` to accept arbitrary runtime integers > instead of constant integers. > By doing so, we can avoid allocation for arguments / rest parameter arrays > completely for builtin JS code. > So, personally, rather than extending builtin JS generators, I think we > should do this thing.
I agree.
> > So, I think we do not need to use rest parameters & arguments in JS builtin > code when we do the above optimization.
Yusuke Suzuki
Comment 8
2017-06-01 09:54:26 PDT
Comment on
attachment 311683
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=311683&action=review
>>>> Source/JavaScriptCore/builtins/StringPrototype.js:311 >>>> + "use strict"; >>> >>> Is using arguments faster than using rest parameters? (I asked Saam recently and he was on the fence I think, or maybe just hadn't benchmarked it). >> >> One stupid problem is that our builtin JS system currently cannot accept default and rest parameters :( >> We should extend our builtin JS generators (python scripts) to accept these forms. >> It should be easy & simple task. >> >> But, even if we do that, for builtin JS, I think we can introduce & use much better one: extending `@argument()` to accept arbitrary runtime integers instead of constant integers. >> By doing so, we can avoid allocation for arguments / rest parameter arrays completely for builtin JS code. >> So, personally, rather than extending builtin JS generators, I think we should do this thing. >> >> So, I think we do not need to use rest parameters & arguments in JS builtin code when we do the above optimization. > > Out of curiosity, why does this break the script? Does it try to validate syntax somehow?
It's just a missing regexp in builtin generator python. We should extend the existing regexp to accept parameters including default and rest params.
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