I realize that we should probably rewrite this even more to reduce all the code duplication, but choose to leave that for later.
Bug: https://bugs.openjdk.java.net/browse/JDK-8041487 Webrev: http://cr.openjdk.java.net/~erikj/8041487/webrev.root.01/ /Erik