When a company filled out the I-129 petition, they selected either Extension of Status/Change of Status, or Consular Processing. Since you were in the US, they almost certainly selected Extension of Status/Change of Status, so there are actually two things that are applied for: 1) the H-1b petition itself, and 2) an Extension of Status.
Generally, if you leave the US when a Change of Status or Extension of Status application is pending, it is automatically abandoned. This is because "status" is something that only exists while in the US, and if you leave, you have no "status" to change or extend anymore. Even if you were to return to the US under your old petition while the petition extension is pending, the Extension of Status application does not revive -- once it's abandoned it's gone. The only way to apply for an Extension of Status again is if your company files another I-129 when you are in the US.
On the other hand, the H-1b petition extension application itself will continue regardless of how you travel in or out of the US, as it does not depend on where you are (e.g. people outside the US can be petitioned too). So what will likely happen is that the petition extension will eventually be approved, but with no Extension of Status (and thus no new period of stay).
The only way to get a new period of stay would be to leave and re-enter the US using an H-1b visa. (Note that you will be admitted for the validity of the petition you have with you when you enter. So if you only have the old petition and the new petition isn't approved yet, you can only be admitted until the expiration of the old petition, and you must leave at that point because you have no pending Extension of Status application. If you enter after you have the approval of the new petition, you will be admitted until the expiration of the new petition. If your old petition is expired and the new petition is not yet approved, you will not be able to enter or stay in the US.)