1
1
Description: Fix build failure on platforms where YARR JIT is not supported
2
From: https://bug691898.bugzilla.mozilla.org/attachment.cgi?id=596771
2
From: https://hg.mozilla.org/mozilla-central/rev/f5a3a7b9c6b0
3
3
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=691898
6
# Parent 9fb9c1cfc1df49ba616e0cce1586d708b0f3c0c8
7
6
# User Landry Breuil <landry@openbsd.org>
8
Use YARR interpreter instead of PCRE on platforms where YARR JIT is not
7
# Date 1336027290 -7200
8
# Node ID f5a3a7b9c6b046af8bec742816a970ab58320764
9
# Parent 5338f60cc0005be010f290184c489b9f53ed35b8
10
Bug 691898 - Use YARR regexp interpreter instead of PCRE on platforms where YARR JIT is not supported r=dmandelin
11
PCRE doesn't build anyway.
11
Index: mozilla/mozilla/js/src/Makefile.in
12
===================================================================
13
--- mozilla.orig/mozilla/js/src/Makefile.in 2012-02-23 02:06:55.000000000 +0000
14
+++ mozilla/mozilla/js/src/Makefile.in 2012-02-23 13:25:21.157807364 +0000
13
--- moz/mozilla/js/src/Makefile.in
14
+++ moz.orig/mozilla/js/src/Makefile.in
15
@@ -315,30 +315,33 @@ ifeq (mips, $(findstring mips,$(TARGET_C
16
CPPSRCS += TrampolineMIPS.cpp
19
# END enclude sources for the method JIT
20
#############################################
24
-# For architectures without YARR JIT, PCRE is faster than the YARR
25
-# interpreter (bug 684559).
17
27
ifeq (,$(filter arm% sparc %86 x86_64 mips%,$(TARGET_CPU)))
19
29
-VPATH += $(srcdir)/yarr/pcre \
20
+VPATH += $(srcdir)/assembler \
21
+ $(srcdir)/assembler/wtf \
30
+VPATH += $(srcdir)/assembler \
31
+ $(srcdir)/assembler/wtf \
32
+ $(srcdir)/assembler/jit \
26
37
- pcre_compile.cpp \
28
39
- pcre_tables.cpp \
29
40
- pcre_xclass.cpp \
30
41
- pcre_ucp_searchfuncs.cpp \
32
+ OSAllocatorOS2.cpp \
33
+ OSAllocatorPosix.cpp \
34
+ OSAllocatorWin.cpp \
36
+ YarrInterpreter.cpp \
38
+ YarrSyntaxChecker.cpp \
42
+CPPSRCS += ExecutableAllocator.cpp \
43
+ ExecutableAllocatorPosix.cpp \
44
+ OSAllocatorOS2.cpp \
45
+ OSAllocatorPosix.cpp \
46
+ OSAllocatorWin.cpp \
48
+ YarrInterpreter.cpp \
50
+ YarrSyntaxChecker.cpp \
43
# Needed to "configure" it correctly. Unfortunately these
44
# flags wind up being applied to all code in js/src, not just
45
# the code in js/src/assembler.
46
-CXXFLAGS += -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1
47
+CXXFLAGS += -DUSE_SYSTEM_MALLOC=1
49
ifneq (,$(ENABLE_YARR_JIT)$(ENABLE_METHODJIT))
50
-CXXFLAGS += -DENABLE_JIT=1
51
+CXXFLAGS += -DENABLE_JIT=1 -DENABLE_ASSEMBLER=1
54
INCLUDES += -I$(srcdir)/assembler -I$(srcdir)/yarr
55
Index: mozilla/mozilla/js/src/jsapi.cpp
56
===================================================================
57
--- mozilla.orig/mozilla/js/src/jsapi.cpp 2012-02-23 02:07:17.000000000 +0000
58
+++ mozilla/mozilla/js/src/jsapi.cpp 2012-02-23 13:26:06.801806553 +0000
62
tempLifoAlloc(TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE),
71
noGCOrAllocationCheck(0),
80
/* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */
81
JS_INIT_CLIST(&contextList);
84
JS_ASSERT(onOwnerThread());
87
delete_<JSC::ExecutableAllocator>(execAlloc_);
89
delete_<WTF::BumpPointerAllocator>(bumpAlloc_);
94
JS_SetJitHardening(JSRuntime *rt, JSBool enabled)
97
rt->setJitHardening(!!enabled);
101
JS_PUBLIC_API(const char *)
102
Index: mozilla/mozilla/js/src/jscntxt.cpp
103
===================================================================
104
--- mozilla.orig/mozilla/js/src/jscntxt.cpp 2012-02-23 02:07:17.000000000 +0000
105
+++ mozilla/mozilla/js/src/jscntxt.cpp 2012-02-23 13:25:21.161807364 +0000
109
size_t method = 0, regexp = 0, unused = 0;
110
+#if ENABLE_ASSEMBLER
112
execAlloc_->sizeOfCode(&method, ®exp, &unused);
113
JS_ASSERT(method == 0); /* this execAlloc is only used for regexp code */
115
*regexpCode = regexp + unused;
119
JS_ATOMIC_SET(&interrupt, 1);
122
+#if ENABLE_ASSEMBLER
124
JSRuntime::setJitHardening(bool enabled)
127
js_ReportOutOfMemory(cx);
132
WTF::BumpPointerAllocator *
133
JSRuntime::createBumpPointerAllocator(JSContext *cx)
134
Index: mozilla/mozilla/js/src/jscntxt.h
135
===================================================================
136
--- mozilla.orig/mozilla/js/src/jscntxt.h 2012-02-23 02:07:17.000000000 +0000
137
+++ mozilla/mozilla/js/src/jscntxt.h 2012-02-23 13:25:21.161807364 +0000
138
@@ -224,16 +224,22 @@
139
* Both of these allocators are used for regular expression code which is shared at the
142
+#if ENABLE_ASSEMBLER
143
JSC::ExecutableAllocator *execAlloc_;
145
WTF::BumpPointerAllocator *bumpAlloc_;
147
+#if ENABLE_ASSEMBLER
148
JSC::ExecutableAllocator *createExecutableAllocator(JSContext *cx);
150
WTF::BumpPointerAllocator *createBumpPointerAllocator(JSContext *cx);
153
+#if ENABLE_ASSEMBLER
154
JSC::ExecutableAllocator *getExecutableAllocator(JSContext *cx) {
155
return execAlloc_ ? execAlloc_ : createExecutableAllocator(cx);
158
WTF::BumpPointerAllocator *getBumpPointerAllocator(JSContext *cx) {
159
return bumpAlloc_ ? bumpAlloc_ : createBumpPointerAllocator(cx);
165
+#if ENABLE_ASSEMBLER
171
@@ -683,10 +691,12 @@
173
JS_FRIEND_API(void) triggerOperationCallback();
175
+#if ENABLE_ASSEMBLER
176
void setJitHardening(bool enabled);
177
bool getJitHardening() const {
182
void sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *normal, size_t *temporary,
183
size_t *regexpCode, size_t *stackCommitted);
184
Index: mozilla/mozilla/js/src/jsprvtd.h
185
===================================================================
186
--- mozilla.orig/mozilla/js/src/jsprvtd.h 2012-02-23 02:07:18.000000000 +0000
187
+++ mozilla/mozilla/js/src/jsprvtd.h 2012-02-23 13:25:21.161807364 +0000
188
@@ -317,12 +317,13 @@
192
+#if ENABLE_ASSEMBLER
195
class ExecutableAllocator;
197
} /* namespace JSC */
202
class BumpPointerAllocator;
203
Index: mozilla/mozilla/js/src/vm/RegExpObject-inl.h
204
===================================================================
205
--- mozilla.orig/mozilla/js/src/vm/RegExpObject-inl.h 2012-02-23 02:07:40.000000000 +0000
206
+++ mozilla/mozilla/js/src/vm/RegExpObject-inl.h 2012-02-23 13:25:21.161807364 +0000
54
###############################################
55
# BEGIN include sources for the Nitro assembler
59
--- moz/mozilla/js/src/assembler/jit/ExecutableAllocator.h
60
+++ moz.orig/mozilla/js/src/assembler/jit/ExecutableAllocator.h
61
@@ -462,18 +462,16 @@ public:
62
: "r" (code), "r" (reinterpret_cast<char*>(code) + size)
66
static void cacheFlush(void* code, size_t size)
68
sync_instruction_memory((caddr_t)code, size);
71
- #error "The cacheFlush support is missing on this platform."
76
#if ENABLE_ASSEMBLER_WX_EXCLUSIVE
77
static void reprotectRegion(void*, size_t, ProtectionSetting);
80
--- moz/mozilla/js/src/vm/RegExpObject-inl.h
81
+++ moz.orig/mozilla/js/src/vm/RegExpObject-inl.h
82
@@ -132,26 +132,28 @@ RegExpObject::setMultiline(bool enabled)
86
RegExpObject::setSticky(bool enabled)
208
88
setSlot(STICKY_FLAG_SLOT, BooleanValue(enabled));