Reviewers: Michael Starzinger,

Message:
Hey Michi,
Here's the random cleanup. PTAL
-- Benedikt

Description:
Introduce a RandonNumberGenerator class. Refactor the random/private_random uses
in Isolate/Context.

The RandomNumberGenerator is a proper pseudorandom number generator
with 48-bit state. It is properly seeded using either

(1) the --random-seed if specified, or
(2) the entropy_source function if configured, or
(3) /dev/urandom if available, or
(4) falls back to Time and TimeTicks based seeding.

Each Isolate now contains a RandomNumberGenerator, which replaces
the previous private_random_seed.

Every native context still has its own random_seed. But this random
seed is now properly initialized during ConfigureGlobalObjects,
instead of on-demand initialization. This will allow us to cleanup
and speedup the HRandom implementation quite a lot (this is delayed
for a followup CL)!

Also stop messing with the system rand()/random(), which should
not be done from a library anyway! We probably re-seeded the
libc rand()/random() after the application (i.e. Chrome) already
seeded it (with better entropy than what we used).

Another followup CL will replace the use of the per-isolate
random number generator for the address randomization and
thereby get rid of the Isolate::UncheckedCurrent() usage in
the platform code.

TEST=cctest/test-random-number-generator,cctest/test-random

Please review this at https://codereview.chromium.org/23548024/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+370, -209 lines):
  M src/api.cc
  M src/assembler.cc
  M src/bootstrapper.cc
  M src/flags.h
  M src/heap.cc
  M src/isolate.h
  M src/objects.cc
  M src/platform-cygwin.cc
  M src/platform-freebsd.cc
  M src/platform-linux.cc
  M src/platform-macos.cc
  M src/platform-openbsd.cc
  M src/platform-posix.cc
  M src/platform-solaris.cc
  M src/platform-win32.cc
  M src/platform.h
  M src/platform/time.h
  A src/utils/random-number-generator.h
  A src/utils/random-number-generator.cc
  M src/v8.h
  M src/v8.cc
  M test/cctest/cctest.gyp
  M test/cctest/test-assembler-x64.cc
  M test/cctest/test-platform-linux.cc
  M test/cctest/test-platform-win32.cc
  A + test/cctest/test-random-number-generator.cc
  M test/cctest/test-random.cc
  M test/cctest/test-spaces.cc
  M test/cctest/test-strings.cc
  M test/cctest/test-strtod.cc
  M test/cctest/test-utils.cc
  M tools/gyp/v8.gyp


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to