I think 1984 has the AMC 4-banger, earlier 80's used the GM Iron Duke. One is 150 cid, the other 151. Supposedly the GM engine was OK for a carbed 4-cylinder, but the AMC leaves a lot to be desired...even though its the base for later 2.5L MPI engines used all the way til TJ/XJ exit.
I think the 1980-86 258s will bolt right in to the tranny, but the its probably a weak T4 or SR4 that should be replaced with the engine (assuming manual, not sure about the autos). Keep the D300 t-case, find a 258 with T176 if you are alright with a 6-cylinder...or go 4.0L swap. The engine mounts between 4 cyl, and 6 (including 4.0L) might be the same, can't remember. Radiator is different.
The bonus with 4-banger is that CJ-8 should have 4.10 widetrack axles, not the crappy 2.73 gears AMC used with 80s model I6 CJ's.
AMC V-8 swaps require at least one motor mount change from I6 setup, pass. side IIRC. You will need adapters to get the D300 to fit behind any stock AMC engine/tranny combo.