openbsd-ports/www/fennec/patches/patch-js_src_vm_RegExpObject-inl_h
2012-02-20 20:21:43 +00:00

81 lines
2.6 KiB
Plaintext

$OpenBSD: patch-js_src_vm_RegExpObject-inl_h,v 1.1 2012/02/20 20:21:43 landry Exp $
https://bug691898.bugzilla.mozilla.org/attachment.cgi?id=588391
use yarr interpreter on ppc
--- js/src/vm/RegExpObject-inl.h.orig Wed Jan 11 18:14:49 2012
+++ js/src/vm/RegExpObject-inl.h Mon Jan 16 17:07:47 2012
@@ -327,6 +327,7 @@ RegExpPrivate::create(JSContext *cx, JSString *source,
return RetType(self);
}
+#if ENABLE_YARR_JIT
/* This function should be deleted once bad Android platforms phase out. See bug 604774. */
inline bool
RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx)
@@ -337,12 +338,12 @@ RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx)
return true;
#endif
}
+#endif
inline bool
RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts,
uintN *parenCount, RegExpFlag flags)
{
-#if ENABLE_YARR_JIT
/* Parse the pattern. */
ErrorCode yarrError;
YarrPattern yarrPattern(pattern, bool(flags & IgnoreCaseFlag), bool(flags & MultilineFlag),
@@ -359,7 +360,7 @@ RegExpPrivateCode::compile(JSContext *cx, JSLinearStri
* case we have to bytecode compile it.
*/
-#ifdef JS_METHODJIT
+#if ENABLE_YARR_JIT && defined(JS_METHODJIT)
if (isJITRuntimeEnabled(cx) && !yarrPattern.m_containsBackreferences) {
if (!cx->compartment->ensureJaegerCompartmentExists(cx))
return false;
@@ -371,21 +372,11 @@ RegExpPrivateCode::compile(JSContext *cx, JSLinearStri
}
#endif
+#if ENABLE_YARR_JIT
codeBlock.setFallBack(true);
+#endif
byteCode = byteCompile(yarrPattern, cx->compartment->regExpAllocator).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
}
inline bool
@@ -431,18 +422,11 @@ RegExpPrivateCode::execute(JSContext *cx, const jschar
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 Success_NotFound;
-
-#if !ENABLE_YARR_JIT
- if (result < 0) {
- reportPCREError(cx, result);
- return Error;
- }
-#endif
JS_ASSERT(result >= 0);
return Success;