summaryrefslogtreecommitdiffstats
path: root/mozilla-691898.patch
blob: d138d842e7c9fb781a914cb64b798bc416e6aa75 (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
diff -up xulrunner-14.0.1/mozilla-release/js/src/assembler/jit/ExecutableAllocator.h.691898 xulrunner-14.0.1/mozilla-release/js/src/assembler/jit/ExecutableAllocator.h
--- xulrunner-14.0.1/mozilla-release/js/src/assembler/jit/ExecutableAllocator.h.691898	2012-07-13 23:42:56.000000000 +0200
+++ xulrunner-14.0.1/mozilla-release/js/src/assembler/jit/ExecutableAllocator.h	2012-07-16 13:46:03.512655482 +0200
@@ -468,8 +468,6 @@ public:
     {
         sync_instruction_memory((caddr_t)code, size);
     }
-#else
-    #error "The cacheFlush support is missing on this platform."
 #endif
 
 private:
diff -up xulrunner-14.0.1/mozilla-release/js/src/Makefile.in.691898 xulrunner-14.0.1/mozilla-release/js/src/Makefile.in
--- xulrunner-14.0.1/mozilla-release/js/src/Makefile.in.691898	2012-07-13 23:42:56.000000000 +0200
+++ xulrunner-14.0.1/mozilla-release/js/src/Makefile.in	2012-07-16 13:48:34.039399155 +0200
@@ -320,20 +320,22 @@ endif
 
 endif
 
-# For architectures without YARR JIT, PCRE is faster than the YARR
-# interpreter (bug 684559).
-
 ifeq (,$(filter arm% sparc %86 x86_64 mips%,$(TARGET_CPU)))
 
-VPATH +=        $(srcdir)/yarr/pcre \
-		$(NULL)
+VPATH +=	$(srcdir)/assembler \
+		$(srcdir)/assembler/wtf \
+		$(srcdir)/assembler/jit \
+		$(srcdir)/yarr \
 
-CPPSRCS += \
-                pcre_compile.cpp \
-                pcre_exec.cpp \
-                pcre_tables.cpp \
-                pcre_xclass.cpp \
-                pcre_ucp_searchfuncs.cpp \
+CPPSRCS +=	ExecutableAllocator.cpp \
+		ExecutableAllocatorPosix.cpp \
+		OSAllocatorOS2.cpp \
+		OSAllocatorPosix.cpp \
+		OSAllocatorWin.cpp \
+		PageBlock.cpp \
+		YarrInterpreter.cpp \
+		YarrPattern.cpp \
+		YarrSyntaxChecker.cpp \
 		$(NULL)
 else
 
@@ -903,4 +905,3 @@ endif
 #
 # END kludges for the Nitro assembler
 ###############################################
-
diff -up xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.cpp.691898 xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.cpp
--- xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.cpp.691898	2012-07-13 23:42:59.000000000 +0200
+++ xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.cpp	2012-07-16 13:46:03.897657354 +0200
@@ -168,7 +168,6 @@ MatchPairs::checkAgainst(size_t inputLen
 
 /* detail::RegExpCode */
 
-#if ENABLE_YARR_JIT
 void
 RegExpCode::reportYarrError(JSContext *cx, TokenStream *ts, ErrorCode error)
 {
@@ -200,46 +199,9 @@ RegExpCode::reportYarrError(JSContext *c
     }
 }
 
-#else /* !ENABLE_YARR_JIT */
-
-void
-RegExpCode::reportPCREError(JSContext *cx, int error)
-{
-#define REPORT(msg_) \
-    JS_ReportErrorFlagsAndNumberUC(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, msg_); \
-    return
-    switch (error) {
-      case -2: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-      case 0: JS_NOT_REACHED("Precondition violation: an error must have occurred.");
-      case 1: REPORT(JSMSG_TRAILING_SLASH);
-      case 2: REPORT(JSMSG_TRAILING_SLASH);
-      case 3: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-      case 4: REPORT(JSMSG_BAD_QUANTIFIER);
-      case 5: REPORT(JSMSG_BAD_QUANTIFIER);
-      case 6: REPORT(JSMSG_BAD_CLASS_RANGE);
-      case 7: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-      case 8: REPORT(JSMSG_BAD_CLASS_RANGE);
-      case 9: REPORT(JSMSG_BAD_QUANTIFIER);
-      case 10: REPORT(JSMSG_UNMATCHED_RIGHT_PAREN);
-      case 11: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-      case 12: REPORT(JSMSG_UNMATCHED_RIGHT_PAREN);
-      case 13: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-      case 14: REPORT(JSMSG_MISSING_PAREN);
-      case 15: REPORT(JSMSG_BAD_BACKREF);
-      case 16: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-      case 17: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-      default:
-        JS_NOT_REACHED("Precondition violation: unknown PCRE error code.");
-    }
-#undef REPORT
-}
-
-#endif /* ENABLE_YARR_JIT */
-
 bool
 RegExpCode::compile(JSContext *cx, JSLinearString &pattern, unsigned *parenCount, RegExpFlag flags)
 {
-#if ENABLE_YARR_JIT
     /* Parse the pattern. */
     ErrorCode yarrError;
     YarrPattern yarrPattern(pattern, bool(flags & IgnoreCaseFlag), bool(flags & MultilineFlag),
@@ -256,7 +218,7 @@ RegExpCode::compile(JSContext *cx, JSLin
      * case we have to bytecode compile it.
      */
 
-#ifdef JS_METHODJIT
+#if ENABLE_YARR_JIT && defined(JS_METHODJIT)
     if (isJITRuntimeEnabled(cx) && !yarrPattern.m_containsBackreferences) {
         JSC::ExecutableAllocator *execAlloc = cx->runtime->getExecutableAllocator(cx);
         if (!execAlloc) {
@@ -277,21 +239,11 @@ RegExpCode::compile(JSContext *cx, JSLin
         return false;
     }
 
+#if ENABLE_YARR_JIT
     codeBlock.setFallBack(true);
+#endif
     byteCode = byteCompile(yarrPattern, bumpAlloc).get();
     return true;
-#else /* !defined(ENABLE_YARR_JIT) */
-    int error = 0;
-    compiled = jsRegExpCompile(pattern.chars(), pattern.length(),
-                  ignoreCase() ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase,
-                  multiline() ? JSRegExpMultiline : JSRegExpSingleLine,
-                  parenCount, &error);
-    if (error) {
-        reportPCREError(cx, error);
-        return false;
-    }
-    return true;
-#endif
 }
 
 RegExpRunStatus
@@ -306,19 +258,12 @@ RegExpCode::execute(JSContext *cx, const
     else
         result = JSC::Yarr::execute(codeBlock, chars, start, length, output);
 #else
-    result = jsRegExpExecute(cx, compiled, chars, length, start, output, outputCount);
+    result = JSC::Yarr::interpret(byteCode, chars, start, length, output);
 #endif
 
     if (result == -1)
         return RegExpRunStatus_Success_NotFound;
 
-#if !ENABLE_YARR_JIT
-    if (result < 0) {
-        reportPCREError(cx, result);
-        return RegExpRunStatus_Error;
-    }
-#endif
-
     JS_ASSERT(result >= 0);
     return RegExpRunStatus_Success;
 }
diff -up xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.h.691898 xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.h
--- xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.h.691898	2012-07-13 23:42:59.000000000 +0200
+++ xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject.h	2012-07-16 13:46:03.897657354 +0200
@@ -52,10 +52,8 @@
 #include "yarr/Yarr.h"
 #if ENABLE_YARR_JIT
 #include "yarr/YarrJIT.h"
-#include "yarr/YarrSyntaxChecker.h"
-#else
-#include "yarr/pcre/pcre.h"
 #endif
+#include "yarr/YarrSyntaxChecker.h"
 
 /*
  * JavaScript Regular Expressions
@@ -113,68 +111,51 @@ namespace detail {
 
 class RegExpCode
 {
-#if ENABLE_YARR_JIT
     typedef JSC::Yarr::BytecodePattern BytecodePattern;
     typedef JSC::Yarr::ErrorCode ErrorCode;
+    typedef JSC::Yarr::YarrPattern YarrPattern;
+#if ENABLE_YARR_JIT
     typedef JSC::Yarr::JSGlobalData JSGlobalData;
     typedef JSC::Yarr::YarrCodeBlock YarrCodeBlock;
-    typedef JSC::Yarr::YarrPattern YarrPattern;
 
     /* Note: Native code is valid only if |codeBlock.isFallBack() == false|. */
     YarrCodeBlock   codeBlock;
-    BytecodePattern *byteCode;
-#else
-    JSRegExp        *compiled;
 #endif
+    BytecodePattern *byteCode;
 
   public:
     RegExpCode()
       :
 #if ENABLE_YARR_JIT
         codeBlock(),
-        byteCode(NULL)
-#else
-        compiled(NULL)
 #endif
+        byteCode(NULL)
     { }
 
     ~RegExpCode() {
 #if ENABLE_YARR_JIT
         codeBlock.release();
+#endif
         if (byteCode)
             Foreground::delete_<BytecodePattern>(byteCode);
-#else
-        if (compiled)
-            jsRegExpFree(compiled);
-#endif
     }
 
     static bool checkSyntax(JSContext *cx, TokenStream *tokenStream, JSLinearString *source) {
-#if ENABLE_YARR_JIT
         ErrorCode error = JSC::Yarr::checkSyntax(*source);
         if (error == JSC::Yarr::NoError)
             return true;
 
         reportYarrError(cx, tokenStream, error);
         return false;
-#else
-# error "Syntax checking not implemented for !ENABLE_YARR_JIT"
-#endif
     }
 
 #if ENABLE_YARR_JIT
     static inline bool isJITRuntimeEnabled(JSContext *cx);
-    static void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error);
-#else
-    static void reportPCREError(JSContext *cx, int error);
 #endif
+    static void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error);
 
     static size_t getOutputSize(size_t pairCount) {
-#if ENABLE_YARR_JIT
         return pairCount * 2;
-#else
-        return pairCount * 3; /* Should be x2, but PCRE has... needs. */
-#endif
     }
 
     bool compile(JSContext *cx, JSLinearString &pattern, unsigned *parenCount, RegExpFlag flags);
diff -up xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject-inl.h.691898 xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject-inl.h
--- xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject-inl.h.691898	2012-07-13 23:42:59.000000000 +0200
+++ xulrunner-14.0.1/mozilla-release/js/src/vm/RegExpObject-inl.h	2012-07-16 13:46:03.898657360 +0200
@@ -137,6 +137,7 @@ RegExpObject::setSticky(bool enabled)
     setSlot(STICKY_FLAG_SLOT, BooleanValue(enabled));
 }
 
+#if ENABLE_YARR_JIT
 /* This function should be deleted once bad Android platforms phase out. See bug 604774. */
 inline bool
 detail::RegExpCode::isJITRuntimeEnabled(JSContext *cx)
@@ -147,6 +148,7 @@ detail::RegExpCode::isJITRuntimeEnabled(
     return true;
 #endif
 }
+#endif
 
 inline bool
 RegExpToShared(JSContext *cx, JSObject &obj, RegExpGuard *g)
diff -up xulrunner-14.0.1/mozilla-release/js/src/yarr/wtfbridge.h.691898 xulrunner-14.0.1/mozilla-release/js/src/yarr/wtfbridge.h
--- xulrunner-14.0.1/mozilla-release/js/src/yarr/wtfbridge.h.691898	2012-07-13 23:42:59.000000000 +0200
+++ xulrunner-14.0.1/mozilla-release/js/src/yarr/wtfbridge.h	2012-07-16 13:46:03.898657360 +0200
@@ -49,9 +49,7 @@
 #include "jsprvtd.h"
 #include "vm/String.h"
 #include "assembler/wtf/Platform.h"
-#if ENABLE_YARR_JIT
 #include "assembler/jit/ExecutableAllocator.h"
-#endif
 
 namespace JSC { namespace Yarr {