http://www.ailf.org/lac/lac_pa_010504.pdf
This the link to the full text of CSPA, which states very clearly how a child's age will be calculated during I-485 processing. Interested ones can read it through and find tons of useful informtion.
To make a long story short, the formula to calculate child's immigration age is:
immigration age = age at the time when first time* visa number becomes available after I-140 is approved - the time period during I-140 was pending
*USCIS specifically stated that in case of visa number availability retrogression, the earliest or first time visa number becomes current is used for age calculation.
Hope this is helpful for those who are facing this situation.