# HG changeset patch # User asaha # Date 1501135300 25200 # Node ID 61d4d4c092ea786a8d4c66d0c7b785afe43660cf # Parent e474dc29c216579d7a12dcaf3fa283a2a9aa7adc# Parent d1be8f669e5c6bd7f703e0f980f7ee9f3af17079 Merge diff -r e474dc29c216 -r 61d4d4c092ea .hgtags --- a/.hgtags Fri Jul 14 14:30:06 2017 -0700 +++ b/.hgtags Wed Jul 26 23:01:40 2017 -0700 @@ -701,6 +701,8 @@ 2c1a74bca789006be1cc7fc642048ade06fef2f2 jdk8u141-b13 8c329eab0dac3630854a56f2485f9862040bffdf jdk8u141-b14 dfb2e076f381c4ea8c84ae0309a2072ec3ac92b8 jdk8u141-b15 +6a52d202dfa3395d90cdd7dc24b8c437e5acc03d jdk8u144-b00 +7de0a688b0d910d4ef2cb89da6623b3ded431276 jdk8u144-b01 6f50b0c7c275324f76cf7f09606949195fd65f92 jdk8u141-b31 59bf0950e077f66d1f6c5ef4a3f1489b2b2048fa jdk8u141-b32 6a5473932aff2d9c0df2cdc6e1800dd7c374232f jdk8u151-b00 @@ -708,6 +710,28 @@ 296b5f81b2c28b5d7eea4a7051eae0ec34f5ec05 jdk8u151-b02 c0828d5abc8646c80236fae42d971477bfc74748 jdk8u151-b03 a593aff280ac5472a23923604f1a25c8e80e6ec7 jdk8u151-b04 +178207e92304e6717c1b2e80c56424efe4e69204 jdk8u151-b05 +b9ed966e2b873528553e27a791298205e1bc7cb5 jdk8u151-b06 +18eb73eb84c5395b3efcafa43ce224565eca02b3 jdk8u122-b00 +9e615ea961fe5732813ed7b273606e7337ea2234 jdk8u122-b01 +2f0b11882cb7ddb10e35682ab9e8343919a71c54 jdk8u122-b02 +df2a2824284f97c5edb9b9c2e6d18bb4ff838199 jdk8u122-b03 +df2a2824284f97c5edb9b9c2e6d18bb4ff838199 jdk8u122-b03 +0000000000000000000000000000000000000000 jdk8u122-b03 +0000000000000000000000000000000000000000 jdk8u122-b03 +12650d23a8fd1b27a0d28c6a276fdecf01805294 jdk8u122-b03 +3c3b4e793e7c6255a840844db077ef466940035c jdk8u122-b04 +30dc0c72f3d0aff34b6d421208b18f384d05d761 jdk8u132-b00 +91d33aea2714e63796eeab0e63e38c9d2568c00c jdk8u152-b00 +50dac2fd8689dbb820d887ce3919708d5d042891 jdk8u152-b01 +01bbd310156db7a75a46a7320d1f49beff844472 jdk8u152-b02 +2a01d94fea9a86b4038a93622f62b0986083f67e jdk8u152-b03 +9dce75561a92f096d822ebb7eb76810f191fe522 jdk8u152-b04 +cdb7d9454d254e95c73d6dc77077ab2c198e2ad6 jdk8u152-b05 +2be667f12b54fc5b57b147f60851ee63ff02e5fa jdk8u152-b06 +a44dcdfa00bee9261012f10bd3f06bea1fec4340 jdk8u152-b07 +d0a8151a276c362a6e17068d9aa8ed583309d46e jdk8u152-b08 +37e94d764d7b98e3676e54f2ad346d721fdde113 jdk8u152-b09 18eb73eb84c5395b3efcafa43ce224565eca02b3 jdk8u122-b00 9e615ea961fe5732813ed7b273606e7337ea2234 jdk8u122-b01 2f0b11882cb7ddb10e35682ab9e8343919a71c54 jdk8u122-b02 diff -r e474dc29c216 -r 61d4d4c092ea src/jdk/nashorn/internal/objects/NativeDataView.java --- a/src/jdk/nashorn/internal/objects/NativeDataView.java Fri Jul 14 14:30:06 2017 -0700 +++ b/src/jdk/nashorn/internal/objects/NativeDataView.java Wed Jul 26 23:01:40 2017 -0700 @@ -416,7 +416,7 @@ * @return 32-bit unsigned int value at the byteOffset */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) - public static long getUint32(final Object self, final Object byteOffset, final Object littleEndian) { + public static double getUint32(final Object self, final Object byteOffset, final Object littleEndian) { try { return 0xFFFFFFFFL & getBuffer(self, littleEndian).getInt(JSType.toInt32(byteOffset)); } catch (final IllegalArgumentException iae) { @@ -432,7 +432,7 @@ * @return 32-bit unsigned int value at the byteOffset */ @SpecializedFunction - public static long getUint32(final Object self, final int byteOffset) { + public static double getUint32(final Object self, final int byteOffset) { try { return JSType.toUint32(getBuffer(self, false).getInt(JSType.toInt32(byteOffset))); } catch (final IllegalArgumentException iae) { @@ -449,7 +449,7 @@ * @return 32-bit unsigned int value at the byteOffset */ @SpecializedFunction - public static long getUint32(final Object self, final int byteOffset, final boolean littleEndian) { + public static double getUint32(final Object self, final int byteOffset, final boolean littleEndian) { try { return JSType.toUint32(getBuffer(self, littleEndian).getInt(JSType.toInt32(byteOffset))); } catch (final IllegalArgumentException iae) { @@ -837,9 +837,9 @@ * @return undefined */ @SpecializedFunction - public static Object setUint32(final Object self, final int byteOffset, final long value) { + public static Object setUint32(final Object self, final int byteOffset, final double value) { try { - getBuffer(self, false).putInt(byteOffset, (int)value); + getBuffer(self, false).putInt(byteOffset, (int) JSType.toUint32(value)); return UNDEFINED; } catch (final IllegalArgumentException iae) { throw rangeError(iae, "dataview.offset"); @@ -856,9 +856,9 @@ * @return undefined */ @SpecializedFunction - public static Object setUint32(final Object self, final int byteOffset, final long value, final boolean littleEndian) { + public static Object setUint32(final Object self, final int byteOffset, final double value, final boolean littleEndian) { try { - getBuffer(self, littleEndian).putInt(byteOffset, (int)value); + getBuffer(self, littleEndian).putInt(byteOffset, (int) JSType.toUint32(value)); return UNDEFINED; } catch (final IllegalArgumentException iae) { throw rangeError(iae, "dataview.offset"); diff -r e474dc29c216 -r 61d4d4c092ea test/script/basic/JDK-8181191.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/script/basic/JDK-8181191.js Wed Jul 26 23:01:40 2017 -0700 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8181191: getUint32 returning Long + * + * @test + * @run + */ + + +function uint32(x) { + var buffer = new ArrayBuffer(16); + var dataview = new DataView(buffer); + dataview.setUint32(0, x); + return dataview.getUint32(0); +} + +Assert.assertTrue(typeof uint32(0x7f) === 'number'); +Assert.assertTrue(typeof uint32(0x80) === 'number'); +Assert.assertTrue(typeof uint32(0xffffffff) === 'number'); +Assert.assertTrue(typeof uint32(0x100000000) === 'number'); + +Assert.assertTrue(uint32(0x7f) === 0x7f); +Assert.assertTrue(uint32(0x80) === 0x80); +Assert.assertTrue(uint32(0xffffffff) === 0xffffffff); +Assert.assertTrue(uint32(0x100000000) === 0x0); + +Assert.assertTrue(uint32(0x7f) === uint32(0x7f)); +Assert.assertTrue(uint32(0x80) === uint32(0x80)); +Assert.assertTrue(uint32(0xffffffff) === uint32(0xffffffff)); +Assert.assertTrue(uint32(0x100000000) === uint32(0x100000000));