From: oliver Date: Fri, 9 Nov 2007 04:32:55 +0000 (+0000) Subject: Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1. X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=84b2b2ef3a374c321ef0532a0c179488a8330ace Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1. Reviewed by Maciej. 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. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27630 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index eeef947c889a..4abf76bf64b9 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,19 @@ +2007-11-08 Oliver Hunt + + 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 - fix build diff --git a/JavaScriptCore/kjs/JSType.h b/JavaScriptCore/kjs/JSType.h index 1b7ad94c9917..1c9418c9e5ac 100644 --- a/JavaScriptCore/kjs/JSType.h +++ b/JavaScriptCore/kjs/JSType.h @@ -29,9 +29,9 @@ namespace KJS { */ enum JSType { UnspecifiedType = 0, - NumberType = 1, + UndefinedType = 1, BooleanType = 2, - UndefinedType = 3, + NumberType = 3, NullType = 4, StringType = 5, ObjectType = 6, diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index eaf559a37511..9ea2d8ccafe1 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,12 @@ +2007-11-08 Oliver Hunt + + Reviewed by Maciej. + + Layout test to guard against bit operation regressions. + + * fast/js/bitwise-and-on-undefined-expected.txt: Added. + * fast/js/bitwise-and-on-undefined.html: Added. + 2007-11-08 Dan Bernstein Reviewed by Beth Dakin. diff --git a/LayoutTests/fast/js/bitwise-and-on-undefined-expected.txt b/LayoutTests/fast/js/bitwise-and-on-undefined-expected.txt new file mode 100644 index 000000000000..601e64f5f801 --- /dev/null +++ b/LayoutTests/fast/js/bitwise-and-on-undefined-expected.txt @@ -0,0 +1,13 @@ +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 diff --git a/LayoutTests/fast/js/bitwise-and-on-undefined.html b/LayoutTests/fast/js/bitwise-and-on-undefined.html new file mode 100644 index 000000000000..889a281fc3b1 --- /dev/null +++ b/LayoutTests/fast/js/bitwise-and-on-undefined.html @@ -0,0 +1,55 @@ + + + + + + test of bitwise operators mixing integers, null, and undefined + + + + + This tests the bitwise operators work correctly in conjunction with undefined and null.
+ +
    + +