Open Bug 1149463 Opened 10 years ago Updated 4 months ago

Clean-up: IonMonkey should use ranged-based for loop.

Categories

(Core :: JavaScript Engine: JIT, defect, P5)

defect

Tracking

()

Tracking Status
firefox40 --- affected

People

(Reporter: nbp, Unassigned)

References

(Blocks 1 open bug)

Details

As Jason noted in Bug 1144366 comment 33, we can use ranged-based for loops in CodeGenerator-shared.cpp, but we have many more cases like that … The last point is that this notation is translated into { auto __range = … for (auto __begin = begin(__range), __end = end(__range); __begin != __end; ++__begin) { … } } Which means that we can even use this notation for loops over basic blocks, and instructions, uses and operands. The only constraint being that we would have to make a transparent wrapper class to select the correct begin/end functions for the basic blocks. for (auto block : Trpo(graph)) { for (auto ins : Trpo(block)) { } } TrpoClass<MIRGraph> Trpo(const MIRGraph &graph) { return TrpoClass<MIRGraph>(graph); } Where the TrpoClass contains a reference to the MIRGraph, and only provide the right begin and end functions over the MIRGraph implementation.
Priority: -- → P5
Severity: normal → S3
Blocks: sm-opt-jits
You need to log in before you can comment on or make changes to this bug.