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

Unified Diff: src/IceTargetLoweringX8664Traits.h

Issue 1300993002: Use separate random number generator for each randomization pass (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Assign default value of ConstantBlindingCookie in its declaration Created 5 years, 4 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
Index: src/IceTargetLoweringX8664Traits.h
diff --git a/src/IceTargetLoweringX8664Traits.h b/src/IceTargetLoweringX8664Traits.h
index 4a1200415bc55cc2cb47782289e9212960facdc7..c2a9729dc4e05b6a51693969d1ebbd0f0256ef70 100644
--- a/src/IceTargetLoweringX8664Traits.h
+++ b/src/IceTargetLoweringX8664Traits.h
@@ -406,13 +406,18 @@ template <> struct MachineTraits<TargetX8664> {
REGX8664_TABLE
#undef X
- RandomNumberGeneratorWrapper RNG(Ctx->getRNG());
+ // Create a random number generator for regalloc randomization.
+ // Use function's sequence as the salt.
+ RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(),
+ RS_RegAllocRandomization,
+ Func->getSequenceNumber());
+ RandomNumberGeneratorWrapper RNGW(RNG);
// Shuffle the resulting equivalence classes.
for (auto I : EquivalenceClasses) {
const RegisterList &List = I.second;
RegisterList Shuffled(List);
- RandomShuffle(Shuffled.begin(), Shuffled.end(), RNG);
+ RandomShuffle(Shuffled.begin(), Shuffled.end(), RNGW);
for (size_t SI = 0, SE = Shuffled.size(); SI < SE; ++SI) {
Permutation[List[SI]] = Shuffled[SI];
++NumShuffled;

Powered by Google App Engine
This is Rietveld 408576698