Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: src/v8.cc

Issue 7250005: Speed up V8 random number generator, reverting part of 8490. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8.cc
diff --git a/src/v8.cc b/src/v8.cc
index bd902e83e897f7adae4e27613c61d1257af006d9..11af057b1943971e156017284e7c5c6240a1bb87 100644
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -101,7 +101,7 @@ void V8::TearDown() {
static void seed_random(uint32_t* state) {
- for (int i = 0; i < 4; ++i) {
+ for (int i = 0; i < 2; ++i) {
state[i] = FLAG_random_seed;
while (state[i] == 0) {
state[i] = random();
@@ -119,10 +119,8 @@ static uint32_t random_base(uint32_t* state) {
// Mix the bits. Never replaces state[i] with 0 if it is nonzero.
state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16);
state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16);
- state[2] = 23208 * (state[2] & 0xFFFF) + (state[2] >> 16);
- state[3] = 27753 * (state[3] & 0xFFFF) + (state[3] >> 16);
- return ((state[2] ^ state[3]) << 16) + ((state[0] ^ state[1]) & 0xFFFF);
+ return (state[0] << 14) + (state[1] & 0x3FFFF);
}
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698