Closed
Bug 1482359
Opened 7 years ago
Closed 7 years ago
Use StrictEq semantics for more cases in Object.is
Categories
(Core :: JavaScript Engine: JIT, enhancement)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla63
| Tracking | Status | |
|---|---|---|
| firefox63 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(1 file, 2 obsolete files)
|
18.43 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
Bug 1433432 was a bit conservative when to convert Object.is() into JSOP_STRICTEQ, for example MCompare::Compare_Bitwise is currently not enabled.
| Assignee | ||
Comment 1•7 years ago
|
||
Use JSOP_STRICTEQ for more cases in Object.is():
- When both operands are typed as MIRType::Value, but are definitely not floating-point types, we can use JSOP_STRICTEQ.
- When one operand is typed as MIRType::Value, but also definitely not a floating-point type, we can use JSOP_STRICTEQ, too.
And when inlining Object.is() as JSOP_STRICTEQ, directly call |jsop_compare| instead of just |compareTrySpecialized| to be able to use MCompare::Compare_Bitwise via |compareTryBitwise|.
Improves test cases like this one from 240ms to 28ms for me:
---
function f() {
var xs = [1,2,3,null];
var ys = [1,2,3,null];
var q = 0;
var t = dateNow();
for (var i = 0; i < 10000000; ++i) {
if (Object.is(xs[i & 3], ys[i & 3]))
++q;
}
print(dateNow() - t, q);
}
f();
---
Attachment #8999149 -
Flags: review?(jdemooij)
Comment 2•7 years ago
|
||
Comment on attachment 8999149 [details] [diff] [review]
bug1482359.patch
Review of attachment 8999149 [details] [diff] [review]:
-----------------------------------------------------------------
Nice speedup and I like reusing more/most of the jsop_compare code.
::: js/src/jit/MCallOptimize.cpp
@@ +2499,5 @@
> + // they aren't floating-point types or values which might be floating-
> + // point types. Otherwise we need to use MSameValue.
> + strictEq = leftType != MIRType::Value
> + ? !IsFloatingPointType(leftType)
> + : !mightBeFloatingPointType(left) && !mightBeFloatingPointType(right);
Nit: I would add parentheses around the && because I never remember the evaluation order in such cases and I'm too lazy to look it up :)
Attachment #8999149 -
Flags: review?(jdemooij) → review+
| Assignee | ||
Comment 3•7 years ago
|
||
Updated per review comments, carrying r+.
Attachment #8999149 -
Attachment is obsolete: true
Attachment #8999602 -
Flags: review+
| Assignee | ||
Comment 4•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b13369c7fdc8e89a107dc875edeadd773704063e
Keywords: checkin-needed
| Assignee | ||
Comment 5•7 years ago
|
||
Clearing "checkin-needed" because the patch needs to be rebased now that bug 1341261 has landed.
Keywords: checkin-needed
| Assignee | ||
Comment 6•7 years ago
|
||
Rebased patch to apply cleanly on inbound.
Attachment #8999602 -
Attachment is obsolete: true
Attachment #8999732 -
Flags: review+
| Assignee | ||
Comment 7•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3cb5d99316ca2b617ce8399a719519279725176a
Keywords: checkin-needed
Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a23c3d37ae2b
Use more JSOP_STRICTEQ optimizations for Object.is(). r=jandem
Keywords: checkin-needed
Comment 9•7 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in
before you can comment on or make changes to this bug.
Description
•