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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 1206723003: Function Layout, Global Variable Layout and Pooled Constants Layout Reordering (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fixed some comments in patch set 1 Created 5 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
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 55a0bfc638789fa9a2d49f03783d79762f9b0f5f..5fbc0f3a7e4c497ad1cc09b5fc9d48a09d6b2e46 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -239,6 +239,14 @@ void TargetDataX8632::emitConstantPool(GlobalContext *Ctx) {
Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",@progbits," << Align
<< "\n";
Str << "\t.align\t" << Align << "\n";
+
+ // If reorder-pooled-constants option is set to true, we need to shuffle the
+ // constant pool before emitting it.
+ if (Ctx->getFlags().shouldReorderPooledConstants())
+ RandomShuffle(Pool.begin(), Pool.end(), [Ctx](uint64_t N) {
+ return (uint32_t)Ctx->getRNG().next(N);
+ });
+
for (Constant *C : Pool) {
if (!C->getShouldBePooled())
continue;

Powered by Google App Engine
This is Rietveld 408576698