|
Introduce a RandonNumberGenerator class. Refactor the random/private_random uses in Isolate/Context.
The RandomNumberGenerator is a 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 bootstrapping,
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
R=mstarzinger@chromium.org
Committed: https://code.google.com/p/v8/source/detail?r=16612
Total comments: 23
Total comments: 10
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+390 lines, -213 lines) |
Patch |
|
M |
src/api.cc
|
View
|
1
2
3
4
5
|
2 chunks |
+3 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/assembler.cc
|
View
|
1
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/bootstrapper.cc
|
View
|
1
2
3
4
|
2 chunks |
+11 lines, -7 lines |
0 comments
|
Download
|
|
M |
src/flags.h
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/heap.cc
|
View
|
1
2
3
|
4 chunks |
+5 lines, -3 lines |
0 comments
|
Download
|
|
M |
src/isolate.h
|
View
|
1
2
3
4
5
|
3 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/isolate.cc
|
View
|
1
|
4 chunks |
+8 lines, -1 line |
0 comments
|
Download
|
|
M |
src/isolate-inl.h
|
View
|
1
|
2 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/objects.cc
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/platform.h
|
View
|
|
2 chunks |
+0 lines, -8 lines |
0 comments
|
Download
|
|
M |
src/platform-cygwin.cc
|
View
|
1
2
|
2 chunks |
+3 lines, -14 lines |
0 comments
|
Download
|
|
M |
src/platform-freebsd.cc
|
View
|
|
1 chunk |
+0 lines, -12 lines |
0 comments
|
Download
|
|
M |
src/platform-linux.cc
|
View
|
|
1 chunk |
+0 lines, -8 lines |
0 comments
|
Download
|
|
M |
src/platform-macos.cc
|
View
|
|
1 chunk |
+0 lines, -8 lines |
0 comments
|
Download
|
|
M |
src/platform-openbsd.cc
|
View
|
|
1 chunk |
+0 lines, -8 lines |
0 comments
|
Download
|
|
M |
src/platform-posix.cc
|
View
|
1
2
|
2 chunks |
+3 lines, -5 lines |
0 comments
|
Download
|
|
M |
src/platform-solaris.cc
|
View
|
|
1 chunk |
+0 lines, -12 lines |
0 comments
|
Download
|
|
M |
src/platform-win32.cc
|
View
|
1
2
|
4 chunks |
+4 lines, -20 lines |
0 comments
|
Download
|
|
M |
src/platform/time.h
|
View
|
1
2
3
|
2 chunks |
+18 lines, -0 lines |
0 comments
|
Download
|
|
A |
src/utils/random-number-generator.h
|
View
|
|
1 chunk |
+106 lines, -0 lines |
0 comments
|
Download
|
|
A |
src/utils/random-number-generator.cc
|
View
|
|
1 chunk |
+136 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/v8.h
|
View
|
|
1 chunk |
+0 lines, -5 lines |
0 comments
|
Download
|
|
M |
src/v8.cc
|
View
|
1
2
3
4
|
4 chunks |
+10 lines, -47 lines |
0 comments
|
Download
|
|
M |
test/cctest/cctest.gyp
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-assembler-x64.cc
|
View
|
|
7 chunks |
+0 lines, -7 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-platform-linux.cc
|
View
|
|
2 chunks |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-platform-win32.cc
|
View
|
|
2 chunks |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-random.cc
|
View
|
|
1 chunk |
+1 line, -10 lines |
0 comments
|
Download
|
|
A + |
test/cctest/test-random-number-generator.cc
|
View
|
|
1 chunk |
+52 lines, -15 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-spaces.cc
|
View
|
|
4 chunks |
+0 lines, -4 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-strings.cc
|
View
|
1
2
|
3 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-strtod.cc
|
View
|
|
3 chunks |
+4 lines, -3 lines |
0 comments
|
Download
|
|
M |
test/cctest/test-utils.cc
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
|
M |
tools/gyp/v8.gyp
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
Total messages: 6 (0 generated)
|