summaryrefslogtreecommitdiff
path: root/debian/patches/dyson-js-solaris-memory-layout.patch
blob: 41e2b47bd0ed0c6aea68948de254c6f80ca22e18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
Description: Patch for Solaris 64-bit memory layout
Bug-Dyson: http://osdyson.org/issues/160
Bug-Dyson: http://osdyson.org/issues/145
Bug-Dyson: http://osdyson.org/issues/159
Bug-Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=577056
Index: qtscript/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h
===================================================================
--- qtscript.orig/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h
+++ qtscript/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h
@@ -196,19 +196,43 @@ namespace JSC {
 
         static const int32_t signBit = 0x80000000;
  
+#if OS(SOLARIS64)
+// https://bugzilla.mozilla.org/show_bug.cgi?id=577056
+// Memory layout for 64-bit Solaris is different than other 64-bit systems.
+// http://developers.sun.com/solaris/articles/solaris_memory.html
+// User space memory may locate on PART-A (0xFFFFFD80.00000000 - 0xFFFF8000.00000000)
+// and PART-B (0x00008000.00000000 - 0x00000000.04000000).
+        static ALWAYS_INLINE bool isSolaris64StackPointer(JSValue v)
+        {
+            return ((rawValue(v) & 0xFFFF800000000000LL) == 0xFFFF800000000000LL);
+        }
+#endif
+
         static ALWAYS_INLINE bool isImmediate(JSValue v)
         {
+#if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v))
+                return false;
+#endif
             return rawValue(v) & TagMask;
         }
         
         static ALWAYS_INLINE bool isNumber(JSValue v)
         {
+#if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v))
+                return false;
+#endif
             return rawValue(v) & TagTypeNumber;
         }
 
         static ALWAYS_INLINE bool isIntegerNumber(JSValue v)
         {
 #if USE(JSVALUE64)
+# if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v))
+                return false;
+# endif
             return (rawValue(v) & TagTypeNumber) == TagTypeNumber;
 #else
             return isNumber(v);
@@ -218,23 +242,39 @@ namespace JSC {
 #if USE(JSVALUE64)
         static ALWAYS_INLINE bool isDouble(JSValue v)
         {
+#if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v))
+                return false;
+#endif
             return isNumber(v) && !isIntegerNumber(v);
         }
 #endif
 
         static ALWAYS_INLINE bool isPositiveIntegerNumber(JSValue v)
         {
+#if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v))
+                return false;
+#endif
             // A single mask to check for the sign bit and the number tag all at once.
             return (rawValue(v) & (signBit | TagTypeNumber)) == TagTypeNumber;
         }
         
         static ALWAYS_INLINE bool isBoolean(JSValue v)
         {
+#if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v))
+                return false;
+#endif
             return (rawValue(v) & FullTagTypeMask) == FullTagTypeBool;
         }
         
         static ALWAYS_INLINE bool isUndefinedOrNull(JSValue v)
         {
+#if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v))
+                return false;
+#endif
             // Undefined and null share the same value, bar the 'undefined' bit in the extended tag.
             return (rawValue(v) & ~ExtendedTagBitUndefined) == FullTagTypeNull;
         }
@@ -254,6 +294,10 @@ namespace JSC {
 
         static ALWAYS_INLINE bool isEitherImmediate(JSValue v1, JSValue v2)
         {
+#if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v1) && isSolaris64StackPointer(v2))
+                return false;
+#endif
             return (rawValue(v1) | rawValue(v2)) & TagMask;
         }
 
@@ -265,6 +309,10 @@ namespace JSC {
         static ALWAYS_INLINE bool areBothImmediateIntegerNumbers(JSValue v1, JSValue v2)
         {
 #if USE(JSVALUE64)
+# if OS(SOLARIS64)
+            if (isSolaris64StackPointer(v1) || isSolaris64StackPointer(v2))
+                return false;
+# endif
             return (rawValue(v1) & rawValue(v2) & TagTypeNumber) == TagTypeNumber;
 #else
             return rawValue(v1) & rawValue(v2) & TagTypeNumber;
Index: qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
===================================================================
--- qtscript.orig/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
+++ qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
@@ -460,6 +460,9 @@
 /* OS(SOLARIS) - Solaris */
 #if defined(sun) || defined(__sun)
 #define WTF_OS_SOLARIS 1
+#if defined(__LP64__)
+#define WTF_OS_SOLARIS64 1
+#endif
 #endif
 
 /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */