+2007-11-08 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Maciej.
+
+ Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
+
+ The implementation of JSImmediate::areBothImmediateNumbers relies on
+ (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
+ a unique result when both immediate values are numbers.
+
+ The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
+ By swapping the value of NumberType and UndefinedType this ceases to be a problem.
+
+ * kjs/JSType.h:
+ (KJS::):
+
2007-11-08 Darin Adler <darin@apple.com>
- fix build
--- /dev/null
+This tests the bitwise operators work correctly in conjunction with undefined and null.
+SUCCESS: 0 & null = 0
+SUCCESS: 0 & undefined = 0
+SUCCESS: 1 & null = 0
+SUCCESS: 1 & undefined = 0
+SUCCESS: 0 | null = 0
+SUCCESS: 0 | undefined = 0
+SUCCESS: 1 | null = 1
+SUCCESS: 1 | undefined = 1
+SUCCESS: 0 ^ null = 0
+SUCCESS: 0 ^ undefined = 0
+SUCCESS: 1 ^ null = 1
+SUCCESS: 1 ^ undefined = 1
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>test of bitwise operators mixing integers, null, and undefined</title>
+ <style>
+ .failure { color: red; }
+ .success { color: green; }
+ </style>
+ <script type="text/javascript">
+
+ if (window.layoutTestController) layoutTestController.dumpAsText();
+
+ function log(msg) {
+ document.getElementById("log").innerHTML += msg;
+ }
+
+ function logTest(expression, expected) {
+ var result;
+ try {
+ result = eval(expression);
+ } catch (e) {
+ result = e;
+ }
+ if (result != expected)
+ log("<li class='failure'>FAILED: " + expression + " = " + result + " -- expected: " + expected + "</li>");
+ else
+ log("<li class='success'>SUCCESS: " + expression + " = " + result + "</li>");
+
+ }
+
+ function runTest() {
+ logTest("0 & null", 0);
+ logTest("0 & undefined", 0);
+ logTest("1 & null", 0);
+ logTest("1 & undefined", 0);
+ logTest("0 | null", 0);
+ logTest("0 | undefined", 0);
+ logTest("1 | null", 1);
+ logTest("1 | undefined", 1);
+ logTest("0 ^ null", 0);
+ logTest("0 ^ undefined", 0);
+ logTest("1 ^ null", 1);
+ logTest("1 ^ undefined", 1);
+ }
+
+ </script>
+
+ </head>
+ This tests the bitwise operators work correctly in conjunction with undefined and null.<br />
+ <body onload="runTest()">
+ <ul id="log"></ul>
+ </body>
+</html>