When invokedynamic and invokehandle call sites are linked the target is a method handle adapter (static method) with a type erased signature. This also means the return type of the method is now java.lang.Object while in reality it's a more concrete type.
In certain situations with inlining this can cause type mismatches.
Nashorn revision:
changeset: 2266:d151cc49ad86
tag: tip
user: lagergren
date: Wed May 16 18:43:17 2012 +0200
summary: removed debug printout
has exactly this problem. Running any test like crypto shows this behavior:
$ java -jar dist/nashorn.jar test/performance/runcrypto.js
...
# Internal Error (/home/cthaling/7192167/src/share/vm/opto/parse3.cpp:125), pid=22819, tid=2807036784
# assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed