src/jdk/nashorn/internal/objects/NativeArray.java
Print this page
*** 74,84 ****
private static final MethodHandle MAP_CALLBACK_INVOKER = createIteratorCallbackInvoker(Object.class);
private static final MethodHandle FILTER_CALLBACK_INVOKER = createIteratorCallbackInvoker(boolean.class);
private static final MethodHandle REDUCE_CALLBACK_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
Object.class, Undefined.class, Object.class, Object.class, int.class, Object.class);
! private static final MethodHandle CALL_CMP = Bootstrap.createDynamicInvoker("dyn:call", int.class,
ScriptFunction.class, Object.class, Object.class, Object.class);
private static final InvokeByName TO_LOCALE_STRING = new InvokeByName("toLocaleString", ScriptObject.class, String.class);
--- 74,84 ----
private static final MethodHandle MAP_CALLBACK_INVOKER = createIteratorCallbackInvoker(Object.class);
private static final MethodHandle FILTER_CALLBACK_INVOKER = createIteratorCallbackInvoker(boolean.class);
private static final MethodHandle REDUCE_CALLBACK_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
Object.class, Undefined.class, Object.class, Object.class, int.class, Object.class);
! private static final MethodHandle CALL_CMP = Bootstrap.createDynamicInvoker("dyn:call", double.class,
ScriptFunction.class, Object.class, Object.class, Object.class);
private static final InvokeByName TO_LOCALE_STRING = new InvokeByName("toLocaleString", ScriptObject.class, String.class);
*** 821,831 ****
return -1;
}
if (cmp != null) {
try {
! return (int)CALL_CMP.invokeExact(cmp, cmpThis, x, y);
} catch (final RuntimeException | Error e) {
throw e;
} catch (final Throwable t) {
throw new RuntimeException(t);
}
--- 821,832 ----
return -1;
}
if (cmp != null) {
try {
! double res = (double)CALL_CMP.invokeExact(cmp, cmpThis, x, y);
! return (int)Math.signum(res);
} catch (final RuntimeException | Error e) {
throw e;
} catch (final Throwable t) {
throw new RuntimeException(t);
}