diff --git a/js/src/irregexp/imported/regexp-ast.h b/js/src/irregexp/imported/regexp-ast.h --- a/js/src/irregexp/imported/regexp-ast.h +++ b/js/src/irregexp/imported/regexp-ast.h @@ -361,12 +361,12 @@ CharacterSet set_; ClassRangesFlags class_ranges_flags_; }; struct CharacterClassStringLess { - bool operator()(const base::Vector& lhs, - const base::Vector& rhs) const { + bool operator()(base::Vector lhs, + base::Vector rhs) const { // Longer strings first so we generate matches for the largest string // possible. if (lhs.length() != rhs.length()) { return lhs.length() > rhs.length(); } diff --git a/js/src/irregexp/imported/regexp-bytecode-generator.h b/js/src/irregexp/imported/regexp-bytecode-generator.h --- a/js/src/irregexp/imported/regexp-bytecode-generator.h +++ b/js/src/irregexp/imported/regexp-bytecode-generator.h @@ -105,15 +105,15 @@ inline void Emit8(uint32_t x); inline void Emit(uint32_t bc, uint32_t arg); inline void Emit(uint32_t bc, int32_t arg); // Bytecode buffer. int length(); - void Copy(byte* a); + void Copy(uint8_t* a); // The buffer into which code and relocation info are generated. static constexpr int kInitialBufferSize = 1024; - ZoneVector buffer_; + ZoneVector buffer_; // The program counter. int pc_; Label backtrack_; diff --git a/js/src/irregexp/imported/regexp-bytecode-generator.cc b/js/src/irregexp/imported/regexp-bytecode-generator.cc --- a/js/src/irregexp/imported/regexp-bytecode-generator.cc +++ b/js/src/irregexp/imported/regexp-bytecode-generator.cc @@ -389,11 +389,11 @@ return array; } int RegExpBytecodeGenerator::length() { return pc_; } -void RegExpBytecodeGenerator::Copy(byte* a) { +void RegExpBytecodeGenerator::Copy(uint8_t* a) { MemCopy(a, buffer_.data(), length()); } void RegExpBytecodeGenerator::ExpandBuffer() { // TODO(jgruber): The growth strategy could be smarter for large sizes. diff --git a/js/src/irregexp/imported/regexp-bytecode-peephole.h b/js/src/irregexp/imported/regexp-bytecode-peephole.h --- a/js/src/irregexp/imported/regexp-bytecode-peephole.h +++ b/js/src/irregexp/imported/regexp-bytecode-peephole.h @@ -18,12 +18,13 @@ class RegExpBytecodePeepholeOptimization : public AllStatic { public: // Performs peephole optimization on the given bytecode and returns the // optimized bytecode. static Handle OptimizeBytecode( - Isolate* isolate, Zone* zone, Handle source, const byte* bytecode, - int length, const ZoneUnorderedMap& jump_edges); + Isolate* isolate, Zone* zone, Handle source, + const uint8_t* bytecode, int length, + const ZoneUnorderedMap& jump_edges); }; } // namespace internal } // namespace v8 diff --git a/js/src/irregexp/imported/regexp-bytecode-peephole.cc b/js/src/irregexp/imported/regexp-bytecode-peephole.cc --- a/js/src/irregexp/imported/regexp-bytecode-peephole.cc +++ b/js/src/irregexp/imported/regexp-bytecode-peephole.cc @@ -107,11 +107,11 @@ int argument_offset, int argument_byte_length); // Checks if the current node is valid for the sequence. I.e. all conditions // set by IfArgumentEqualsOffset and IfArgumentEquals are fulfilled by this // node for the actual bytecode sequence. - bool CheckArguments(const byte* bytecode, int pc); + bool CheckArguments(const uint8_t* bytecode, int pc); // Returns whether this node marks the end of a valid sequence (i.e. can be // replaced with an optimized bytecode). bool IsSequence() const; // Returns the length of the sequence in bytes. int SequenceLength() const; @@ -168,29 +168,29 @@ const ZoneUnorderedMap& jump_edges); // Parses bytecode and fills the internal buffer with the potentially // optimized bytecode. Returns true when optimizations were performed, false // otherwise. - bool OptimizeBytecode(const byte* bytecode, int length); + bool OptimizeBytecode(const uint8_t* bytecode, int length); // Copies the internal bytecode buffer to another buffer. The caller is // responsible for allocating/freeing the memory. - void CopyOptimizedBytecode(byte* to_address) const; + void CopyOptimizedBytecode(uint8_t* to_address) const; int Length() const; private: // Sets up all sequences that are going to be used. void DefineStandardSequences(); // Starts a new bytecode sequence. BytecodeSequenceNode& CreateSequence(int bytecode); // Checks for optimization candidates at pc and emits optimized bytecode to // the internal buffer. Returns the length of replaced bytecodes in bytes. - int TryOptimizeSequence(const byte* bytecode, int bytecode_length, + int TryOptimizeSequence(const uint8_t* bytecode, int bytecode_length, int start_pc); // Emits optimized bytecode to the internal buffer. start_pc points to the // start of the sequence in bytecode and last_node is the last // BytecodeSequenceNode of the matching sequence found. - void EmitOptimization(int start_pc, const byte* bytecode, + void EmitOptimization(int start_pc, const uint8_t* bytecode, const BytecodeSequenceNode& last_node); // Adds a relative jump source fixup at pos. // Jump source fixups are used to find offsets in the new bytecode that // contain jump sources. void AddJumpSourceFixup(int fixup, int pos); @@ -209,18 +209,18 @@ void AddSentinelFixups(int pos); template void EmitValue(T value); template void OverwriteValue(int offset, T value); - void CopyRangeToOutput(const byte* orig_bytecode, int start, int length); - void SetRange(byte value, int count); - void EmitArgument(int start_pc, const byte* bytecode, + void CopyRangeToOutput(const uint8_t* orig_bytecode, int start, int length); + void SetRange(uint8_t value, int count); + void EmitArgument(int start_pc, const uint8_t* bytecode, BytecodeArgumentMapping arg); int pc() const; Zone* zone() const; - ZoneVector optimized_bytecode_buffer_; + ZoneVector optimized_bytecode_buffer_; BytecodeSequenceNode* sequences_; // Jumps used in old bytecode. // Key: Jump source (offset where destination is stored in old bytecode) // Value: Destination ZoneMap jump_edges_; @@ -247,19 +247,19 @@ DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpBytecodePeephole); }; template -T GetValue(const byte* buffer, int pos) { +T GetValue(const uint8_t* buffer, int pos) { DCHECK(IsAligned(reinterpret_cast
(buffer + pos), alignof(T))); return *reinterpret_cast(buffer + pos); } -int32_t GetArgumentValue(const byte* bytecode, int offset, int length) { +int32_t GetArgumentValue(const uint8_t* bytecode, int offset, int length) { switch (length) { case 1: - return GetValue(bytecode, offset); + return GetValue(bytecode, offset); case 2: return GetValue(bytecode, offset); case 4: return GetValue(bytecode, offset); default: @@ -378,11 +378,11 @@ BytecodeArgument{absolute_offset, argument_byte_length}); return *this; } -bool BytecodeSequenceNode::CheckArguments(const byte* bytecode, int pc) { +bool BytecodeSequenceNode::CheckArguments(const uint8_t* bytecode, int pc) { bool is_valid = true; for (auto check_iter = argument_check_->begin(); check_iter != argument_check_->end() && is_valid; check_iter++) { auto value = GetArgumentValue(bytecode, pc + check_iter->offset, check_iter->length); @@ -608,11 +608,11 @@ .IgnoreArgument(2, 4, 4) // indirect loop jump .IgnoreArgument(3, 4, 4) // jump out of loop .IgnoreArgument(4, 4, 4); // loop jump } -bool RegExpBytecodePeephole::OptimizeBytecode(const byte* bytecode, +bool RegExpBytecodePeephole::OptimizeBytecode(const uint8_t* bytecode, int length) { int old_pc = 0; bool did_optimize = false; while (old_pc < length) { @@ -633,11 +633,11 @@ } return did_optimize; } -void RegExpBytecodePeephole::CopyOptimizedBytecode(byte* to_address) const { +void RegExpBytecodePeephole::CopyOptimizedBytecode(uint8_t* to_address) const { MemCopy(to_address, &(*optimized_bytecode_buffer_.begin()), Length()); } int RegExpBytecodePeephole::Length() const { return pc(); } @@ -646,11 +646,11 @@ DCHECK(0 <= bytecode && bytecode < kRegExpBytecodeCount); return sequences_->FollowedBy(bytecode); } -int RegExpBytecodePeephole::TryOptimizeSequence(const byte* bytecode, +int RegExpBytecodePeephole::TryOptimizeSequence(const uint8_t* bytecode, int bytecode_length, int start_pc) { BytecodeSequenceNode* seq_node = sequences_; BytecodeSequenceNode* valid_seq_end = nullptr; @@ -674,11 +674,12 @@ return 0; } void RegExpBytecodePeephole::EmitOptimization( - int start_pc, const byte* bytecode, const BytecodeSequenceNode& last_node) { + int start_pc, const uint8_t* bytecode, + const BytecodeSequenceNode& last_node) { #ifdef DEBUG int optimized_start_pc = pc(); #endif // Jump sources that are mapped or marked as unused will be deleted at the end // of this method. We don't delete them immediately as we might need the @@ -874,11 +875,11 @@ (--jump_destination_fixups_.upper_bound(jump_destination))->second; DCHECK_LT(fixed_jump_destination, Length()); #ifdef DEBUG // TODO(pthier): This check could be better if we track the bytecodes // actually used and check if we jump to one of them. - byte jump_bc = optimized_bytecode_buffer_[fixed_jump_destination]; + uint8_t jump_bc = optimized_bytecode_buffer_[fixed_jump_destination]; DCHECK_GT(jump_bc, 0); DCHECK_LT(jump_bc, kRegExpBytecodeCount); #endif if (jump_destination != fixed_jump_destination) { @@ -893,48 +894,48 @@ template void RegExpBytecodePeephole::EmitValue(T value) { DCHECK(optimized_bytecode_buffer_.begin() + pc() == optimized_bytecode_buffer_.end()); - byte* value_byte_iter = reinterpret_cast(&value); + uint8_t* value_byte_iter = reinterpret_cast(&value); optimized_bytecode_buffer_.insert(optimized_bytecode_buffer_.end(), value_byte_iter, value_byte_iter + sizeof(T)); } template void RegExpBytecodePeephole::OverwriteValue(int offset, T value) { - byte* value_byte_iter = reinterpret_cast(&value); - byte* value_byte_iter_end = value_byte_iter + sizeof(T); + uint8_t* value_byte_iter = reinterpret_cast(&value); + uint8_t* value_byte_iter_end = value_byte_iter + sizeof(T); while (value_byte_iter < value_byte_iter_end) { optimized_bytecode_buffer_[offset++] = *value_byte_iter++; } } -void RegExpBytecodePeephole::CopyRangeToOutput(const byte* orig_bytecode, +void RegExpBytecodePeephole::CopyRangeToOutput(const uint8_t* orig_bytecode, int start, int length) { DCHECK(optimized_bytecode_buffer_.begin() + pc() == optimized_bytecode_buffer_.end()); optimized_bytecode_buffer_.insert(optimized_bytecode_buffer_.end(), orig_bytecode + start, orig_bytecode + start + length); } -void RegExpBytecodePeephole::SetRange(byte value, int count) { +void RegExpBytecodePeephole::SetRange(uint8_t value, int count) { DCHECK(optimized_bytecode_buffer_.begin() + pc() == optimized_bytecode_buffer_.end()); optimized_bytecode_buffer_.insert(optimized_bytecode_buffer_.end(), count, value); } -void RegExpBytecodePeephole::EmitArgument(int start_pc, const byte* bytecode, +void RegExpBytecodePeephole::EmitArgument(int start_pc, const uint8_t* bytecode, BytecodeArgumentMapping arg) { int arg_pos = start_pc + arg.offset; switch (arg.length) { case 1: DCHECK_EQ(arg.new_length, arg.length); - EmitValue(GetValue(bytecode, arg_pos)); + EmitValue(GetValue(bytecode, arg_pos)); break; case 2: DCHECK_EQ(arg.new_length, arg.length); EmitValue(GetValue(bytecode, arg_pos)); break; @@ -1003,12 +1004,13 @@ } // namespace // static Handle RegExpBytecodePeepholeOptimization::OptimizeBytecode( - Isolate* isolate, Zone* zone, Handle source, const byte* bytecode, - int length, const ZoneUnorderedMap& jump_edges) { + Isolate* isolate, Zone* zone, Handle source, + const uint8_t* bytecode, int length, + const ZoneUnorderedMap& jump_edges) { RegExpBytecodePeephole peephole(zone, length, jump_edges); bool did_optimize = peephole.OptimizeBytecode(bytecode, length); Handle array = isolate->factory()->NewByteArray(peephole.Length()); peephole.CopyOptimizedBytecode(array->GetDataStartAddress()); diff --git a/js/src/irregexp/imported/regexp-bytecodes.h b/js/src/irregexp/imported/regexp-bytecodes.h --- a/js/src/irregexp/imported/regexp-bytecodes.h +++ b/js/src/irregexp/imported/regexp-bytecodes.h @@ -245,12 +245,13 @@ inline constexpr const char* RegExpBytecodeName(int bytecode) { DCHECK(base::IsInRange(bytecode, 0, kRegExpBytecodeCount - 1)); return kRegExpBytecodeNames[bytecode]; } -void RegExpBytecodeDisassembleSingle(const byte* code_base, const byte* pc); -void RegExpBytecodeDisassemble(const byte* code_base, int length, +void RegExpBytecodeDisassembleSingle(const uint8_t* code_base, + const uint8_t* pc); +void RegExpBytecodeDisassemble(const uint8_t* code_base, int length, const char* pattern); } // namespace internal } // namespace v8 diff --git a/js/src/irregexp/imported/regexp-bytecodes.cc b/js/src/irregexp/imported/regexp-bytecodes.cc --- a/js/src/irregexp/imported/regexp-bytecodes.cc +++ b/js/src/irregexp/imported/regexp-bytecodes.cc @@ -8,11 +8,12 @@ namespace v8 { namespace internal { -void RegExpBytecodeDisassembleSingle(const byte* code_base, const byte* pc) { +void RegExpBytecodeDisassembleSingle(const uint8_t* code_base, + const uint8_t* pc) { int bytecode = *reinterpret_cast(pc) & BYTECODE_MASK; PrintF("%s", RegExpBytecodeName(bytecode)); // Args and the bytecode as hex. for (int i = 0; i < RegExpBytecodeLength(bytecode); i++) { @@ -26,18 +27,18 @@ PrintF("%c", std::isprint(b) ? b : '.'); } PrintF("\n"); } -void RegExpBytecodeDisassemble(const byte* code_base, int length, +void RegExpBytecodeDisassemble(const uint8_t* code_base, int length, const char* pattern) { PrintF("[generated bytecode for regexp pattern: '%s']\n", pattern); ptrdiff_t offset = 0; while (offset < length) { - const byte* const pc = code_base + offset; + const uint8_t* const pc = code_base + offset; PrintF("%p %4" V8PRIxPTRDIFF " ", pc, offset); RegExpBytecodeDisassembleSingle(code_base, pc); offset += RegExpBytecodeLength(*pc); } } diff --git a/js/src/irregexp/imported/regexp-interpreter.cc b/js/src/irregexp/imported/regexp-interpreter.cc --- a/js/src/irregexp/imported/regexp-interpreter.cc +++ b/js/src/irregexp/imported/regexp-interpreter.cc @@ -63,11 +63,11 @@ } return true; } #ifdef DEBUG -void MaybeTraceInterpreter(const byte* code_base, const byte* pc, +void MaybeTraceInterpreter(const uint8_t* code_base, const uint8_t* pc, int stack_depth, int current_position, uint32_t current_char, int bytecode_length, const char* bytecode_name) { if (v8_flags.trace_regexp_bytecodes) { const bool printable = std::isprint(current_char); @@ -81,22 +81,22 @@ RegExpBytecodeDisassembleSingle(code_base, pc); } } #endif // DEBUG -int32_t Load32Aligned(const byte* pc) { +int32_t Load32Aligned(const uint8_t* pc) { DCHECK_EQ(0, reinterpret_cast(pc) & 3); return *reinterpret_cast(pc); } // TODO(jgruber): Rename to Load16AlignedUnsigned. -uint32_t Load16Aligned(const byte* pc) { +uint32_t Load16Aligned(const uint8_t* pc) { DCHECK_EQ(0, reinterpret_cast(pc) & 1); return *reinterpret_cast(pc); } -int32_t Load16AlignedSigned(const byte* pc) { +int32_t Load16AlignedSigned(const uint8_t* pc) { DCHECK_EQ(0, reinterpret_cast(pc) & 1); return *reinterpret_cast(pc); } // Helpers to access the packed argument. Takes the 32 bits containing the @@ -220,11 +220,12 @@ template void UpdateCodeAndSubjectReferences( Isolate* isolate, Handle code_array, Handle subject_string, ByteArray* code_array_out, - const byte** code_base_out, const byte** pc_out, String* subject_string_out, + const uint8_t** code_base_out, const uint8_t** pc_out, + String* subject_string_out, base::Vector* subject_string_vector_out) { DisallowGarbageCollection no_gc; if (*code_base_out != code_array->GetDataStartAddress()) { *code_array_out = *code_array; @@ -242,12 +243,13 @@ // Runs all pending interrupts and updates unhandlified object references if // necessary. template IrregexpInterpreter::Result HandleInterrupts( Isolate* isolate, RegExp::CallOrigin call_origin, ByteArray* code_array_out, - String* subject_string_out, const byte** code_base_out, - base::Vector* subject_string_vector_out, const byte** pc_out) { + String* subject_string_out, const uint8_t** code_base_out, + base::Vector* subject_string_vector_out, + const uint8_t** pc_out) { DisallowGarbageCollection no_gc; StackLimitCheck check(isolate); bool js_has_overflowed = check.JsHasOverflowed(); @@ -298,11 +300,11 @@ } return IrregexpInterpreter::SUCCESS; } -bool CheckBitInTable(const uint32_t current_char, const byte* const table) { +bool CheckBitInTable(const uint32_t current_char, const uint8_t* const table) { int mask = RegExpMacroAssembler::kTableMask; int b = table[(current_char & mask) >> kBitsPerByteLog2]; int bit = (current_char & (kBitsPerByte - 1)); return (b & (1 << bit)) != 0; } @@ -426,12 +428,12 @@ #undef DECLARE_DISPATCH_TABLE_ENTRY #undef BYTECODE_FILLER_ITERATOR #endif // V8_USE_COMPUTED_GOTO - const byte* pc = code_array.GetDataStartAddress(); - const byte* code_base = pc; + const uint8_t* pc = code_array.GetDataStartAddress(); + const uint8_t* code_base = pc; InterpreterRegisters registers(total_register_count, output_registers, output_register_count); BacktrackStack backtrack_stack; @@ -442,11 +444,11 @@ PrintF("\n\nStart bytecode interpreter\n\n"); } #endif while (true) { - const byte* next_pc = pc; + const uint8_t* next_pc = pc; int32_t insn; int32_t next_insn; #if V8_USE_COMPUTED_GOTO const void* next_handler_addr; DECODE(); @@ -960,11 +962,11 @@ DISPATCH(); } BYTECODE(SKIP_UNTIL_BIT_IN_TABLE) { int32_t load_offset = LoadPacked24Signed(insn); int32_t advance = Load16AlignedSigned(pc + 4); - const byte* table = pc + 8; + const uint8_t* table = pc + 8; while (IndexIsInBounds(current + load_offset, subject.length())) { current_char = subject[current + load_offset]; if (CheckBitInTable(current_char, table)) { SET_PC_FROM_OFFSET(Load32Aligned(pc + 24)); DISPATCH(); @@ -976,11 +978,11 @@ } BYTECODE(SKIP_UNTIL_GT_OR_NOT_BIT_IN_TABLE) { int32_t load_offset = LoadPacked24Signed(insn); int32_t advance = Load16AlignedSigned(pc + 4); uint16_t limit = Load16Aligned(pc + 6); - const byte* table = pc + 8; + const uint8_t* table = pc + 8; while (IndexIsInBounds(current + load_offset, subject.length())) { current_char = subject[current + load_offset]; if (current_char > limit) { SET_PC_FROM_OFFSET(Load32Aligned(pc + 24)); DISPATCH(); diff --git a/js/src/irregexp/imported/regexp-macro-assembler.h b/js/src/irregexp/imported/regexp-macro-assembler.h --- a/js/src/irregexp/imported/regexp-macro-assembler.h +++ b/js/src/irregexp/imported/regexp-macro-assembler.h @@ -300,12 +300,12 @@ static int Match(Handle regexp, Handle subject, int* offsets_vector, int offsets_vector_length, int previous_index, Isolate* isolate); V8_EXPORT_PRIVATE static int ExecuteForTesting(String input, int start_offset, - const byte* input_start, - const byte* input_end, + const uint8_t* input_start, + const uint8_t* input_end, int* output, int output_size, Isolate* isolate, JSRegExp regexp); bool CanReadUnaligned() const override; @@ -329,29 +329,29 @@ // Called from generated code. static int CheckStackGuardState(Isolate* isolate, int start_index, RegExp::CallOrigin call_origin, Address* return_address, InstructionStream re_code, Address* subject, - const byte** input_start, - const byte** input_end); + const uint8_t** input_start, + const uint8_t** input_end); static Address word_character_map_address() { return reinterpret_cast
(&word_character_map[0]); } protected: // Byte map of one byte characters with a 0xff if the character is a word // character (digit, letter or underscore) and 0x00 otherwise. // Used by generated RegExp code. - static const byte word_character_map[256]; + static const uint8_t word_character_map[256]; Handle GetOrAddRangeArray(const ZoneList* ranges); private: // Returns a {Result} sentinel, or the number of successful matches. - static int Execute(String input, int start_offset, const byte* input_start, - const byte* input_end, int* output, int output_size, + static int Execute(String input, int start_offset, const uint8_t* input_start, + const uint8_t* input_end, int* output, int output_size, Isolate* isolate, JSRegExp regexp); ZoneUnorderedMap> range_array_cache_; }; diff --git a/js/src/irregexp/imported/regexp-macro-assembler.cc b/js/src/irregexp/imported/regexp-macro-assembler.cc --- a/js/src/irregexp/imported/regexp-macro-assembler.cc +++ b/js/src/irregexp/imported/regexp-macro-assembler.cc @@ -276,11 +276,11 @@ // This method may only be called after an interrupt. // static int NativeRegExpMacroAssembler::CheckStackGuardState( Isolate* isolate, int start_index, RegExp::CallOrigin call_origin, Address* return_address, InstructionStream re_code, Address* subject, - const byte** input_start, const byte** input_end) { + const uint8_t** input_start, const uint8_t** input_end) { DisallowGarbageCollection no_gc; Address old_pc = PointerAuthentication::AuthenticatePC(return_address, 0); DCHECK_LE(re_code.instruction_start(), old_pc); DCHECK_LE(old_pc, re_code.code(kAcquireLoad).instruction_end()); @@ -395,22 +395,22 @@ DCHECK(subject_ptr.IsExternalString() || subject_ptr.IsSeqString()); // String is now either Sequential or External int char_size_shift = is_one_byte ? 0 : 1; DisallowGarbageCollection no_gc; - const byte* input_start = + const uint8_t* input_start = subject_ptr.AddressOfCharacterAt(start_offset + slice_offset, no_gc); int byte_length = char_length << char_size_shift; - const byte* input_end = input_start + byte_length; + const uint8_t* input_end = input_start + byte_length; return Execute(*subject, start_offset, input_start, input_end, offsets_vector, offsets_vector_length, isolate, *regexp); } // static int NativeRegExpMacroAssembler::ExecuteForTesting( - String input, int start_offset, const byte* input_start, - const byte* input_end, int* output, int output_size, Isolate* isolate, + String input, int start_offset, const uint8_t* input_start, + const uint8_t* input_end, int* output, int output_size, Isolate* isolate, JSRegExp regexp) { return Execute(input, start_offset, input_start, input_end, output, output_size, isolate, regexp); } @@ -418,23 +418,23 @@ // TODO(pthier): The JSRegExp object is passed to native irregexp code to match // the signature of the interpreter. We should get rid of JS objects passed to // internal methods. int NativeRegExpMacroAssembler::Execute( String input, // This needs to be the unpacked (sliced, cons) string. - int start_offset, const byte* input_start, const byte* input_end, + int start_offset, const uint8_t* input_start, const uint8_t* input_end, int* output, int output_size, Isolate* isolate, JSRegExp regexp) { RegExpStackScope stack_scope(isolate); bool is_one_byte = String::IsOneByteRepresentationUnderneath(input); Code code = Code::cast(regexp.code(is_one_byte)); RegExp::CallOrigin call_origin = RegExp::CallOrigin::kFromRuntime; using RegexpMatcherSig = // NOLINTNEXTLINE(readability/casting) - int(Address input_string, int start_offset, const byte* input_start, - const byte* input_end, int* output, int output_size, int call_origin, - Isolate* isolate, Address regexp); + int(Address input_string, int start_offset, const uint8_t* input_start, + const uint8_t* input_end, int* output, int output_size, + int call_origin, Isolate* isolate, Address regexp); auto fn = GeneratedCode::FromCode(isolate, code); int result = fn.Call(input.ptr(), start_offset, input_start, input_end, output, output_size, call_origin, isolate, regexp.ptr()); DCHECK_GE(result, SMALLEST_REGEXP_RESULT); @@ -451,11 +451,11 @@ } #endif // !COMPILING_IRREGEXP_FOR_EXTERNAL_EMBEDDER // clang-format off -const byte NativeRegExpMacroAssembler::word_character_map[] = { +const uint8_t NativeRegExpMacroAssembler::word_character_map[] = { 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, diff --git a/js/src/irregexp/imported/regexp-parser.cc b/js/src/irregexp/imported/regexp-parser.cc --- a/js/src/irregexp/imported/regexp-parser.cc +++ b/js/src/irregexp/imported/regexp-parser.cc @@ -37,19 +37,15 @@ kClassSetRange }; class RegExpTextBuilder { public: - using SmallRegExpTreeVector = - base::SmallVector>; + using SmallRegExpTreeVector = SmallZoneVector; RegExpTextBuilder(Zone* zone, SmallRegExpTreeVector* terms_storage, RegExpFlags flags) - : zone_(zone), - flags_(flags), - terms_(terms_storage), - text_(ZoneAllocator{zone}) {} + : zone_(zone), flags_(flags), terms_(terms_storage), text_(zone) {} void AddCharacter(base::uc16 character); void AddUnicodeCharacter(base::uc32 character); void AddEscapedUnicodeCharacter(base::uc32 character); void AddAtom(RegExpTree* atom); void AddTerm(RegExpTree* term); @@ -289,12 +285,12 @@ class RegExpBuilder { public: RegExpBuilder(Zone* zone, RegExpFlags flags) : zone_(zone), flags_(flags), - terms_(ZoneAllocator{zone}), - alternatives_(ZoneAllocator{zone}), + terms_(zone), + alternatives_(zone), text_builder_(RegExpTextBuilder{zone, &terms_, flags}) {} void AddCharacter(base::uc16 character); void AddUnicodeCharacter(base::uc32 character); void AddEscapedUnicodeCharacter(base::uc32 character); // "Adds" an empty expression. Does nothing except consume a @@ -328,12 +324,11 @@ Zone* const zone_; bool pending_empty_ = false; const RegExpFlags flags_; - using SmallRegExpTreeVector = - base::SmallVector>; + using SmallRegExpTreeVector = SmallZoneVector; SmallRegExpTreeVector terms_; SmallRegExpTreeVector alternatives_; RegExpTextBuilder text_builder_; }; @@ -1836,12 +1831,11 @@ RegExpFlags flags, Zone* zone) { DCHECK(set.hasStrings()); DCHECK(IsUnicodeSets(flags)); DCHECK_NOT_NULL(strings); - RegExpTextBuilder::SmallRegExpTreeVector string_storage( - ZoneAllocator{zone}); + RegExpTextBuilder::SmallRegExpTreeVector string_storage(zone); RegExpTextBuilder string_builder(zone, &string_storage, flags); const bool needs_case_folding = IsIgnoreCase(flags); icu::UnicodeSetIterator iter(set); iter.skipToStrings(); while (iter.next()) { @@ -2496,12 +2490,11 @@ } Advance(); ZoneList* string = zone()->template New>(4, zone()); - RegExpTextBuilder::SmallRegExpTreeVector string_storage( - ZoneAllocator{zone()}); + RegExpTextBuilder::SmallRegExpTreeVector string_storage(zone()); RegExpTextBuilder string_builder(zone(), &string_storage, flags()); while (has_more() && current() != '}') { if (current() == '|') { AddClassString(string, string_builder.ToRegExp(), ranges, strings, diff --git a/js/src/irregexp/imported/regexp-stack.h b/js/src/irregexp/imported/regexp-stack.h --- a/js/src/irregexp/imported/regexp-stack.h +++ b/js/src/irregexp/imported/regexp-stack.h @@ -91,11 +91,11 @@ // we can skip availability-checks later on. // It's double the slack size to ensure that we have a bit of breathing room // before NativeRegExpMacroAssembler::GrowStack must be called. static constexpr size_t kStaticStackSize = 2 * kStackLimitSlack * kSystemPointerSize; - byte static_stack_[kStaticStackSize] = {0}; + uint8_t static_stack_[kStaticStackSize] = {0}; static_assert(kStaticStackSize <= kMaximumStackSize); // Structure holding the allocated memory, size and limit. Thread switching // archives and restores this struct. @@ -106,14 +106,14 @@ // If memory_size_ > 0 then // - memory_, memory_top_, stack_pointer_ must be non-nullptr // - memory_top_ = memory_ + memory_size_ // - memory_ <= stack_pointer_ <= memory_top_ - byte* memory_ = nullptr; - byte* memory_top_ = nullptr; + uint8_t* memory_ = nullptr; + uint8_t* memory_top_ = nullptr; size_t memory_size_ = 0; - byte* stack_pointer_ = nullptr; + uint8_t* stack_pointer_ = nullptr; Address limit_ = kNullAddress; bool owns_memory_ = false; // Whether memory_ is owned and must be freed. void ResetToStaticStack(RegExpStack* regexp_stack); void ResetToStaticStackIfEmpty(RegExpStack* regexp_stack) { diff --git a/js/src/irregexp/imported/regexp-stack.cc b/js/src/irregexp/imported/regexp-stack.cc --- a/js/src/irregexp/imported/regexp-stack.cc +++ b/js/src/irregexp/imported/regexp-stack.cc @@ -70,11 +70,11 @@ Address RegExpStack::EnsureCapacity(size_t size) { if (size > kMaximumStackSize) return kNullAddress; if (thread_local_.memory_size_ < size) { if (size < kMinimumDynamicStackSize) size = kMinimumDynamicStackSize; - byte* new_memory = NewArray(size); + uint8_t* new_memory = NewArray(size); if (thread_local_.memory_size_ > 0) { // Copy original memory into top of new memory. MemCopy(new_memory + size - thread_local_.memory_size_, thread_local_.memory_, thread_local_.memory_size_); if (thread_local_.owns_memory_) DeleteArray(thread_local_.memory_); diff --git a/js/src/irregexp/moz.yaml b/js/src/irregexp/moz.yaml --- a/js/src/irregexp/moz.yaml +++ b/js/src/irregexp/moz.yaml @@ -7,12 +7,12 @@ origin: name: irregexp description: A fast regular expression engine from V8 url: https://v8.dev - release: d94dfc2b01f988566aa410ce871588cf23b1285d (Thu May 04 20:02:50 2023). - revision: d94dfc2b01f988566aa410ce871588cf23b1285d + release: 801082598700b0c5c8aa82068f70125b2b76ec81 (Wed Jun 07 20:21:00 2023). + revision: 801082598700b0c5c8aa82068f70125b2b76ec81 license: BSD-3-Clause license-file: LICENSE.v8 vendoring: