Open Bug 901442 Opened 11 years ago Updated 8 months ago

Don't allocate an object when doing if(Object(x) === x)

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: bruant.d, Unassigned)

References

(Blocks 1 open bug)

Details

|if(Object(x) === x)| is recurrent boilerplate used to know whether a value is an object (because typeof is broken). Per spec, it's supposed to allocate an object if x isn't one (and return x if it is), so this particular pattern doesn't need the extra allocation of an object which will not be used (except for its identity)
Assignee: general → nobody
Severity: normal → S3

(Unclear if this is still a super common pattern)

Blocks: sm-js-perf
Severity: S3 → N/A
Type: defect → enhancement
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.