8044786: Some tests fail with non-optimistic compilation

Reviewed-by: hannesw, jlaskey
This commit is contained in:
Attila Szegedi 2014-08-06 10:42:46 +02:00
parent 15e6c25a6a
commit 1eb6e5cb42
9 changed files with 20 additions and 8 deletions

View File

@ -80,7 +80,8 @@ public final class NativeUint8ClampedArray extends ArrayBufferView {
private static final MethodHandle GET_ELEM = specialCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "getElem", int.class, int.class).methodHandle();
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
private static final MethodHandle RINT = staticCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "rint", double.class, double.class).methodHandle();
private static final MethodHandle RINT_D = staticCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "rint", double.class, double.class).methodHandle();
private static final MethodHandle RINT_O = staticCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "rint", Object.class, Object.class).methodHandle();
private static final MethodHandle CLAMP_LONG = staticCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "clampLong", long.class, long.class).methodHandle();
private Uint8ClampedArrayData(final ByteBuffer nb, final int start, final int end) {
@ -109,8 +110,10 @@ public final class NativeUint8ClampedArray extends ArrayBufferView {
public MethodHandle getElementSetter(final Class<?> elementType) {
final MethodHandle setter = super.getElementSetter(elementType); //getContinuousElementSetter(getClass(), setElem(), elementType);
if (setter != null) {
if (elementType == double.class) {
return MH.filterArguments(setter, 2, RINT);
if (elementType == Object.class) {
return MH.filterArguments(setter, 2, RINT_O);
} else if (elementType == double.class) {
return MH.filterArguments(setter, 2, RINT_D);
} else if (elementType == long.class) {
return MH.filterArguments(setter, 2, CLAMP_LONG);
}
@ -190,6 +193,11 @@ public final class NativeUint8ClampedArray extends ArrayBufferView {
return (int)Math.rint(rint);
}
@SuppressWarnings("unused")
private static Object rint(final Object rint) {
return rint(JSType.toNumber(rint));
}
@SuppressWarnings("unused")
private static long clampLong(final long l) {
if(l < 0L) {

View File

@ -818,9 +818,8 @@ public final class ScriptRuntime {
/** ECMA 11.9.6 The Strict Equality Comparison Algorithm */
private static boolean strictEquals(final Object x, final Object y) {
if(x == y) {
return true;
}
// NOTE: you might be tempted to do a quick x == y comparison. Remember, though, that any Double object having
// NaN value is not equal to itself by value even though it is referentially.
final JSType xType = JSType.ofNoFunction(x);
final JSType yType = JSType.ofNoFunction(y);

View File

@ -41,6 +41,6 @@ str +="g()";
try {
eval(str);
} catch (e) {
print(e.stack.replace(/\\/g, '/'));
print(e.stack.replace(/\\/g, '/').replace(/<eval>@[0-9]+/, '<eval>@<id>'));
}

View File

@ -1,3 +1,3 @@
ReferenceError: "g" is not defined
at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@1:-1)
at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@<id>:-1)
at <program> (test/script/basic/JDK-8030182_2.js:42)

View File

@ -25,6 +25,7 @@
* @test
* @bug 8036987, 8037572
* @summary Implement tests that checks static types in the compiled code
* @option --optimistic-types=true
* @run
*/

View File

@ -25,6 +25,7 @@
* @test
* @bug 8036987, 8037572
* @summary Implement tests that checks static types in the compiled code
* @option --optimistic-types=true
* @run
*/

View File

@ -25,6 +25,7 @@
* @test
* @bug 8036987, 8037572
* @summary Implement tests that checks static types in the compiled code
* @option --optimistic-types=true
* @run
*/

View File

@ -29,6 +29,7 @@
* @fork
* @option -Dnashorn.debug=true
* @option --log=recompile:quiet
* @option --optimistic-types=true
*/
print(Debug);

View File

@ -28,6 +28,7 @@
* @fork
* @option -Dnashorn.debug=true
* @option --log=recompile:quiet
* @option --optimistic-types=true
*/
var forName = java.lang.Class["forName(String)"];