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

82 lines
2.4 KiB
Plaintext

$OpenBSD: patch-js_src_vm_RegExpObject_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.h.orig Wed Jan 11 18:14:49 2012
+++ js/src/vm/RegExpObject.h Mon Jan 16 17:07:48 2012
@@ -49,8 +49,6 @@
#include "yarr/Yarr.h"
#if ENABLE_YARR_JIT
#include "yarr/YarrJIT.h"
-#else
-#include "yarr/pcre/pcre.h"
#endif
namespace js {
@@ -153,48 +151,39 @@ ResetRegExpObject(JSContext *cx, AlreadyIncRefed<RegEx
/* Abstracts away the gross |RegExpPrivate| backend details. */
class RegExpPrivateCode
{
-#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:
RegExpPrivateCode()
:
#if ENABLE_YARR_JIT
codeBlock(),
- byteCode(NULL)
-#else
- compiled(NULL)
#endif
+ byteCode(NULL)
{ }
~RegExpPrivateCode() {
#if ENABLE_YARR_JIT
codeBlock.release();
+#endif
if (byteCode)
Foreground::delete_<BytecodePattern>(byteCode);
-#else
- if (compiled)
- jsRegExpFree(compiled);
-#endif
}
#if ENABLE_YARR_JIT
static inline bool isJITRuntimeEnabled(JSContext *cx);
- void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error);
-#else
- void reportPCREError(JSContext *cx, int error);
#endif
+ void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error);
inline bool compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts, uintN *parenCount,
RegExpFlag flags);
@@ -205,11 +194,7 @@ class RegExpPrivateCode
int *output, size_t outputCount);
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
}
};