diff options
author | Moonchild <moonchild@palemoon.org> | 2021-07-30 09:43:28 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-07-30 09:43:28 +0000 |
commit | 979c60bc7cfc20ed2baf578ba9b43d833cf8b761 (patch) | |
tree | 6f9d810f2c05826b8acbf3213edd405b7cf57397 /js/src | |
parent | 62037431601214c459ec1f9bd48a2f2ea4a2e312 (diff) | |
download | uxp-979c60bc7cfc20ed2baf578ba9b43d833cf8b761.tar.gz |
Issue #1679 - Part 3: Make everything build on supported compilers.
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/jit/MacroAssembler.h | 9 | ||||
-rw-r--r-- | js/src/regexp/moz.build | 7 | ||||
-rw-r--r-- | js/src/regexp/regexp-interpreter.cc | 1 | ||||
-rw-r--r-- | js/src/regexp/regexp-macro-assembler-arch.h | 2 | ||||
-rw-r--r-- | js/src/regexp/regexp-native-macro-assembler.cc | 49 | ||||
-rw-r--r-- | js/src/regexp/regexp-parser.h | 4 | ||||
-rw-r--r-- | js/src/regexp/regexp-shim.cc | 4 | ||||
-rw-r--r-- | js/src/regexp/regexp-shim.h | 3 | ||||
-rw-r--r-- | js/src/regexp/util/vector.h | 4 |
9 files changed, 56 insertions, 27 deletions
diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index 9d95c7f7ab..6d9888469e 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -2121,6 +2121,15 @@ class MacroAssembler : public MacroAssemblerSpecific inline void assertStackAlignment(uint32_t alignment, int32_t offset = 0); }; +// StackMacroAssembler checks no GC will happen while it's on the stack. +class MOZ_RAII StackMacroAssembler : public MacroAssembler { + JS::AutoCheckCannotGC nogc; + +public: + StackMacroAssembler() : MacroAssembler() {} + explicit StackMacroAssembler(JSContext* cx) : MacroAssembler(cx) {} +}; + static inline Assembler::DoubleCondition JSOpToDoubleCondition(JSOp op) { diff --git a/js/src/regexp/moz.build b/js/src/regexp/moz.build index 4caa4589c0..2a8fab2ef6 100644 --- a/js/src/regexp/moz.build +++ b/js/src/regexp/moz.build @@ -34,4 +34,9 @@ if CONFIG['ENABLE_INTL_API']: SOURCES += [ 'property-sequences.cc', 'special-case.cc' - ]
\ No newline at end of file + ] + +if CONFIG['_MSC_VER']: + # This is intended as a temporary workaround to unblock compilation + # on VS2015 in warnings as errors mode. + CXXFLAGS += ['-wd4275']
\ No newline at end of file diff --git a/js/src/regexp/regexp-interpreter.cc b/js/src/regexp/regexp-interpreter.cc index 7735d68855..356d358d68 100644 --- a/js/src/regexp/regexp-interpreter.cc +++ b/js/src/regexp/regexp-interpreter.cc @@ -22,6 +22,7 @@ #define V8_USE_COMPUTED_GOTO 1 #endif // V8_HAS_COMPUTED_GOTO + namespace v8 { namespace internal { diff --git a/js/src/regexp/regexp-macro-assembler-arch.h b/js/src/regexp/regexp-macro-assembler-arch.h index 1baa5ddd52..aecd59e273 100644 --- a/js/src/regexp/regexp-macro-assembler-arch.h +++ b/js/src/regexp/regexp-macro-assembler-arch.h @@ -186,7 +186,7 @@ class SMRegExpMacroAssembler final : public NativeRegExpMacroAssembler { if (num_registers_ <= register_index) { num_registers_ = register_index + 1; } - static_assert(alignof(uintptr_t) <= alignof(FrameData)); + static_assert(alignof(uintptr_t) <= alignof(FrameData),"Regexp: Alignment of uintptr_t and FrameData mismatch"); return sizeof(FrameData) + register_index * sizeof(uintptr_t*); } diff --git a/js/src/regexp/regexp-native-macro-assembler.cc b/js/src/regexp/regexp-native-macro-assembler.cc index 15182ad713..bfac5be072 100644 --- a/js/src/regexp/regexp-native-macro-assembler.cc +++ b/js/src/regexp/regexp-native-macro-assembler.cc @@ -9,12 +9,17 @@ // found in the LICENSE file. #include "jit/Linker.h" +#include "gc/Zone.h" #include "regexp/regexp-macro-assembler-arch.h" #include "regexp/regexp-stack.h" #include "vm/MatchPairs.h" #include "jit/MacroAssembler-inl.h" +using namespace js; +using namespace js::irregexp; +using namespace js::jit; + namespace v8 { namespace internal { @@ -84,19 +89,20 @@ void SMRegExpMacroAssembler::AdvanceRegister(int reg, int by) { } void SMRegExpMacroAssembler::Backtrack() { - // Check for an interrupt. We have to restart from the beginning if we - // are interrupted, so we only check for urgent interrupts. - js::jit::Label noInterrupt; - masm_.branchTest32( - Assembler::Zero, AbsoluteAddress(cx_->addressOfInterruptBits()), - Imm32(uint32_t(js::InterruptReason::CallbackUrgent)), &noInterrupt); - masm_.movePtr(ImmWord(js::RegExpRunStatus_Error), temp0_); - masm_.jump(&exit_label_); - masm_.bind(&noInterrupt); - - // Pop code location from backtrack stack and jump to location. - Pop(temp0_); - masm_.jump(temp0_); + // Check for an interrupt. + /*Label noInterrupt; + Address lhs = Address(cx_->runtime()->addressOfInterruptUint32()); + masm_.branchtest32(Assembler::Zero, + lhs, + Imm32(0), + &noInterrupt); + masm_.movePtr(ImmWord(RegExpRunStatus_Error), temp0_); + masm_.jump(&exit_label_); + masm_.bind(&noInterrupt); +*/ + // Pop code location from backtrack stack and jump to location. + Pop(temp0_); + masm_.jump(temp0_); } void SMRegExpMacroAssembler::Bind(Label* label) { @@ -546,7 +552,8 @@ bool SMRegExpMacroAssembler::CheckSpecialCharacterClass(uc16 type, masm_.branch32(Assembler::Above, current_character_, Imm32('z'), no_match); } - static_assert(arraysize(word_character_map) > unibrow::Latin1::kMaxChar); + static_assert(arraysize(word_character_map) > unibrow::Latin1::kMaxChar, + "regex: arraysize(word_character_map) > unibrow::Latin1::kMaxChar"); masm_.movePtr(ImmPtr(word_character_map), temp0_); masm_.load8ZeroExtend( BaseIndex(temp0_, current_character_, js::jit::TimesOne), temp0_); @@ -558,7 +565,8 @@ bool SMRegExpMacroAssembler::CheckSpecialCharacterClass(uc16 type, if (mode_ != LATIN1) { masm_.branch32(Assembler::Above, current_character_, Imm32('z'), &done); } - static_assert(arraysize(word_character_map) > unibrow::Latin1::kMaxChar); + static_assert(arraysize(word_character_map) > unibrow::Latin1::kMaxChar, + "regex: arraysize(word_character_map) > unibrow::Latin1::kMaxChar"); masm_.movePtr(ImmPtr(word_character_map), temp0_); masm_.load8ZeroExtend( BaseIndex(temp0_, current_character_, js::jit::TimesOne), temp0_); @@ -824,7 +832,7 @@ static Handle<HeapObject> DummyCode() { // Finalize code. This is called last, so that we know how many // registers we need. Handle<HeapObject> SMRegExpMacroAssembler::GetCode(Handle<String> source) { - if (!cx_->realm()->ensureJitRealmExists(cx_)) { + if (!cx_->compartment()->ensureJitCompartmentExists(cx_)) { return DummyCode(); } @@ -841,8 +849,9 @@ Handle<HeapObject> SMRegExpMacroAssembler::GetCode(Handle<String> source) { stackOverflowHandler(); Linker linker(masm_); - JitCode* code = linker.newCode(cx_, js::jit::CodeKind::RegExp); + JitCode* code = linker.newCode<NoGC>(cx_, REGEXP_CODE); if (!code) { + ReportOutOfMemory(cx_); return DummyCode(); } @@ -1161,7 +1170,7 @@ SMRegExpMacroAssembler::Implementation() { /*static */ uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareStrings( const char16_t* substring1, const char16_t* substring2, size_t byteLength) { - js::AutoUnsafeCallWithABI unsafe; + JS::AutoCheckCannotGC nogc; MOZ_ASSERT(byteLength % sizeof(char16_t) == 0); size_t length = byteLength / sizeof(char16_t); @@ -1184,7 +1193,7 @@ uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareStrings( /*static */ uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareUCStrings( const char16_t* substring1, const char16_t* substring2, size_t byteLength) { - js::AutoUnsafeCallWithABI unsafe; + JS::AutoCheckCannotGC nogc; MOZ_ASSERT(byteLength % sizeof(char16_t) == 0); size_t length = byteLength / sizeof(char16_t); @@ -1206,7 +1215,7 @@ uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareUCStrings( /* static */ bool SMRegExpMacroAssembler::GrowBacktrackStack(RegExpStack* regexp_stack) { - js::AutoUnsafeCallWithABI unsafe; + JS::AutoCheckCannotGC nogc; size_t size = regexp_stack->stack_capacity(); return !!regexp_stack->EnsureCapacity(size * 2); } diff --git a/js/src/regexp/regexp-parser.h b/js/src/regexp/regexp-parser.h index 131d12161f..4b0ec3832f 100644 --- a/js/src/regexp/regexp-parser.h +++ b/js/src/regexp/regexp-parser.h @@ -327,7 +327,9 @@ class V8_EXPORT_PRIVATE RegExpParser { bool operator()(const RegExpCapture* lhs, const RegExpCapture* rhs) const { DCHECK_NOT_NULL(lhs); DCHECK_NOT_NULL(rhs); - return *lhs->name() < *rhs->name(); + ZoneVector<uc16> lhname = *lhs->name(); + ZoneVector<uc16> rhname = *rhs->name(); + return lhname < rhname; } }; diff --git a/js/src/regexp/regexp-shim.cc b/js/src/regexp/regexp-shim.cc index 3f3fa40eb0..024ccc2568 100644 --- a/js/src/regexp/regexp-shim.cc +++ b/js/src/regexp/regexp-shim.cc @@ -13,6 +13,8 @@ #include "regexp/regexp-shim.h" #include "regexp/regexp-stack.h" +#include "mozilla/Sprintf.h" // for SprintfLiteral + namespace v8 { namespace internal { @@ -125,7 +127,7 @@ PseudoHandle<ByteArrayData> ByteArray::takeOwnership(Isolate* isolate) { } void Isolate::trace(JSTracer* trc) { - js::gc::AssertRootMarkingPhase(trc); + //js::gc::AssertRootMarkingPhase(trc); for (auto iter = handleArena_.Iter(); !iter.Done(); iter.Next()) { auto& elem = iter.Get(); diff --git a/js/src/regexp/regexp-shim.h b/js/src/regexp/regexp-shim.h index 7677da084b..dc24b6c3d3 100644 --- a/js/src/regexp/regexp-shim.h +++ b/js/src/regexp/regexp-shim.h @@ -20,6 +20,7 @@ #include <algorithm> #include <cctype> +#include <iostream> // needed for gcc 10 #include "jit/Label.h" #include "jit/shared/Assembler-shared.h" @@ -1172,7 +1173,7 @@ extern bool FLAG_trace_regexp_bytecodes; extern bool FLAG_trace_regexp_parser; extern bool FLAG_trace_regexp_peephole_optimization; -#define V8_USE_COMPUTED_GOTO 1 +// #define V8_USE_COMPUTED_GOTO 1 #define COMPILING_IRREGEXP_FOR_EXTERNAL_EMBEDDER } // namespace internal diff --git a/js/src/regexp/util/vector.h b/js/src/regexp/util/vector.h index 2419447d67..435318ce71 100644 --- a/js/src/regexp/util/vector.h +++ b/js/src/regexp/util/vector.h @@ -45,9 +45,9 @@ void DeleteArray(T* array) { template <typename T> class Vector { public: - constexpr Vector() : start_(nullptr), length_(0) {} + Vector() : start_(nullptr), length_(0) {} - constexpr Vector(T* data, size_t length) : start_(data), length_(length) { + Vector(T* data, size_t length) : start_(data), length_(length) { MOZ_ASSERT_IF(length != 0, data != nullptr); } |