Bug 1325771 - js:jit: Make sure JitCode has at least 4 bytes alignment. r?jandem draft
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Thu, 22 Dec 2016 22:20:47 +0100
changeset 458870 373fd1ad9a4d04da33d6fa3c17d6570a4da18179
parent 458869 652bb8d4e23d2a73b3ea797f7ea22f0bb808e9a4
child 458871 6bbe86126168479a54c4c50fc6801a6c93d4277e
push id41085
push userbmo:mh+mozilla@glandium.org
push dateWed, 11 Jan 2017 07:28:36 +0000
reviewersjandem
bugs1325771
milestone53.0a1
Bug 1325771 - js:jit: Make sure JitCode has at least 4 bytes alignment. r?jandem
js/src/jit/IonCode.h
--- a/js/src/jit/IonCode.h
+++ b/js/src/jit/IonCode.h
@@ -17,16 +17,20 @@
 #include "jit/ExecutableAllocator.h"
 #include "jit/ICStubSpace.h"
 #include "jit/IonOptimizationLevels.h"
 #include "jit/IonTypes.h"
 #include "js/UbiNode.h"
 #include "vm/TraceLogging.h"
 #include "vm/TypeInference.h"
 
+#ifndef __GNUC__
+#define __attribute__(x)
+#endif
+
 namespace js {
 namespace jit {
 
 class MacroAssembler;
 class PatchableBackedge;
 class IonBuilder;
 class IonICEntry;
 
@@ -156,17 +160,18 @@ class JitCode : public gc::TenuredCell
     // object can be allocated, nullptr is returned. On failure, |pool| is
     // automatically released, so the code may be freed.
     template <AllowGC allowGC>
     static JitCode* New(JSContext* cx, uint8_t* code, uint32_t bufferSize, uint32_t headerSize,
                         ExecutablePool* pool, CodeKind kind);
 
   public:
     static const JS::TraceKind TraceKind = JS::TraceKind::JitCode;
-};
+
+} __attribute__ ((aligned(4))); /* ensure alignment is at least 4 bytes */
 
 class SnapshotWriter;
 class RecoverWriter;
 class SafepointWriter;
 class SafepointIndex;
 class OsiIndex;
 class IonCache;
 class IonIC;