Diff
Modified: trunk/LayoutTests/ChangeLog (181555 => 181556)
--- trunk/LayoutTests/ChangeLog 2015-03-16 14:58:26 UTC (rev 181555)
+++ trunk/LayoutTests/ChangeLog 2015-03-16 15:45:54 UTC (rev 181556)
@@ -1,3 +1,16 @@
+2015-03-16 Joseph Pecoraro <[email protected]>
+
+ Update Map/Set to treat -0 and 0 as the same value
+ https://bugs.webkit.org/show_bug.cgi?id=142709
+
+ Reviewed by Csaba Osztrogonác.
+
+ * js/basic-map-expected.txt:
+ * js/basic-set-expected.txt:
+ * js/script-tests/basic-map.js:
+ * js/script-tests/basic-set.js:
+ Update tests now that -0 and 0 are treated the same.
+
2015-03-16 Max Stepin <[email protected]>
Add APNG support
Modified: trunk/LayoutTests/js/basic-map-expected.txt (181555 => 181556)
--- trunk/LayoutTests/js/basic-map-expected.txt 2015-03-16 14:58:26 UTC (rev 181555)
+++ trunk/LayoutTests/js/basic-map-expected.txt 2015-03-16 15:45:54 UTC (rev 181556)
@@ -37,13 +37,14 @@
PASS map.size is 0
PASS map.set(-0, 1) is map
PASS map.set(0, 2) is map
+PASS map.size is 1
PASS map.set(Infinity, 3) is map
PASS map.set(-Infinity, 4) is map
PASS map.set(NaN, 5) is map
PASS map.set('0', 6) is map
PASS map.set(0.1, 7) is map
-PASS map.size is 7
-PASS map.get(-0) is 1
+PASS map.size is 6
+PASS map.get(-0) is 2
PASS map.get(0) is 2
PASS map.get(Infinity) is 3
PASS map.get(-Infinity) is 4
@@ -58,7 +59,7 @@
PASS map.has('0') is true
PASS map.has(0.1) is true
PASS map.delete(-0) is true
-PASS map.delete(0) is true
+PASS map.delete(0) is false
PASS map.delete(Infinity) is true
PASS map.delete(-Infinity) is true
PASS map.delete(NaN) is true
Modified: trunk/LayoutTests/js/basic-set-expected.txt (181555 => 181556)
--- trunk/LayoutTests/js/basic-set-expected.txt 2015-03-16 14:58:26 UTC (rev 181555)
+++ trunk/LayoutTests/js/basic-set-expected.txt 2015-03-16 15:45:54 UTC (rev 181556)
@@ -46,12 +46,13 @@
PASS set.size is 0
PASS set.add(-0) is set
PASS set.add(0) is set
+PASS set.size is 1
PASS set.add(Infinity) is set
PASS set.add(-Infinity) is set
PASS set.add(NaN) is set
PASS set.add('0') is set
PASS set.add(0.1) is set
-PASS set.size is 7
+PASS set.size is 6
PASS set.has(-0) is true
PASS set.has(0) is true
PASS set.has(Infinity) is true
@@ -60,7 +61,7 @@
PASS set.has('0') is true
PASS set.has(0.1) is true
PASS set.delete(-0) is true
-PASS set.delete(0) is true
+PASS set.delete(0) is false
PASS set.delete(Infinity) is true
PASS set.delete(-Infinity) is true
PASS set.delete(NaN) is true
Modified: trunk/LayoutTests/js/script-tests/basic-map.js (181555 => 181556)
--- trunk/LayoutTests/js/script-tests/basic-map.js 2015-03-16 14:58:26 UTC (rev 181555)
+++ trunk/LayoutTests/js/script-tests/basic-map.js 2015-03-16 15:45:54 UTC (rev 181556)
@@ -41,13 +41,14 @@
shouldBe("map.size", "0")
shouldBe("map.set(-0, 1)", "map")
shouldBe("map.set(0, 2)", "map")
+shouldBe("map.size", "1")
shouldBe("map.set(Infinity, 3)", "map")
shouldBe("map.set(-Infinity, 4)", "map")
shouldBe("map.set(NaN, 5)", "map")
shouldBe("map.set('0', 6)", "map")
shouldBe("map.set(0.1, 7)", "map")
-shouldBe("map.size", "7")
-shouldBe("map.get(-0)", "1")
+shouldBe("map.size", "6")
+shouldBe("map.get(-0)", "2")
shouldBe("map.get(0)", "2")
shouldBe("map.get(Infinity)", "3")
shouldBe("map.get(-Infinity)", "4")
@@ -64,7 +65,7 @@
shouldBeTrue("map.has(0.1)")
shouldBeTrue("map.delete(-0)")
-shouldBeTrue("map.delete(0)")
+shouldBeFalse("map.delete(0)")
shouldBeTrue("map.delete(Infinity)")
shouldBeTrue("map.delete(-Infinity)")
shouldBeTrue("map.delete(NaN)")
Modified: trunk/LayoutTests/js/script-tests/basic-set.js (181555 => 181556)
--- trunk/LayoutTests/js/script-tests/basic-set.js 2015-03-16 14:58:26 UTC (rev 181555)
+++ trunk/LayoutTests/js/script-tests/basic-set.js 2015-03-16 15:45:54 UTC (rev 181556)
@@ -48,12 +48,13 @@
shouldBe("set.size", "0")
shouldBe("set.add(-0)", "set")
shouldBe("set.add(0)", "set")
+shouldBe("set.size", "1")
shouldBe("set.add(Infinity)", "set")
shouldBe("set.add(-Infinity)", "set")
shouldBe("set.add(NaN)", "set")
shouldBe("set.add('0')", "set")
shouldBe("set.add(0.1)", "set")
-shouldBe("set.size", "7")
+shouldBe("set.size", "6")
shouldBeTrue("set.has(-0)")
shouldBeTrue("set.has(0)")
@@ -64,7 +65,7 @@
shouldBeTrue("set.has(0.1)")
shouldBeTrue("set.delete(-0)")
-shouldBeTrue("set.delete(0)")
+shouldBeFalse("set.delete(0)")
shouldBeTrue("set.delete(Infinity)")
shouldBeTrue("set.delete(-Infinity)")
shouldBeTrue("set.delete(NaN)")
Modified: trunk/Source/_javascript_Core/ChangeLog (181555 => 181556)
--- trunk/Source/_javascript_Core/ChangeLog 2015-03-16 14:58:26 UTC (rev 181555)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-03-16 15:45:54 UTC (rev 181556)
@@ -1,3 +1,14 @@
+2015-03-16 Joseph Pecoraro <[email protected]>
+
+ Update Map/Set to treat -0 and 0 as the same value
+ https://bugs.webkit.org/show_bug.cgi?id=142709
+
+ Reviewed by Csaba Osztrogonác.
+
+ * runtime/MapData.h:
+ (JSC::MapDataImpl<Entry>::KeyType::KeyType):
+ No longer special case -0. It will be treated as the same as 0.
+
2015-03-15 Joseph Pecoraro <[email protected]>
Web Inspector: Better handle displaying -0
Modified: trunk/Source/_javascript_Core/runtime/MapData.h (181555 => 181556)
--- trunk/Source/_javascript_Core/runtime/MapData.h 2015-03-16 14:58:26 UTC (rev 181555)
+++ trunk/Source/_javascript_Core/runtime/MapData.h 2015-03-16 15:45:54 UTC (rev 181556)
@@ -152,7 +152,7 @@
return;
}
double d = v.asDouble();
- if (std::isnan(d) || (std::signbit(d) && d == 0.0)) {
+ if (std::isnan(d)) {
value = v;
return;
}