diff options
author | Moonchild <moonchild@palemoon.org> | 2023-03-09 09:02:10 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-03-09 09:02:10 +0000 |
commit | 1affd523ec66ce87376d892cd499724bba8e10ea (patch) | |
tree | f5efc3ea9b652576806f98830efd9f40fe50bb17 | |
parent | 713ada0ccff6982237ed3bfd952a00b4cf8e8a0f (diff) | |
parent | 21668cd7d3d4265253dd19c8a6d2dfaede2cbd36 (diff) | |
download | uxp-1affd523ec66ce87376d892cd499724bba8e10ea.tar.gz |
Merge pull request 'Root the RegExpShared in RegExpMacroAssembler.' (#2150) from jobbautista9/UXP:2148-rootregexpshared into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2150
-rw-r--r-- | js/src/irregexp/NativeRegExpMacroAssembler.cpp | 6 | ||||
-rw-r--r-- | js/src/irregexp/NativeRegExpMacroAssembler.h | 3 | ||||
-rw-r--r-- | js/src/irregexp/RegExpEngine.cpp | 4 | ||||
-rw-r--r-- | js/src/irregexp/RegExpMacroAssembler.cpp | 5 | ||||
-rw-r--r-- | js/src/irregexp/RegExpMacroAssembler.h | 10 |
5 files changed, 16 insertions, 12 deletions
diff --git a/js/src/irregexp/NativeRegExpMacroAssembler.cpp b/js/src/irregexp/NativeRegExpMacroAssembler.cpp index 41c1951bc2..23d3b73ab1 100644 --- a/js/src/irregexp/NativeRegExpMacroAssembler.cpp +++ b/js/src/irregexp/NativeRegExpMacroAssembler.cpp @@ -63,10 +63,10 @@ using namespace js::jit; * The tempN registers are free to use for computations. */ -NativeRegExpMacroAssembler::NativeRegExpMacroAssembler(LifoAlloc* alloc, RegExpShared* shared, +NativeRegExpMacroAssembler::NativeRegExpMacroAssembler(JSContext* cx, LifoAlloc* alloc, RegExpShared* shared, JSRuntime* rt, Mode mode, int registers_to_save) - : RegExpMacroAssembler(*alloc, shared, registers_to_save), - runtime(rt), mode_(mode) + : RegExpMacroAssembler(cx, *alloc, shared, registers_to_save), + cx(cx), runtime(rt), mode_(mode) { // Find physical registers for each compiler register. AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); diff --git a/js/src/irregexp/NativeRegExpMacroAssembler.h b/js/src/irregexp/NativeRegExpMacroAssembler.h index 857900cabf..78d2e02295 100644 --- a/js/src/irregexp/NativeRegExpMacroAssembler.h +++ b/js/src/irregexp/NativeRegExpMacroAssembler.h @@ -87,7 +87,7 @@ class MOZ_STACK_CLASS NativeRegExpMacroAssembler final : public RegExpMacroAssem // Type of input string to generate code for. enum Mode { ASCII = 1, CHAR16 = 2 }; - NativeRegExpMacroAssembler(LifoAlloc* alloc, RegExpShared* shared, + NativeRegExpMacroAssembler(JSContext* cx, LifoAlloc* alloc, RegExpShared* shared, JSRuntime* rt, Mode mode, int registers_to_save); // Inherited virtual methods. @@ -174,6 +174,7 @@ class MOZ_STACK_CLASS NativeRegExpMacroAssembler final : public RegExpMacroAssem private: jit::MacroAssembler masm; + JSContext* cx; JSRuntime* runtime; Mode mode_; jit::Label entry_label_; diff --git a/js/src/irregexp/RegExpEngine.cpp b/js/src/irregexp/RegExpEngine.cpp index 3ac57eccc9..58757efd9b 100644 --- a/js/src/irregexp/RegExpEngine.cpp +++ b/js/src/irregexp/RegExpEngine.cpp @@ -1350,10 +1350,10 @@ irregexp::CompilePattern(JSContext* cx, HandleRegExpShared shared, RegExpCompile : NativeRegExpMacroAssembler::CHAR16; ctx.emplace(cx, (jit::TempAllocator*) nullptr); - native_assembler.emplace(&alloc, shared, cx->runtime(), mode, (data->capture_count + 1) * 2); + native_assembler.emplace(cx, &alloc, shared, cx->runtime(), mode, (data->capture_count + 1) * 2); assembler = native_assembler.ptr(); } else { - interpreted_assembler.emplace(&alloc, shared, (data->capture_count + 1) * 2); + interpreted_assembler.emplace(cx, &alloc, shared, (data->capture_count + 1) * 2); assembler = interpreted_assembler.ptr(); } diff --git a/js/src/irregexp/RegExpMacroAssembler.cpp b/js/src/irregexp/RegExpMacroAssembler.cpp index 2c4ec67ef5..ad61e0fee5 100644 --- a/js/src/irregexp/RegExpMacroAssembler.cpp +++ b/js/src/irregexp/RegExpMacroAssembler.cpp @@ -96,9 +96,10 @@ irregexp::CaseInsensitiveCompareUCStrings(const char16_t* substring1, const char16_t* substring2, size_t byteLength); -InterpretedRegExpMacroAssembler::InterpretedRegExpMacroAssembler(LifoAlloc* alloc, RegExpShared* shared, +InterpretedRegExpMacroAssembler::InterpretedRegExpMacroAssembler(JSContext* cx, LifoAlloc* alloc, + RegExpShared* shared, size_t numSavedRegisters) - : RegExpMacroAssembler(*alloc, shared, numSavedRegisters), + : RegExpMacroAssembler(cx, *alloc, shared, numSavedRegisters), pc_(0), advance_current_start_(0), advance_current_offset_(0), diff --git a/js/src/irregexp/RegExpMacroAssembler.h b/js/src/irregexp/RegExpMacroAssembler.h index 4fa0ab5630..e0499cdfbe 100644 --- a/js/src/irregexp/RegExpMacroAssembler.h +++ b/js/src/irregexp/RegExpMacroAssembler.h @@ -40,13 +40,14 @@ namespace irregexp { class MOZ_STACK_CLASS RegExpMacroAssembler { public: - RegExpMacroAssembler(LifoAlloc& alloc, RegExpShared* shared, size_t numSavedRegisters) + RegExpMacroAssembler(JSContext* cx, LifoAlloc& alloc, RegExpShared* shared, + size_t numSavedRegisters) : slow_safe_compiler_(false), global_mode_(NOT_GLOBAL), alloc_(alloc), num_registers_(numSavedRegisters), num_saved_registers_(numSavedRegisters), - shared(shared) + shared(cx, shared) {} enum StackCheckFlag { @@ -214,7 +215,7 @@ class MOZ_STACK_CLASS RegExpMacroAssembler } public: - RegExpShared* shared; + RootedRegExpShared shared; }; template <typename CharT> @@ -229,7 +230,8 @@ CaseInsensitiveCompareUCStrings(const CharT* substring1, const CharT* substring2 class MOZ_STACK_CLASS InterpretedRegExpMacroAssembler final : public RegExpMacroAssembler { public: - InterpretedRegExpMacroAssembler(LifoAlloc* alloc, RegExpShared* shared, size_t numSavedRegisters); + InterpretedRegExpMacroAssembler(JSContext* cx, LifoAlloc* alloc, RegExpShared* shared, + size_t numSavedRegisters); ~InterpretedRegExpMacroAssembler(); // Inherited virtual methods. |