src/jdk/nashorn/internal/codegen/CodeGenerator.java
Print this page
*** 1843,1853 ****
final Type type = expression.getType();
// If expression not int see if we can convert, if not use deflt to trigger default.
if (!type.isInteger()) {
method.load(deflt);
! method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, type.getTypeClass(), int.class));
}
// If reasonable size and not too sparse (80%), use table otherwise use lookup.
if (range > 0 && range < 4096 && range < (size * 5 / 4)) {
final Label[] table = new Label[range];
--- 1843,1854 ----
final Type type = expression.getType();
// If expression not int see if we can convert, if not use deflt to trigger default.
if (!type.isInteger()) {
method.load(deflt);
! final Class exprClass = type.getTypeClass();
! method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, exprClass.isPrimitive()? exprClass : Object.class, int.class));
}
// If reasonable size and not too sparse (80%), use table otherwise use lookup.
if (range > 0 && range < 4096 && range < (size * 5 / 4)) {
final Label[] table = new Label[range];