WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
217928
%TypedArray%#sort helper functions should be globalPrivate
https://bugs.webkit.org/show_bug.cgi?id=217928
Summary
%TypedArray%#sort helper functions should be globalPrivate
Ross Kirsling
Reported
2020-10-19 16:25:14 PDT
%TypedArray%#sort helper functions should be globalPrivate
Attachments
Patch
(6.22 KB, patch)
2020-10-19 16:28 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch for landing
(6.21 KB, patch)
2020-10-19 16:36 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch for landing
(9.97 KB, patch)
2020-10-19 18:04 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch for landing
(9.97 KB, patch)
2020-10-19 20:35 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Ross Kirsling
Comment 1
2020-10-19 16:28:26 PDT
Created
attachment 411810
[details]
Patch
Yusuke Suzuki
Comment 2
2020-10-19 16:30:59 PDT
Comment on
attachment 411810
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=411810&action=review
r=me
> Source/JavaScriptCore/builtins/TypedArrayPrototype.js:212 > + var buffer = []; > + buffer.length = valueCount;
Use `var buffer = @newArrayWithSize(valueCount)`.
Ross Kirsling
Comment 3
2020-10-19 16:36:23 PDT
Created
attachment 411812
[details]
Patch for landing
Alexey Shvayka
Comment 4
2020-10-19 16:38:49 PDT
Comment on
attachment 411810
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=411810&action=review
> Source/JavaScriptCore/builtins/GlobalOperations.js:132 > +function sortMin(a, b)
In future, we may consider replacing this (and maxWithPositives() of ArrayPrototype.js) with exposed Math.{min,max} built-ins as they have fast path for 2 arguments.
> Source/JavaScriptCore/builtins/TypedArrayPrototype.js:227 > + for(var i = 0; i < valueCount; i++)
nit: space before a parentheses and using pre-increment instead of post-increment (based on
https://bugs.webkit.org/show_bug.cgi?id=202582#c12
).
Ross Kirsling
Comment 5
2020-10-19 18:04:39 PDT
Created
attachment 411821
[details]
Patch for landing
Ross Kirsling
Comment 6
2020-10-19 18:11:21 PDT
Thanks for the double review!
Alexey Shvayka
Comment 7
2020-10-19 18:35:20 PDT
Comment on
attachment 411821
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=411821&action=review
> Source/JavaScriptCore/runtime/JSGlobalObject.cpp:1231 > + init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mathProtoFuncMin, TruncIntrinsic));
If there isn't a "race condition" during built-in objects init, we can reuse this JSFunction in MathObject::finishCreation() via `globalObject->linkTimeConstant(LinkTimeConstant::min);` to avoid creating the second one?
Ross Kirsling
Comment 8
2020-10-19 19:21:34 PDT
(In reply to Alexey Shvayka from
comment #7
)
> Comment on
attachment 411821
[details]
> Patch for landing > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=411821&action=review
> > > Source/JavaScriptCore/runtime/JSGlobalObject.cpp:1231 > > + init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mathProtoFuncMin, TruncIntrinsic)); > > If there isn't a "race condition" during built-in objects init, we can reuse > this JSFunction in MathObject::finishCreation() via > `globalObject->linkTimeConstant(LinkTimeConstant::min);` to avoid creating > the second one?
Is there a precedent for that? I was just mimicking mathProtoFuncTrunc here.
Alexey Shvayka
Comment 9
2020-10-19 19:48:25 PDT
Comment on
attachment 411821
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=411821&action=review
>>> Source/JavaScriptCore/runtime/JSGlobalObject.cpp:1231 >>> + init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mathProtoFuncMin, TruncIntrinsic)); >> >> If there isn't a "race condition" during built-in objects init, we can reuse this JSFunction in MathObject::finishCreation() via `globalObject->linkTimeConstant(LinkTimeConstant::min);` to avoid creating the second one? > > Is there a precedent for that? I was just mimicking mathProtoFuncTrunc here.
Not that I can find; it might be better to do this optimization in a separate patch, for all link-time-constants possible. Oh, and please set the correct intrinsic (TruncIntrinsic => MinIntrinsic), as it's what DFG uses to emit the fast path.
Ross Kirsling
Comment 10
2020-10-19 20:34:11 PDT
(In reply to Alexey Shvayka from
comment #9
)
> Oh, and please set the correct intrinsic (TruncIntrinsic => MinIntrinsic), > as it's what DFG uses to emit the fast path.
Oh geez, what a silly mistake. Thanks.
Ross Kirsling
Comment 11
2020-10-19 20:35:14 PDT
Created
attachment 411834
[details]
Patch for landing
EWS
Comment 12
2020-10-19 23:40:48 PDT
Committed
r268715
: <
https://trac.webkit.org/changeset/268715
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 411834
[details]
.
Radar WebKit Bug Importer
Comment 13
2020-10-19 23:41:19 PDT
<
rdar://problem/70472747
>
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