src/jdk/nashorn/internal/codegen/CodeGenerator.java

changeset 405
b1980b5f00a1
parent 401
313bdcd2fd22
child 407
961cffae0828
equal deleted inserted replaced
404:18d467e94150 405:b1980b5f00a1
1845 final Type type = expression.getType(); 1845 final Type type = expression.getType();
1846 1846
1847 // If expression not int see if we can convert, if not use deflt to trigger default. 1847 // If expression not int see if we can convert, if not use deflt to trigger default.
1848 if (!type.isInteger()) { 1848 if (!type.isInteger()) {
1849 method.load(deflt); 1849 method.load(deflt);
1850 final Class exprClass = type.getTypeClass(); 1850 final Class<?> exprClass = type.getTypeClass();
1851 method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, exprClass.isPrimitive()? exprClass : Object.class, int.class)); 1851 method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, exprClass.isPrimitive()? exprClass : Object.class, int.class));
1852 } 1852 }
1853 1853
1854 // If reasonable size and not too sparse (80%), use table otherwise use lookup. 1854 // If reasonable size and not too sparse (80%), use table otherwise use lookup.
1855 if (range > 0 && range < 4096 && range < (size * 5 / 4)) { 1855 if (range > 0 && range < 4096 && range < (size * 5 / 4)) {

mercurial