summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-08-10 06:05:46 +0000
committerMoonchild <moonchild@palemoon.org>2023-08-10 06:05:46 +0000
commit9bfeaab2e6d220eef448bdd551bccb4cae1816b0 (patch)
treed062a891b22700bb350e32b65cc2c7eedf59f060
parent20ac6059cef7e9fc7f6f3c09ef9b96e26c2efa34 (diff)
parent3b32a66cb6c6cabf21b41ac4d5662f33ba1e80c3 (diff)
downloaduxp-9bfeaab2e6d220eef448bdd551bccb4cae1816b0.tar.gz
Merge pull request 'Fix RegEx GC crash' (#2287) from martok/UXP-contrib:mr/2172-regex-gc into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2287
-rw-r--r--js/src/gc/Marking.cpp3
-rw-r--r--js/src/gc/Tracer.cpp4
-rw-r--r--js/src/jsgc.cpp3
-rw-r--r--js/src/vm/RegExpObject.h3
-rw-r--r--js/src/vm/Runtime.cpp3
5 files changed, 14 insertions, 2 deletions
diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp
index 13ec5b0c05..1376df5a4d 100644
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -788,7 +788,8 @@ ShouldMark<JSObject*>(GCMarker* gcmarker, JSObject* obj)
// Don't mark things outside a zone if we are in a per-zone GC. It is
// faster to check our own arena, which we can do since we know that
// the object is tenured.
- return obj->asTenured().zone()->shouldMarkInZone();
+ Zone* zone = obj->asTenured().zone();
+ return (zone && zone->shouldMarkInZone());
}
template <typename T>
diff --git a/js/src/gc/Tracer.cpp b/js/src/gc/Tracer.cpp
index ea7f613e38..7be4543029 100644
--- a/js/src/gc/Tracer.cpp
+++ b/js/src/gc/Tracer.cpp
@@ -344,6 +344,10 @@ JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing,
name = "object_group";
break;
+ case JS::TraceKind::RegExpShared:
+ name = "reg_exp_shared";
+ break;
+
default:
name = "INVALID";
break;
diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp
index 5c2835cca9..c849bacc8c 100644
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2323,7 +2323,8 @@ static const AllocKinds UpdatePhaseMisc {
AllocKind::ACCESSOR_SHAPE,
AllocKind::OBJECT_GROUP,
AllocKind::STRING,
- AllocKind::JITCODE
+ AllocKind::JITCODE,
+ AllocKind::REGEXP_SHARED
};
static const AllocKinds UpdatePhaseObjects {
diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h
index 14ec8509ee..5247731112 100644
--- a/js/src/vm/RegExpObject.h
+++ b/js/src/vm/RegExpObject.h
@@ -259,6 +259,9 @@ class RegExpShared : public gc::TenuredCell
static bool dumpBytecode(JSContext* cx, MutableHandleRegExpShared res, bool match_only,
HandleLinearString input);
#endif
+
+ public:
+ static const JS::TraceKind TraceKind = JS::TraceKind::RegExpShared;
};
class RegExpCompartment
diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp
index ceb7a498b0..053b7c44b0 100644
--- a/js/src/vm/Runtime.cpp
+++ b/js/src/vm/Runtime.cpp
@@ -877,6 +877,9 @@ js::CurrentThreadCanAccessRuntime(const JSRuntime* rt)
bool
js::CurrentThreadCanAccessZone(Zone* zone)
{
+ if (!zone)
+ return false;
+
if (CurrentThreadCanAccessRuntime(zone->runtime_))
return true;