Since H1b has to pay social security tax and medical, H1b can be treated as resident alien automatically and does not matter how long you have been in US.
In your particularly case, you are only in US for two months this year, you are considered as dual status. In other words, you decide yourself whether you want to be treated as resident alien or non-resident alien.
You can find info on IRS website. I read it years ago, that is all I remember.