Open Bug 848352 Opened 11 years ago Updated 2 years ago

IonMonkey: Take the loop body size into consideration to increase useCount

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: h4writer, Unassigned)

References

(Blocks 1 open bug)

Details

Hitting this on v8-regexp. Some of the functions (runBlockX) don't get IM compiled, because usecount doesn't get high enough. That is because i.e. runBlock11 only iterates 2 times.

V8 does compile this function. They increase the useCount with the loop body size. And loop body of runBlock11 is very very big. I.e. it gets compiled.

It makes sense, because a small loop will execute really fast and the extra gained time by using an optimized compiled version of that loop is small. As the loop becomes larger, the gained time in the optimized version will also become bigger.

For v8-regexp that could yield an improvement of maximum 6%. (That's the improvement you get between usecount=0 and usecount=10000)
Blocks: 806646
(In reply to Hannes Verschore [:h4writer] from comment #0)
> They increase the useCount with the loop body
> size. And loop body of runBlock11 is very very big. I.e. it gets compiled.

I think this is a terrible idea when we are not keeping a clear semantic, things starts to become messy.

I'll recommend to go for what is suggested in Bug 825268, under the potential idea [3], which is to count the size of the bytecode which has been executed, by updating a bytecode counter on jumps (or only on backward jumps).
Assignee: general → nobody
Flags: needinfo?(lazyparser)
Flags: needinfo?(lazyparser)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.