Reviewers: fschneider, danno, Paul Lind, kisg, Philippe,
Description:
MIPS: Ensure proper alignment of LazyInstance objects.
The template system converts the actual struct type to an array of chars.
Make sure the alignment is kept by the compiler.
This fixes a lot of serialization-related HW tests, for example cctest
test-serialize/Serialize.
BUG=
TEST=cctest test-serialize
Please review this at http://codereview.chromium.org/9702114/
Affected files:
M src/lazy-instance.h
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
+#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);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev