Fixup fromcvs/togit conversion
[pkgsrcv2.git] / www / seamonkey / patches / patch-na
1 $NetBSD: patch-na,v 1.1 2009/09/09 17:01:07 tnn Exp $
2
3 # reported upstream as:
4 #   https://bugzilla.mozilla.org/show_bug.cgi?id=512802
5
6 --- mozilla/js/src/jsscript.cpp.orig    2009-08-24 01:32:14.000000000 +0200
7 +++ mozilla/js/src/jsscript.cpp 2009-08-24 01:36:20.000000000 +0200
8 @@ -1370,19 +1370,49 @@ js_NewScript(JSContext *cx, uint32 lengt
9      size_t size, vectorSize;
10      JSScript *script;
11      uint8 *cursor;
12 +#ifdef _LP64
13 +#define LP64_ALIGN(V)  if ((V) & 7) (V) = (((V)|7) + 1)
14 +#define LP64_ALIGNP(P)  if ((uintptr_t)(P) & 7) (P) = (uint8*)(((uintptr_t)(P)|7) + 1)
15 +#else
16 +#define LP64_ALIGN(V)
17 +#define LP64_ALIGNP(V)
18 +#endif
19  
20 -    size = sizeof(JSScript) +
21 -           sizeof(JSAtom *) * natoms +
22 -           length * sizeof(jsbytecode) +
23 -           nsrcnotes * sizeof(jssrcnote);
24 -    if (nobjects != 0)
25 -        size += sizeof(JSObjectArray) + nobjects * sizeof(JSObject *);
26 -    if (nupvars != 0)
27 -        size += sizeof(JSUpvarArray) + nupvars * sizeof(uint32);
28 -    if (nregexps != 0)
29 -        size += sizeof(JSObjectArray) + nregexps * sizeof(JSObject *);
30 -    if (ntrynotes != 0)
31 -        size += sizeof(JSTryNoteArray) + ntrynotes * sizeof(JSTryNote);
32 +    size = sizeof(JSScript);
33 +    if (nobjects != 0) {
34 +       LP64_ALIGN(size);
35 +        size += sizeof(JSObjectArray);
36 +    }
37 +    if (nupvars != 0) {
38 +       LP64_ALIGN(size);
39 +        size += sizeof(JSUpvarArray);
40 +    }
41 +    if (nregexps != 0) {
42 +       LP64_ALIGN(size);
43 +        size += sizeof(JSObjectArray);
44 +    }
45 +    if (ntrynotes != 0) {
46 +       LP64_ALIGN(size);
47 +        size += sizeof(JSTryNoteArray);
48 +    }
49 +    if (natoms != 0) {
50 +       LP64_ALIGN(size);
51 +       size += sizeof(JSAtom *) * natoms;
52 +    }
53 +    if (nobjects != 0) {
54 +       LP64_ALIGN(size);
55 +        size += nobjects * sizeof(JSObject *);
56 +    }
57 +    if (nupvars != 0) {
58 +        size += nupvars * sizeof(uint32);
59 +    }
60 +    if (nregexps != 0) {
61 +       LP64_ALIGN(size);
62 +        size += nregexps * sizeof(JSObject *);
63 +    }
64 +    size += length * sizeof(jsbytecode) +
65 +       nsrcnotes * sizeof(jssrcnote) +
66 +       ntrynotes * sizeof(JSTryNote);
67  
68      script = (JSScript *) JS_malloc(cx, size);
69      if (!script)
70 @@ -1393,23 +1423,28 @@ js_NewScript(JSContext *cx, uint32 lengt
71  
72      cursor = (uint8 *)script + sizeof(JSScript);
73      if (nobjects != 0) {
74 +       LP64_ALIGNP(cursor);
75          script->objectsOffset = (uint8)(cursor - (uint8 *)script);
76          cursor += sizeof(JSObjectArray);
77      }
78      if (nupvars != 0) {
79 +       LP64_ALIGNP(cursor);
80          script->upvarsOffset = (uint8)(cursor - (uint8 *)script);
81          cursor += sizeof(JSUpvarArray);
82      }
83      if (nregexps != 0) {
84 +       LP64_ALIGNP(cursor);
85          script->regexpsOffset = (uint8)(cursor - (uint8 *)script);
86          cursor += sizeof(JSObjectArray);
87      }
88      if (ntrynotes != 0) {
89 +       LP64_ALIGNP(cursor);
90          script->trynotesOffset = (uint8)(cursor - (uint8 *)script);
91          cursor += sizeof(JSTryNoteArray);
92      }
93  
94      if (natoms != 0) {
95 +       LP64_ALIGNP(cursor);
96          script->atomMap.length = natoms;
97          script->atomMap.vector = (JSAtom **)cursor;
98          vectorSize = natoms * sizeof(script->atomMap.vector[0]);
99 @@ -1423,6 +1458,7 @@ js_NewScript(JSContext *cx, uint32 lengt
100      }
101  
102      if (nobjects != 0) {
103 +       LP64_ALIGNP(cursor);
104          JS_SCRIPT_OBJECTS(script)->length = nobjects;
105          JS_SCRIPT_OBJECTS(script)->vector = (JSObject **)cursor;
106          vectorSize = nobjects * sizeof(JS_SCRIPT_OBJECTS(script)->vector[0]);
107 @@ -1431,6 +1467,7 @@ js_NewScript(JSContext *cx, uint32 lengt
108      }
109  
110      if (nupvars != 0) {
111 +       LP64_ALIGNP(cursor);
112          JS_SCRIPT_UPVARS(script)->length = nupvars;
113          JS_SCRIPT_UPVARS(script)->vector = (uint32 *)cursor;
114          vectorSize = nupvars * sizeof(JS_SCRIPT_UPVARS(script)->vector[0]);
115 @@ -1439,6 +1476,7 @@ js_NewScript(JSContext *cx, uint32 lengt
116      }
117  
118      if (nregexps != 0) {
119 +       LP64_ALIGNP(cursor);
120          JS_SCRIPT_REGEXPS(script)->length = nregexps;
121          JS_SCRIPT_REGEXPS(script)->vector = (JSObject **)cursor;
122          vectorSize = nregexps * sizeof(JS_SCRIPT_REGEXPS(script)->vector[0]);