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

Unified Diff: src/lazy-instance.h

Issue 9702114: MIPS: Ensure proper alignment of LazyInstance objects. (Closed)
Patch Set: Created 8 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy-instance.h
diff --git a/src/lazy-instance.h b/src/lazy-instance.h
index 09dfe2154dc2992305a0b04787d8c3cca3391193..9748bb522996037e6069b5ed29a5a1f2b4530574 100644
--- a/src/lazy-instance.h
+++ b/src/lazy-instance.h
@@ -104,9 +104,15 @@ struct LeakyInstanceTrait {
// Traits that define how an instance is allocated and accessed.
+#if V8_HOST_ARCH_MIPS
danno 2012/03/16 12:40:08 I'd prefer avoiding the platform-specific define.
+#define LAZY_ALIGN(x) __attribute__((aligned(__alignof__(x))))
+#else // V8_HOST_ARCH_MIPS
+#define LAZY_ALIGN(x)
+#endif
+
template <typename T>
struct StaticallyAllocatedInstanceTrait {
- typedef char StorageType[sizeof(T)];
+ typedef char StorageType[sizeof(T)] LAZY_ALIGN(T);
static T* MutableInstance(StorageType* storage) {
return reinterpret_cast<T*>(storage);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698