Open Bug 1935191 Opened 2 months ago Updated 2 months ago

Use fuses to optimize IsOptimizableInitForMapOrSet

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

People

(Reporter: jandem, Unassigned)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [sp3])

This function is used to determine if we can optimize new Set(array) with a fast path. Bug 1933557 is adding support for Map and renaming it to IsOptimizableInitForMapOrSet.

The checks at the end, for the iterator protocol, could probably be replaced with a fuse check now. It may also be possible then to make this function infallible and return optimized directly instead of as outparam.

This would also make it easier to eventually optimize new Map(iterable) and new Set(iterable) more from JIT code. If this function and the array optimization can no longer trigger a GC, we could call it with callWithABI and if that returns "can't optimize" we could call MapConstructorInit or SetConstructorInit directly from JIT code which is a lot faster than the current call into self-hosted code from C++. See bug 1933557 comment 1.

We could also use a fuse to optimize the code checking that Set.prototype.add and Map.prototype.set are the original builtin functions. This would get rid of a relatively slow property lookup on the prototype object.

Blocks: 1935193
Severity: -- → N/A
Priority: -- → P2
Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.