Revision: 10820
Author: [email protected]
Date: Fri Feb 24 02:59:12 2012
Log: Fix HConstant's hash function for smis on x64.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/9466003
http://code.google.com/p/v8/source/detail?r=10820
Modified:
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/test/mjsunit/mjsunit.status
/branches/bleeding_edge/test/mjsunit/regress/regress-1969.js
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri Feb 24 00:46:10
2012
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Fri Feb 24 02:59:12
2012
@@ -2457,7 +2457,12 @@
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
=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit.status Thu Feb 23 06:50:08
2012
+++ /branches/bleeding_edge/test/mjsunit/mjsunit.status Fri Feb 24 02:59:12
2012
@@ -66,7 +66,7 @@
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 ]
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-1969.js Thu Feb 23
05:59:35 2012
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-1969.js Fri Feb 24
02:59:12 2012
@@ -31,12 +31,14 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
a[4997]=0;
a[4998]=0;
a[4999]=0;
-}
+ return a;
+}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev