Revision: 4472
Author: [email protected]
Date: Thu Apr 22 02:38:06 2010
Log: 2.1.10.8: Patch 2.1 branch with bug fix change 4471
Review URL: http://codereview.chromium.org/1716005
http://code.google.com/p/v8/source/detail?r=4472
Modified:
/branches/2.1/src/ia32/codegen-ia32.cc
/branches/2.1/src/version.cc
/branches/2.1/src/x64/codegen-x64.cc
/branches/2.1/test/mjsunit/smi-ops.js
=======================================
--- /branches/2.1/src/ia32/codegen-ia32.cc Wed Apr 14 01:11:23 2010
+++ /branches/2.1/src/ia32/codegen-ia32.cc Thu Apr 22 02:38:06 2010
@@ -1179,16 +1179,23 @@
case Token::SAR:
if (left.is_smi()) return TypeInfo::Smi();
// Result is a smi if we shift by a constant >= 1, otherwise an
integer32.
+ // Shift amount is masked with 0x1F (ECMA standard 11.7.2).
return (right.is_constant() && right.handle()->IsSmi()
- && Smi::cast(*right.handle())->value() >= 1)
+ && (Smi::cast(*right.handle())->value() & 0x1F) >= 1)
? TypeInfo::Smi()
: TypeInfo::Integer32();
case Token::SHR:
- // Result is a smi if we shift by a constant >= 2, otherwise an
integer32.
- return (right.is_constant() && right.handle()->IsSmi()
- && Smi::cast(*right.handle())->value() >= 2)
- ? TypeInfo::Smi()
- : TypeInfo::Integer32();
+ // Result is a smi if we shift by a constant >= 2, an integer32 if
+ // we shift by 1, and an unsigned 32-bit integer if we shift by 0.
+ if (right.is_constant() && right.handle()->IsSmi()) {
+ int shift_amount = Smi::cast(*right.handle())->value() & 0x1F;
+ if (shift_amount > 1) {
+ return TypeInfo::Smi();
+ } else if (shift_amount > 0) {
+ return TypeInfo::Integer32();
+ }
+ }
+ return TypeInfo::Number();
case Token::ADD:
if (operands_type.IsSmi()) {
// The Integer32 range is big enough to take the sum of any two
Smis.
=======================================
--- /branches/2.1/src/version.cc Wed Apr 21 03:24:56 2010
+++ /branches/2.1/src/version.cc Thu Apr 22 02:38:06 2010
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 2
#define MINOR_VERSION 1
#define BUILD_NUMBER 10
-#define PATCH_LEVEL 7
+#define PATCH_LEVEL 8
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
=======================================
--- /branches/2.1/src/x64/codegen-x64.cc Fri Mar 26 02:27:16 2010
+++ /branches/2.1/src/x64/codegen-x64.cc Thu Apr 22 02:38:06 2010
@@ -5351,9 +5351,9 @@
result_type = TypeInfo::Smi();
break;
case Token::SHR:
- // Result of x >>> y is always a smi if y >= 1, otherwise a number.
+ // Result of x >>> y is always a smi if masked y >= 1, otherwise a
number.
result_type = (right.is_constant() && right.handle()->IsSmi()
- && Smi::cast(*right.handle())->value() >= 1)
+ && (Smi::cast(*right.handle())->value() & 0x1F) >= 1)
? TypeInfo::Smi()
: TypeInfo::Number();
break;
=======================================
--- /branches/2.1/test/mjsunit/smi-ops.js Thu Jan 14 07:28:53 2010
+++ /branches/2.1/test/mjsunit/smi-ops.js Thu Apr 22 02:38:06 2010
@@ -669,3 +669,12 @@
function shiftByZero(n) { return n << 0; }
assertEquals(3, shiftByZero(3.1415));
+
+// Verify that the static type information of x >>> 32 is computed
correctly.
+function LogicalShiftRightByMultipleOf32(x) {
+ x = x >>> 32;
+ return x + x;
+}
+
+assertEquals(4589934592, LogicalShiftRightByMultipleOf32(-2000000000));
+assertEquals(4589934592, LogicalShiftRightByMultipleOf32(-2000000000));
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev