Index: src/lazy-instance.h |
diff --git a/src/lazy-instance.h b/src/lazy-instance.h |
index cdde2255ff19be0ef92c00f40916249769449665..9d68b8cacce0f0f4815f6a5940716df0ddf83bbb 100644 |
--- a/src/lazy-instance.h |
+++ b/src/lazy-instance.h |
@@ -111,9 +111,17 @@ struct LeakyInstanceTrait { |
// Traits that define how an instance is allocated and accessed. |
+// TODO(kalmard): __alignof__ is only defined for GCC > 4.2. Fix alignment issue |
+// on MIPS with other compilers. |
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) |
+#define LAZY_ALIGN(x) __attribute__((aligned(__alignof__(x)))) |
+#else |
+#define LAZY_ALIGN(x) |
+#endif |
+ |
template <typename T> |
struct StaticallyAllocatedInstanceTrait { |
- typedef char StorageType[sizeof(T)] V8_ALIGNAS(V8_ALIGNOF(T)); |
+ typedef char StorageType[sizeof(T)] LAZY_ALIGN(T); |
static T* MutableInstance(StorageType* storage) { |
return reinterpret_cast<T*>(storage); |
@@ -125,6 +133,8 @@ struct StaticallyAllocatedInstanceTrait { |
} |
}; |
+#undef LAZY_ALIGN |
+ |
template <typename T> |
struct DynamicallyAllocatedInstanceTrait { |