Fixed incorrect assumption about BIT_AND on smis on ARM.
Review URL: http://codereview.chromium.org/6677075
git-svn-id: http://v8.googlecode.com/svn/branches/3.0@7191 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc
index cd65687..39d3e61 100644
--- a/src/arm/codegen-arm.cc
+++ b/src/arm/codegen-arm.cc
@@ -1153,7 +1153,7 @@
}
// Check that the *signed* result fits in a smi. Not necessary for AND, SAR
// if the shift if more than 0 or SHR if the shit is more than 1.
- if (!( (op_ == Token::AND) ||
+ if (!( (op_ == Token::AND && value_ >= 0) ||
((op_ == Token::SAR) && (shift_value > 0)) ||
((op_ == Token::SHR) && (shift_value > 1)))) {
__ add(r3, int32, Operand(0x40000000), SetCC);
@@ -1414,8 +1414,10 @@
default: UNREACHABLE();
}
deferred->BindExit();
- TypeInfo result_type =
- (op == Token::BIT_AND) ? TypeInfo::Smi() : TypeInfo::Integer32();
+ TypeInfo result_type = TypeInfo::Integer32();
+ if (op == Token::BIT_AND && int_value >= 0) {
+ result_type = TypeInfo::Smi();
+ }
frame_->EmitPush(tos, result_type);
}
break;
diff --git a/src/version.cc b/src/version.cc
index 086b375..9b004bb 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 0
#define BUILD_NUMBER 12
-#define PATCH_LEVEL 33
+#define PATCH_LEVEL 34
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
diff --git a/test/mjsunit/bitops-info.js b/test/mjsunit/bitops-info.js
index 4660fdf..4b114c5 100644
--- a/test/mjsunit/bitops-info.js
+++ b/test/mjsunit/bitops-info.js
@@ -37,7 +37,6 @@
return 1600822924; // It's a signed Int32.
}
-
function f() {
var x = non_int32(); // Not a constant.
var y = hidden_smi(); // Not a constant.
@@ -66,6 +65,13 @@
assertEquals(46512102 & 2600822924, x & y, "10rev");
assertEquals(1600822924 & 2600822924, x & z, "11rev");
+ assertEquals((46512102 & -0x20123456) | 1, (y & -0x20123456) | 1, "12");
+ assertEquals((1600822924 & -0x20123456) | 1, (z & -0x20123456) | 1, "13");
+ assertEquals((2600822924 & -0x20123456) | 1, (x & -0x20123456) | 1, "14");
+ assertEquals((46512102 & -0x20123456) | 1, (-0x20123456 & y) | 1, "12rev");
+ assertEquals((1600822924 & -0x20123456) | 1, (-0x20123456 & z) | 1, "13rev");
+ assertEquals((2600822924 & -0x20123456) | 1, (-0x20123456 & x) | 1, "14rev");
+
assertEquals(2600822924 & 2600822924, x & x, "xx");
assertEquals(y, y & y, "yy");
assertEquals(z, z & z, "zz");