Commit baabb87d authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix HConstant's hash function for smis on x64.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9466003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10820 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a6083af4
......@@ -2457,7 +2457,12 @@ class HConstant: public HTemplateInstruction<0> {
virtual intptr_t Hashcode() {
ASSERT(!HEAP->allow_allocation(false));
return reinterpret_cast<intptr_t>(*handle());
intptr_t hash = reinterpret_cast<intptr_t>(*handle());
// Prevent smis from having fewer hash values when truncated to
// the least significant bits.
const int kShiftSize = kSmiShiftSize + kSmiTagSize;
STATIC_ASSERT(kShiftSize != 0);
return hash ^ (hash >> kShiftSize);
}
#ifdef DEBUG
......
......@@ -66,7 +66,7 @@ debug-liveedit-check-stack: SKIP
debug-liveedit-patch-positions-replace: SKIP
# Test Crankshaft compilation time. Expected to take too long in debug mode.
regress/regress-1969: PASS, SKIP if ($mode == debug || $arch == x64)
regress/regress-1969: PASS, SKIP if $mode == debug
##############################################################################
[ $isolates ]
......
......@@ -31,12 +31,14 @@ f();
f();
%OptimizeFunctionOnNextCall(f);
var start = (new Date()).getTime();
f();
var array = f();
var end = (new Date()).getTime();
// Assert that recompiling and executing f() takes less than a second.
assertTrue((end - start) < 1000);
for (var i = 0; i < 5000; i++) assertEquals(0, array[i]);
function f() {
var a = new Array(5000);
a[0]=0;
......@@ -162,7 +164,7 @@ function f() {
a[120]=0;
a[121]=0;
a[122]=0;
a[0]=0;
a[123]=0;
a[124]=0;
a[125]=0;
a[126]=0;
......@@ -1162,7 +1164,7 @@ function f() {
a[1120]=0;
a[1121]=0;
a[1122]=0;
a[10]=0;
a[1123]=0;
a[1124]=0;
a[1125]=0;
a[1126]=0;
......@@ -1269,16 +1271,16 @@ function f() {
a[1227]=0;
a[1228]=0;
a[1229]=0;
a[00]=0;
a[01]=0;
a[02]=0;
a[03]=0;
a[04]=0;
a[05]=0;
a[06]=0;
a[07]=0;
a[08]=0;
a[09]=0;
a[1230]=0;
a[1231]=0;
a[1232]=0;
a[1233]=0;
a[1234]=0;
a[1235]=0;
a[1236]=0;
a[1237]=0;
a[1238]=0;
a[1239]=0;
a[1240]=0;
a[1241]=0;
a[1242]=0;
......@@ -2162,7 +2164,7 @@ function f() {
a[2120]=0;
a[2121]=0;
a[2122]=0;
a[20]=0;
a[2123]=0;
a[2124]=0;
a[2125]=0;
a[2126]=0;
......@@ -3162,7 +3164,7 @@ function f() {
a[3120]=0;
a[3121]=0;
a[3122]=0;
a[30]=0;
a[3123]=0;
a[3124]=0;
a[3125]=0;
a[3126]=0;
......@@ -4162,7 +4164,7 @@ function f() {
a[4120]=0;
a[4121]=0;
a[4122]=0;
a[40]=0;
a[4123]=0;
a[4124]=0;
a[4125]=0;
a[4126]=0;
......@@ -5039,4 +5041,5 @@ function f() {
a[4997]=0;
a[4998]=0;
a[4999]=0;
return a;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment