Closed Bug 1667037 Opened 4 years ago Closed 4 years ago

Warp: Transpile CompareObjectUndefinedNullResult

Categories

(Core :: JavaScript Engine: JIT, task, P1)

task

Tracking

()

RESOLVED DUPLICATE of bug 1667244
Tracking Status
firefox83 --- affected

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(2 obsolete files)

Browsing (*) with IONFLAGS=warp-transpiler to detect ops which are widely used shows that CompareObjectUndefinedNullResult is a top-contender for transpilation.
Caveat: 499 of the 866 for CompareObjectUndefinedNullResult were on "www.redditstatic.com".

(*) Websites visited: wikipedia.org, reddit.com, cnn.com, youtube.com, google.com, instagram.com, amazon.com

CacheIR op Count
CompareObjectUndefinedNullResult 866
GuardHasGetterSetter 802
LoadDOMExpandoValueGuardGeneration 706
GuardAndGetIterator 448
LoadDOMExpandoValue 407
GuardIndexGreaterThanDenseInitLength 145
CallStringObjectConcatResult 24
LoadDOMExpandoValueIgnoreGeneration 17
LoadDenseElementHoleExistsResult 16
CallClassHook 15
GuardIsNativeObject 12
GuardFunctionIsNonBuiltinCtor 8

CompareObjectUndefinedNullResult is only used for loose equality.

You should really come on Matrix sometimes. I was just looking into comparisons with undefined/null as well. I think we really need to handle at least {null, undefined, object} x {null, undef} in one stub to make it easier to transpile. That would be useful for functions like this that are called either with undefined or some object.

function f (x) {
   if (x  === undefined) { x = {bla: 1}; }
}

We should also do this for strict equality. Otherwise we probably end up with two "active" stubs: StrictNullUndefinedEquality and StrictDifferentTypes.

(In reply to Tom Schuster [:evilpie] from comment #3)

I was just looking into comparisons with undefined/null as well.

Whoops. My patch doesn't do anything fancy, so hopefully there shouldn't be any duplicated work. Do you want me to withdraw both patches, if they end up being superseded by your work anyway?

I think we really need to handle at least {null, undefined, object} x {null, undef} in one stub to make it easier to transpile. [...]
We should also do this for strict equality. Otherwise we probably end up with two "active" stubs: StrictNullUndefinedEquality and StrictDifferentTypes.

Yes, that sounds reasonable. I've also seen this issue for RegExp built-ins, where RegExpMatch returns null or object and callers compare with matchResult === null. In my dataset, StrictEq and StrictNe where among the JSOps with the most multiple active stubs:

Op Count (>1000)
JSOp::Call 1206
JSOp::CallProp 1291
JSOp::GetElem 2584
JSOp::GetProp 9467
JSOp::SetProp 1003
JSOp::StrictEq 3657
JSOp::StrictNe 3986
Severity: -- → N/A
Priority: -- → P1

I think we can just land the second patch, because the Ion code can already handle more undefined comparisons. I am going to try and extend CompareObjectUndefinedNullResult to also handle undefined == undefined.

(In reply to Tom Schuster [:evilpie] from comment #6)

See bug 1667037.

Bug 1667244 replaces CompareObjectUndefinedNullResult, so I think I'll withdraw both patches and we can close this bug as a dup of bug 1667244.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Attachment #9177587 - Attachment is obsolete: true
Attachment #9177588 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: