mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +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);
|
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
|
static inline Assembler::DoubleCondition
|
||||||
JSOpToDoubleCondition(JSOp op)
|
JSOpToDoubleCondition(JSOp op)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,8 @@ if CONFIG['ENABLE_INTL_API']:
|
||||||
'property-sequences.cc',
|
'property-sequences.cc',
|
||||||
'special-case.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
|
#define V8_USE_COMPUTED_GOTO 1
|
||||||
#endif // V8_HAS_COMPUTED_GOTO
|
#endif // V8_HAS_COMPUTED_GOTO
|
||||||
|
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ class SMRegExpMacroAssembler final : public NativeRegExpMacroAssembler {
|
||||||
if (num_registers_ <= register_index) {
|
if (num_registers_ <= register_index) {
|
||||||
num_registers_ = register_index + 1;
|
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*);
|
return sizeof(FrameData) + register_index * sizeof(uintptr_t*);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,17 @@
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "jit/Linker.h"
|
#include "jit/Linker.h"
|
||||||
|
#include "gc/Zone.h"
|
||||||
#include "regexp/regexp-macro-assembler-arch.h"
|
#include "regexp/regexp-macro-assembler-arch.h"
|
||||||
#include "regexp/regexp-stack.h"
|
#include "regexp/regexp-stack.h"
|
||||||
#include "vm/MatchPairs.h"
|
#include "vm/MatchPairs.h"
|
||||||
|
|
||||||
#include "jit/MacroAssembler-inl.h"
|
#include "jit/MacroAssembler-inl.h"
|
||||||
|
|
||||||
|
using namespace js;
|
||||||
|
using namespace js::irregexp;
|
||||||
|
using namespace js::jit;
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
|
@ -84,19 +89,20 @@ void SMRegExpMacroAssembler::AdvanceRegister(int reg, int by) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMRegExpMacroAssembler::Backtrack() {
|
void SMRegExpMacroAssembler::Backtrack() {
|
||||||
// Check for an interrupt. We have to restart from the beginning if we
|
// Check for an interrupt.
|
||||||
// are interrupted, so we only check for urgent interrupts.
|
/*Label noInterrupt;
|
||||||
js::jit::Label noInterrupt;
|
Address lhs = Address(cx_->runtime()->addressOfInterruptUint32());
|
||||||
masm_.branchTest32(
|
masm_.branchtest32(Assembler::Zero,
|
||||||
Assembler::Zero, AbsoluteAddress(cx_->addressOfInterruptBits()),
|
lhs,
|
||||||
Imm32(uint32_t(js::InterruptReason::CallbackUrgent)), &noInterrupt);
|
Imm32(0),
|
||||||
masm_.movePtr(ImmWord(js::RegExpRunStatus_Error), temp0_);
|
&noInterrupt);
|
||||||
masm_.jump(&exit_label_);
|
masm_.movePtr(ImmWord(RegExpRunStatus_Error), temp0_);
|
||||||
masm_.bind(&noInterrupt);
|
masm_.jump(&exit_label_);
|
||||||
|
masm_.bind(&noInterrupt);
|
||||||
// Pop code location from backtrack stack and jump to location.
|
*/
|
||||||
Pop(temp0_);
|
// Pop code location from backtrack stack and jump to location.
|
||||||
masm_.jump(temp0_);
|
Pop(temp0_);
|
||||||
|
masm_.jump(temp0_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMRegExpMacroAssembler::Bind(Label* label) {
|
void SMRegExpMacroAssembler::Bind(Label* label) {
|
||||||
|
|
@ -546,7 +552,8 @@ bool SMRegExpMacroAssembler::CheckSpecialCharacterClass(uc16 type,
|
||||||
masm_.branch32(Assembler::Above, current_character_, Imm32('z'),
|
masm_.branch32(Assembler::Above, current_character_, Imm32('z'),
|
||||||
no_match);
|
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_.movePtr(ImmPtr(word_character_map), temp0_);
|
||||||
masm_.load8ZeroExtend(
|
masm_.load8ZeroExtend(
|
||||||
BaseIndex(temp0_, current_character_, js::jit::TimesOne), temp0_);
|
BaseIndex(temp0_, current_character_, js::jit::TimesOne), temp0_);
|
||||||
|
|
@ -558,7 +565,8 @@ bool SMRegExpMacroAssembler::CheckSpecialCharacterClass(uc16 type,
|
||||||
if (mode_ != LATIN1) {
|
if (mode_ != LATIN1) {
|
||||||
masm_.branch32(Assembler::Above, current_character_, Imm32('z'), &done);
|
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_.movePtr(ImmPtr(word_character_map), temp0_);
|
||||||
masm_.load8ZeroExtend(
|
masm_.load8ZeroExtend(
|
||||||
BaseIndex(temp0_, current_character_, js::jit::TimesOne), temp0_);
|
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
|
// Finalize code. This is called last, so that we know how many
|
||||||
// registers we need.
|
// registers we need.
|
||||||
Handle<HeapObject> SMRegExpMacroAssembler::GetCode(Handle<String> source) {
|
Handle<HeapObject> SMRegExpMacroAssembler::GetCode(Handle<String> source) {
|
||||||
if (!cx_->realm()->ensureJitRealmExists(cx_)) {
|
if (!cx_->compartment()->ensureJitCompartmentExists(cx_)) {
|
||||||
return DummyCode();
|
return DummyCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -841,8 +849,9 @@ Handle<HeapObject> SMRegExpMacroAssembler::GetCode(Handle<String> source) {
|
||||||
stackOverflowHandler();
|
stackOverflowHandler();
|
||||||
|
|
||||||
Linker linker(masm_);
|
Linker linker(masm_);
|
||||||
JitCode* code = linker.newCode(cx_, js::jit::CodeKind::RegExp);
|
JitCode* code = linker.newCode<NoGC>(cx_, REGEXP_CODE);
|
||||||
if (!code) {
|
if (!code) {
|
||||||
|
ReportOutOfMemory(cx_);
|
||||||
return DummyCode();
|
return DummyCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1161,7 +1170,7 @@ SMRegExpMacroAssembler::Implementation() {
|
||||||
/*static */
|
/*static */
|
||||||
uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareStrings(
|
uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareStrings(
|
||||||
const char16_t* substring1, const char16_t* substring2, size_t byteLength) {
|
const char16_t* substring1, const char16_t* substring2, size_t byteLength) {
|
||||||
js::AutoUnsafeCallWithABI unsafe;
|
JS::AutoCheckCannotGC nogc;
|
||||||
|
|
||||||
MOZ_ASSERT(byteLength % sizeof(char16_t) == 0);
|
MOZ_ASSERT(byteLength % sizeof(char16_t) == 0);
|
||||||
size_t length = byteLength / sizeof(char16_t);
|
size_t length = byteLength / sizeof(char16_t);
|
||||||
|
|
@ -1184,7 +1193,7 @@ uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareStrings(
|
||||||
/*static */
|
/*static */
|
||||||
uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareUCStrings(
|
uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareUCStrings(
|
||||||
const char16_t* substring1, const char16_t* substring2, size_t byteLength) {
|
const char16_t* substring1, const char16_t* substring2, size_t byteLength) {
|
||||||
js::AutoUnsafeCallWithABI unsafe;
|
JS::AutoCheckCannotGC nogc;
|
||||||
|
|
||||||
MOZ_ASSERT(byteLength % sizeof(char16_t) == 0);
|
MOZ_ASSERT(byteLength % sizeof(char16_t) == 0);
|
||||||
size_t length = byteLength / sizeof(char16_t);
|
size_t length = byteLength / sizeof(char16_t);
|
||||||
|
|
@ -1206,7 +1215,7 @@ uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareUCStrings(
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool SMRegExpMacroAssembler::GrowBacktrackStack(RegExpStack* regexp_stack) {
|
bool SMRegExpMacroAssembler::GrowBacktrackStack(RegExpStack* regexp_stack) {
|
||||||
js::AutoUnsafeCallWithABI unsafe;
|
JS::AutoCheckCannotGC nogc;
|
||||||
size_t size = regexp_stack->stack_capacity();
|
size_t size = regexp_stack->stack_capacity();
|
||||||
return !!regexp_stack->EnsureCapacity(size * 2);
|
return !!regexp_stack->EnsureCapacity(size * 2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,9 @@ class V8_EXPORT_PRIVATE RegExpParser {
|
||||||
bool operator()(const RegExpCapture* lhs, const RegExpCapture* rhs) const {
|
bool operator()(const RegExpCapture* lhs, const RegExpCapture* rhs) const {
|
||||||
DCHECK_NOT_NULL(lhs);
|
DCHECK_NOT_NULL(lhs);
|
||||||
DCHECK_NOT_NULL(rhs);
|
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-shim.h"
|
||||||
#include "regexp/regexp-stack.h"
|
#include "regexp/regexp-stack.h"
|
||||||
|
|
||||||
|
#include "mozilla/Sprintf.h" // for SprintfLiteral
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
|
@ -125,7 +127,7 @@ PseudoHandle<ByteArrayData> ByteArray::takeOwnership(Isolate* isolate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Isolate::trace(JSTracer* trc) {
|
void Isolate::trace(JSTracer* trc) {
|
||||||
js::gc::AssertRootMarkingPhase(trc);
|
//js::gc::AssertRootMarkingPhase(trc);
|
||||||
|
|
||||||
for (auto iter = handleArena_.Iter(); !iter.Done(); iter.Next()) {
|
for (auto iter = handleArena_.Iter(); !iter.Done(); iter.Next()) {
|
||||||
auto& elem = iter.Get();
|
auto& elem = iter.Get();
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <iostream> // needed for gcc 10
|
||||||
|
|
||||||
#include "jit/Label.h"
|
#include "jit/Label.h"
|
||||||
#include "jit/shared/Assembler-shared.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_parser;
|
||||||
extern bool FLAG_trace_regexp_peephole_optimization;
|
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
|
#define COMPILING_IRREGEXP_FOR_EXTERNAL_EMBEDDER
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ void DeleteArray(T* array) {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Vector {
|
class Vector {
|
||||||
public:
|
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);
|
MOZ_ASSERT_IF(length != 0, data != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue