mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Issue #1679 - Part 3: Make everything build on supported compilers.
This commit is contained in:
parent
c7a14f5481
commit
3548ae2b2f
9 changed files with 56 additions and 27 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,4 +34,9 @@ if CONFIG['ENABLE_INTL_API']:
|
|||
SOURCES += [
|
||||
'property-sequences.cc',
|
||||
'special-case.cc'
|
||||
]
|
||||
]
|
||||
|
||||
if CONFIG['_MSC_VER']:
|
||||
# This is intended as a temporary workaround to unblock compilation
|
||||
# on VS2015 in warnings as errors mode.
|
||||
CXXFLAGS += ['-wd4275']
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
#define V8_USE_COMPUTED_GOTO 1
|
||||
#endif // V8_HAS_COMPUTED_GOTO
|
||||
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
|
|
|||
|
|
@ -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*);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue