a stock 5.9 is probably safe to 6K but more than likely would run out of breath well before then.
with ARP bolts and aftermarket (lighter, forged) pistons i don't see why it couldn't live to 7 (with proper oiling mods)
but again, without an induction system that could support that it's kind of a moot point. the valve springs and ports will let you know how far you can go.
i guess the point i'm trying to make is that basing a decision on high RPM output because of cubic inches, when you'll rarely, if ever, need or exceed that threshold is kind of shooting yourself in the foot when the trade off is torque and easier production of power due to more CI.
there's tons of online tutorials and porting templates for the home porter, so go nuts. what's the worst that happens? you goober one up and gotta go to the yard and get another?
building that 340 would easily cost 3X as much as snapping together a 5.9 for the same power.