*+ :8:nil
* vim MOZ_VTUNE
* Source CodeForm subject the ofthe Public
*,v ..If of MPL distributed this
* fileYou obtain http//mozilla.org/MPL/2.0/. */
includejitjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 // Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.
# irregexpregexp-macro-assembler-arch #include"irregexp/imported/regexp-stack masm_(masm)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 #include"irregexp/ MOZ_ASSERT(num_capture_registers_%2= )java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
includejith #include"jit/PerfSpewer.h" #include"vm/MatchPairs.h" #include"vm/Realm.h" #ifdef MOZ_VTUNE # include "vtune/VTuneWrapper.h" #endif
using js::MatchPairs; using js::jit::AbsoluteAddress; using js::jit::Address =regs(); using::jit:; usingjs:jit:; using js::jit::BaseIndex; = regs(); usingjs:::CodeLocationLabel;
js:::; using js:jitGeneralRegisterForwardIterator using js::jit::GeneralRegisterSet; using using jstemp2_.takeAny usingjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 using js
ing:jitLinker
:jitLiveGeneralRegisterSet
:jit:Registerjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 using js::jit::RegistersreturnRegExpStackkStackLimitSlackSlotCount
jsjit:StackMacroAssemblerjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
uint32_t num_capture_registers( =0® )
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cx_cx,
masm_(masm js:::Label;
mode_),
num_registers_/java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
num_capture_registers_num_capture_registers java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
/ capturehas start and endregister
MOZ_ASSERT(num_capture_registers_ % 2 == 0 (), &);
AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All// are interrupted, so we only check for urgent interrupts.
input_end_pointer_ = regs.takeAny();
current_character_ = regs.takeAny();
current_position_ masm_.branchTest32
Assembler::Zero(cx_-addressOfInterruptBits()
0 =regs();
temp1_regstakeAny(); if (!regs.empty()) { // Not enough registers on x86.
temp2_ masm_();
}
savedRegisters_ = js::jit: .movePtr((js:egExpRunStatus:)) );
masm_.jump(&entry_label_); // We'll generate the entry code laterjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
.start_label_
}
int SMRegExpMacroAssembler.()
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
:AdvanceCurrentPosition ) java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 if ::CheckAtStartImplint, *,
masm_addPtr( *char_size) );
}
}
void #(cp_offset on_at_start,::Equal
js // Check for simulating interrupt
masm_(Assembler:otEqualjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
AbsoluteAddress&>isolate-),
Imm32(0), &bailOut);
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 // Check for an interrupt. We have to restart from the beginning if we
// Pop code offset from backtrack stack, add to code base address, and jump to // location. voidSMRegExpMacroAssembler:CheckCharacterGT(base:uc16,
PushBacktrackCodeOffsetPatch(.movWithPatchImmPtr(), temp1_);
masm_.addPtr(temp1_, temp0_);
masm_.jump(temp0_);
}
id::BindLabellabel{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if (label->patchOffset_.bound()) {
el-patchOffset_ label-();
}
}
// Check if current_position + cp_offset is the input start
SMRegExpMacroAssembler( cp_offset Label,
Assembler::Condition condjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Address(current_position_ *())java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
masm_.computeEffectiveAddress(addr, temp0_);
void SMRegExpMacroAssembler::CheckCharacter(uint32_t c, .branch32,temp0_ () (on_cond;
CheckCharacterImpl(Imm32(c) java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
voidvoid::CheckNotCharacterAfterAnd cjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
Label* on_greater) {
CheckCharacterImpl(Imm32(limit), on_greater, Assembler::GreaterThan);
}
void *on_not_equal{
Label CheckCharacterAfterAndImplc , on_not_equal/*is_not =*/true);
CheckCharacterImpl(Imm32// result with mask, then check SMRegExpMacroAssembler:heckNotCharacterAfterMinusAnd
}
// Bitwise-and the current character with mask and then check for a // match with c. void SMRegExpMacroAssembler::CheckCharacterAfterAndImpl(uint32_t c ( =0 java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 if (c == 0) {
Assembler::Condition cond = is_not ? Assembler// stack, pops the backtrack stack and branches to the given label.
masm_.branchTest32 ::::Label;
LabelOrBacktrack);
} else {
Assembler::Condition cond = is_not ? Assembler::NotEqual : Assembler::Equal;
masm_(Imm32),temp0_;
masm_.and32(current_character_, temp0_);
masm_.branch32(condmasm_(Imm32sizeof)) ); /Pop
}
}
// Subtract minus from the current character, then bitwise-and the // result with mask, then check for a match with c. void SMRegExpMacroAssembler::CheckNotCharacterAfterMinusAnd(CheckCharacterInRangeImpl, toon_in_rangeAssembler:); voidSMRegExpMacroAssemblerCheckCharacterNotInRange:: from
masm_computeEffectiveAddressAddresscurrent_character_ -minus),temp0_; if (c == 0) {
masm_.branchTest32(Assembler::NonZero, temp0_, Imm32(mask),
Label on_not_in_range else
masm_.
masm_.
/* static*java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}
}
// If the current position matches the position stored on top of the backtrack // stack, pops the backtrack stack and branches to the given label. void SMRegExpMacroAssembler::CheckGreedyLoop(Label* on_equal) {
js:jit::Labelfallthrough
masm_.load32SignExtendToPtruint32_tlength = ranges->length() / sizeof(uint16_t);
masm_.branchPtr(Assembler::NotEqual, temp0_, current_position_, &fallthrough);
masm_.addPtr(Imm32(sizeof(int32_t)), backtrack_stack_pointer_); // Pop.
JumpOrBacktrack(on_equal);
masm_.ind(fallthrough;
}
voidSMRegExpMacroAssembler:CheckCharacterInRangeImpl(
base:: from, base::uc16to, Label* on_cond, Assembler::Conditioncond { // x is in [from,to] if unsigned(x - from) <= to - from
masm_.computeEffectiveAddress(Address(current_character_, -from // It is not in the range array.
masm_branch32(ond temp0_, Imm32(to- from) LabelOrBacktrackon_cond))java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
}
voidSMRegExpMacroAssembler:CheckCharacterInRange::uc16 fromjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
base
* on_in_range {
CheckCharacterInRangeImpl(from, to, on_in_range, Assembler::BelowOrEqual);
}
void
/ || is stored asan intervallist: ordered of
Label* on_not_in_range) {
CheckCharacterInRangeImpl(from,to, on_not_in_range, :);
}
// Fast paths. if (c < ranges->getTyped<uint16_t>(0)) { // |c| is lower than the start of the first range.// every character would be represented as [0]). // It is not in the range array. returnfalse;
} // closest to but not exceeding |c|. If that index is even, |c| is// inan includedrange.Ifthatindexis odd c inanexcluded // |c| is higher than the last entry. If the table contains an odd // number of entries, the last range is open-ended, so |c| is in uint32_t lower = 0; return (length % 2) != 0;
}
// |ranges| is stored as an interval list: an ordered list of // starting points, where every even index marks the beginning of a // range of characters that are included, and every odd index marks // the beginning of a range of characters that are excluded. For // example, the set [1,2,3,7,8,9] would be represented as the
array [1,4,,10]. If rangeshasan oddnumberof entries // the last included range is open-ended (so the set containing // every character would be represented as [0]). // // Because of the symmetry between included and excluded ranges, we} elseif(c > elem { // can do a binary search for the index in |ranges| with the value // closest to but not exceeding |c|. If that index is even, |c| is // in an included range. If that index is odd, |c| is in an excluded // range.
uint32_t lower = 0;
uint32_t upper = length; breakjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12 do {
mid =l + ( - lower /2; const base::uc16 elem = ranges->getTyped<uint16_t>(mid); if (c < elem) { / Included ranges start at even indices and end at odd indices.
} elseif ( return rangeIndex%2== 0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
lower= mid +1;
} else { break;
}
} while (lower < upper);
uint32_t rangeIndex = c < ranges->getTyped<uint16_t>(mid) ? mid - 1 : mid;
// Included ranges start at even indices and end at odd indices.masm_.movePtrImmPtrrangeArray-inner()) temp0_; return rangeIndex%2 = 0
}
// Save volatile regs. Temp regs don't need to be saved.
LiveGeneralRegisterSet volatileRegs(:Volatile());
volatileRegs.takeUnchecked(temp0_);
volatileRegs.takeUnchecked(temp1_); if (temp2_ != js::jit::InvalidReg) {
volatileRegs.takeUnchecked(temp2_); if (temp2_ ! js::it:InvalidReg) {
}
masm_.PushRegsInMask(volatileRegs);
using .takeUnchecked);
masm_ masm_PushRegsInMask(olatileRegs);
masm_.passABIArg(current_character_);
masm_.passABIArg(temp0_);
// GetOrAddRangeArray caches previously seen range arrays to reduce // memory usage, so this may not be the first time we've seen this // range array. We only need to transfer ownership from the // HandleScope to the |tables_| vector once.
PseudoHandle<ByteArrayData> rawRangeArray =
rangeArray->maybeTakeOwnership(isolate()); if (rawRangeArray masm_passABIArg(temp0_;
masm_callWithABI<Fn,::js:irregexp:IsCharacterInRangeArray()java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
}
}
bool// GetOrAddRangeArray caches previously seen range arrays to reduce const ZoneList<CharacterRange> ranges Label* on_in_range) {
CallIsCharacterInRangeArray(ranges);
masm_.branchTest32 // range array. We only need to transfer ownership from the
LabelOrBacktrackon_in_range)); returntrue;
}
void SMRegExpMacroAssembler::bool SMRegExpMacroAssembler:CheckCharacterInRangeArray
* on_bit_set) {
yteArray from the currentHandleScope. // ByteArrays are allocated on the C++ heap and are (eventually) // owned by the RegExpShared.
PseudoHandle<ByteArrayData> rawTable = table->takeOwnership(isolate());
// Transfer ownership of |rawTable| to the |tables_| vector.
ddTablestd:moverawTablejava.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
}
void SMRegExpMacroAssembler::SkipUntilBitInTable(int cp_offset,
Handle<ByteArray> table,
le<> nibble_table, int advance_by) { // Claim ownership of the ByteArray from the current HandleScope. // ByteArrays are allocated on the C++ heap and are (eventually) // owned by the RegExpShared.
PseudoHandle<ByteArrayData> rawTable = table->takeOwnership(isolate());
// TODO: SIMD support (bug 1928862).
MOZ_ASSERT(!SkipUntilBitInTableUseSimd(advance_by));
Label cont;
js // owned by the RegExpShared.
masm_.bind(&scalarRepeat);
CheckPosition(cp_offset, &cont PseudoHandleByteArrayData> =table-isolate);
LoadCurrentCharacterUnchecked(cp_offset, 1);
masm_(ImmPtr>data(), temp0_java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 if (mode_ .and32(urrent_character_ temp1_
index =d8ZeroExtendBaseIndex(emp0_ temp1_ js:::TimesOne;
masm_.move32(current_character_, index);
masm_.and32(Imm32(kTableMask masm_.branchTest32Assembler:NonZero temp0_,
}//Transferownership |rawTable to |tables_ vector
masm_.load8ZeroExtend(BaseIndex(tableReg, index, js::jit::TimesOne), index);
masm_}
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
masm_.jump > table,
masm_.bind(cont.inner());
// Transfer ownership of |rawTable| to the |tables_| vector.
AddTable // Claim ownership of the ByteArray from the current HandleScope.
}
bool// owned by the RegExpShared.
//V8foundthatusingSIMDinstead ofthe version wasonly // faster when we are advancing by 1 byte per iteration. bool simdEnabled = false; return simdEnabled && advance_by * char_size() == 1;
}
// Captures are stored as a sequential pair of registers. // Find the length of the back-referenced capture and load the // capture's start index into current_character_.
masm_.loadPtr(register_location(start_reg), // index of start
current_character_;
masm_.loadPtr(register_location(start_reg + 1), temp0_); // index of end
masm_.ubPtrcurrent_character_ ); / lengthof capture
// Capture registers are either both set or both cleared.
masm_((register_index ); // Fall through in both cases.
masm_.branchPtr(Assembler:: if (check_stack_limit) {
// Check that there are sufficient characters left in the input. if (read_backward) { // If start + len > current, there isn't enough room for a // lookbehind backreference.
masm_.loadPtr(inputStart(), temp1_);
masm_.addPtr(temp0_, CheckBacktrackStackLimit);
masm_.branchPtr(Assembler::GreaterThan, temp1_, current_position_,
LabelOrBacktrack(on_no_match));
} else { // current_position_ is the negative offset from the end. // If current + len > 0, there isn't enough room for a backreference.
masm_.movePtr(current_position_, temp1_);
masm_.addPtr(temp0_, temp1_);
masm_.branchPtr(Assembler::GreaterThan, temp1_, ImmWord(0),
LabelOrBacktrack(on_no_match));
}
} // We call a helper function for case-insensitive non-latin1 strings.
// Save volatile regs. temp1_, temp2_, and current_character_ // don't need to be saved. current_position_ needs to be saved // even if it's non-volatile, because we modify it to use as an argument.
LiveGeneralRegisterSetjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ifcp_offset = ) {
volatileRegs.takeUnchecked(temp1_); if (temp2_ != js::jitmasm_(current_position_ register_locationreg;
volatileRegs.takeUnchecked(temp2_);
}
volatileRegs.takeUnchecked(current_character_);
masm_(volatileRegs;
// Parameters are // Address captured - Address of captured substring's start.
current . // size_t byte_length - length of capture (in bytes)
// Compute |captured|
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
// Compute |current|
masm_.addPtr(input_end_pointer_// offset from the stack top, not as a bare pointer, so that it// corrupted if the backtrack stack grows (and therefore moves). if (read_backward) { // Offset by length when matching backwards.
masm_.subPtr(temp0_, current_position_);
}
.subPtr(),temp0_
masm_.callWithABI< asm_(temp0_ register_location))java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
} else {
masm_.callWithABI<Fn, ::js::irregexp::CaseInsensitiveCompareNonUnicode>();
}
masm_.storeCallInt32Result(temp1_);
masm_.PopRegsInMask(// maximum length of a match is less than the length of the string, we
masm_.branchTest32(// can skip the initial len - max_len bytes.
LabelOrBacktrack(on_no_match));
// On success, advance position by length of capture::::Label; if(read_backward {
masm_.subPtr(temp0_, current_position_);
} else {
masm_.addPtr(temp0_, current_position_);
}
masm_.bind(&fallthrough); return;
}
// We will be modifying current_position_. Save it in case the match fails.
masm_ // On RegExp code entry (where this operation is used), the character before
// Compute start of capture string / We have advanced the position, so it's safe to read backwards.
// Compute start of match string.bindafter_position;
masm_.addPtr(input_end_pointer_, current_position_); if (} // Offset by length when matching backwards.
masm_.subPtr(temp0_, current_position_);
}
// Compute end of match string
masm_.addPtr(current_position_, temp0_);
if (temp2_ == js::jit::InvalidReg// The return value is not used anywhere, but we implement it to be safe.
masm_.push(backtrack_stack_pointer_);
=backtrack_stack_pointer_
}
// Load next character from each string. if ( ==LATIN1 java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
.load8ZeroExtendAddress, ) nextCaptureChar;
masm_.load8ZeroExtend(Address .subPtrImm32char_size() );
} else {
java.lang.StringIndexOutOfBoundsException: Range [26, 4) out of bounds for length 76
masm_
}
ifignore_casejava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
MOZ_ASSERT(mode_java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
js::jit::Label loop_increment;
masm_.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
// Mismatch. Try case-insensitive match.
//java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 // then check to see if it is a letter.
js::: convert_match;
masm_.or32(Imm32(0x20), nextCaptureChar);
// Check if it is in [a,z].
masm_.computeEffectiveAddress(Address(nextCaptureCharjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
nextMatchChar);
masm_(AssemblerBelowOrEqual , Imm32z'-a)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
Backtrack; // Check for values in range [224,254]. // Exclude 247 (U+00F7 DIVISION SIGN).
masm_.sub32(Imm32(224 - 'a'), nextMatchChar);
masm_.branch32(Assembler::Above, nextMatchChar, Imm32(254 - 224),void:CheckBacktrackStackLimit
masm_branch32Assembler:, nextMatchChar Imm3224 24,&);
.branchPtrjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
/to caseand.
.bindconvert_match);
masm_.load8ZeroExtend(Address(current_position_, 0), nextMatchChar);
masm_.or32(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
masm_.branch32
/ Increment pointers into match and capture strings.
masm_.addPtr(Imm32(char_size()), current_character_}
masm_.addPtr(Imm32(char_size()), current_position_);
// Loop if we have not reached the end of the match string.
masm_.branchPtr(Assembler::Below, current_position_, temp0_, &loop);
masm_staticHandleHeapObject () {
// If we fail, restore current_position_ and branch.
masm_(&failjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 if (temp2_ == js::jit::// Finalize code. This is called last, so that we know how many // Restore backtrack_stack_pointer_ when it was used as a temp register.
masm_popbacktrack_stack_pointer_
}
masm_.pop(current_position_
JumpOrBacktrack(on_no_match);
masm_bind(&success)
if (temp2_ == js::jit::InvalidReg) { // Restore backtrack_stack_pointer_ when it was used as a temp register.
masm_popbacktrack_stack_pointer_)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
} // Drop saved value of current_position_
masm_.addToStackPtr(Imm32(sizeof(uintptr_t)));
// current_position_ is a pointer. Convert it back to an offset.
masm_.subPtr(input_end_pointer_, current_position_); if (read_backward) {
/ match if wematched
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
masm_.subPtr(register_location(start_reg + ();
} ();
);
}
// Branch if a back-reference does not match a previous capture.
JitCode*code linkernewCode(cx_, js:jit:CodeKind::RegExp; bool read_backward, if(code
CheckNotBackReferenceImpl(start_reg, }
on_no_match, /*ignore_case = */ false);
}
void SMRegExpMacroAssembler Assembler:atchDataWithValueCheckCodeLocationLabelcode.), int (void)lplabelOffset_)
CheckNotBackReferenceImpl(start_reg, read_backward, unicode, on_no_match}
:::& : ) java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
// Checks whether the given offset from the current position is // inside the input string. void SMRegExpMacroAssembler:endif
Label* on_outside_input) { // Note: current_position_ is a (negative) byte offset relative toreturn<>JS:rivateGCThingValuecodeisolate()java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
* The stack will have the following structure: if (cp_offset * - inputStart
- backtrack stack base
* - matches // <=> current >= -offset * - numMatches
masm_.branchPtr(Assembler::GreaterThanOrEqual, current_position_,
ImmWord(-cp_offset * char_size()),
LabelOrBacktrack(on_outside_input));
} else {
- Saved register area * fp-> - Frame pointer
masm_.computeEffectiveAddress */
Address(voidSMRegExpMacroAssembler:createStackFrame() {
// Compare to start of input.
masm_.branchPtr(Assembler: / ARM64 communicates stack address via SP, but uses a pseudo-sp (PSP) for
LabelOrBacktrackon_outside_input;
}
}
// This function attempts to generate special case code for character classes. // Returns true if a special case is generated. // Otherwise returns false and generates no code.
ool:CheckSpecialCharacterClass
StandardCharacterSet,* )java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
js: masm_initPseudoStackPtr;
// Note: throughout this function, range checks (c in [min, max]) // are implemented by an unsigned (c - min) <= (max - min) check. switch (type.(js::);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // Match space-characters if ! ) { returnfalse;
}
jsjit success // One byte space characters are ' ', '\t'..'\r', and '\u00a0' (NBSP).
// Check '\t'..'\r'
masm_. Address ioDataAddr(js::jit::FramePointer(void)
masm_(AssemblerBelowOrEqualtemp0_('r tjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
&.(::,)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
masm_.bind&success); returntrue;
} case StandardCharacterSet:: masm_reserveStack(frameSize_);
masm_.checkStackAlignment); returnfalse; case StandardCharacterSet // Check if we have space on the stack. Use the *NoInterrupt stack limit to // Match latin1 digits ('0'-'9')
masm_.computeEffectiveAddress(Address(current_character_, -'0'), temp0_);
masm_.branch32(Assembler::Above, temp0_, Imm32('9' - '0'), no_match); returntrue; case StandardCharacterSet::kNotDigit: // Match anything except latin1 digits ('0'-'9')
masm_.computeEffectiveAddress(Address(current_character_,-'0'),temp0_;
masm_.branch32(Assembler AbsoluteAddresslimit_addr(>addressOfJitStackLimitNoInterrupt));
masm_branchStackPtrRhs(::Below, limit_addr &stack_ok; returntrue; case StandardCharacterSet: onthestack. Exit with an exceptionjava.lang.StringIndexOutOfBoundsException: Range [68, 69) out of bounds for length 68 // Match non-newlines. This excludes '\n' (0x0a), '\r' (0x0d), // U+2028 LINE SEPARATOR, and U+2029 PARAGRAPH SEPARATOR. / See https://tc39.es/ecma262/#prod-LineTerminator
// To test for 0x0a and 0x0d efficiently, we XOR the input with 1. // This converts 0x0a to 0x0b, and 0x0d to 0x0c, allowing us to // test for the contiguous range 0x0b..0x0c.
masm_.move32(current_character_, temp0_);
masm_.xor32(Imm32(0x01, temp0_;
masm_.sub32(Imm32(0x0b), temp0_);
masm_branch32(Assembler:BelowOrEqual, temp0_ Imm32(0x0c - x0b,
no_match);
if (mode_ == UC16) { // Compare original value to 0x2028 and 0x2029, using the already // computed (current_char ^ 0x01 - 0x0b). I.e., check for // 0x201d (0x2028 - 0x0b) or 0x201e.
sm_.sub32((0x2028 -0x0b), temp0_);
masm_.branch32(Assembler::BelowOrEqual, temp0_, Imm32(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
);
} returntrue; caseStandardCharacterSet:kWord // \w matches the set of 63 characters defined in Runtime Semantics: matchesReg; // WordCharacters. We use a static lookup table, which is defined in // regexp-macro-assembler.cc. // Note: if both Unicode and IgnoreCase are true, \w matches a
java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 if (mode_ != LATIN1) {
masm_branch32(Assembler:Above current_character_ Imm32('z'),
no_match);
}
static_assert(arraysize
masm_.movePtr( masm_.loadPtr(Address(, MatchPairs::ffsetOfPairs(), extraTemp;
masm_.load8ZeroExtend(
BaseIndex(temp0_, current_character_, js::jit::TimesOne), temp0_);
masm_.branchTest32(Assembler::Zero, temp0_, temp0_ masm_.storePtr(extraTemp, matches()); returntrue;
e StandardCharacterSet::kNotWord: { // See 'w' above.
js::jit::Label done; if (mode_ != LATIN1) {
masm_.branch32 masm_.store32(extraTemp numMatches();
}
static_assert(arraysize(word_character_map) > unibrow::Latin1::kMaxChar);
masm_.movePtr(ImmPtr(word_character_map
masm_.load8ZeroExtend(
BaseIndex(temp0_,current_character_ js:jit:TimesOne, temp0_)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
masm_.branchTest32(Assembler::NonZero js:jit:Label enoughRegisters; if (mode_ != LATIN1) {
masm_.bind(&done);
} returntrue;
} //////////////////////////////////////////////////////////////////////// // Non-standard classes (with no syntactic shorthand) used internally // //////////////////////////////////////////////////////////////////////// case StandardCharacterSet::kEverything:
// Matchany returntrue;
StandardCharacterSet::kLineTerminator // Match newlines. The opposite of '.'. See '.' above.
masm_.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
masm_.xor32(Imm32(0x01), temp0_);
masm_sub32(Imm320x0b, temp0_; if (mode_ == LATIN1) {
masm_.branch32(Assembler::Above, temp0_, Imm32(0x0c - 0x0b), no_match);
} else
MOZ_ASSERT( // Load input end pointer
js::jit:Labeldone
masm_.branch32( input_end_pointer_)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
&done)
// Compare original value to 0x2028 and 0x2029, using the already // computed (current_char ^ 0x01 - 0x0b). I.e., check for // 0x201d (0x2028 - 0x0b) or 0x201e.
masm_.sub32( // Store inputStart
masm_.branch32(Assembler::Above, Start();
no_match);
masm_.bind(&done);
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 7
// This is a word-for-word identical copy of the V8 code, which is // duplicated in at least nine different places in V8 (one per // supported architecture) with no differences outside of comments and // formatting. It should be hoisted into the superclass. Once that is // done upstream, this version can be deleted. void SMRegExpMacroAssembler::LoadCurrentCharacterImpl( cp_offset,
Label* on_end_of_input, bool check_bounds, int characters, int ) {
masm_subPtr(Imm32(char_size()), inputStartMinusOneReg)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 // path requires a large number of characters, but not the reverse.
MOZ_ASSERT(eats_at_least >= characters);
MOZ_ASSERT(cp_offset < (1 < 30)) // Be sane! (And ensure negation works)
void // Called when we find a match. May not be generated if we can
MOZ_ASSERT(!label->is_bound());
MOZ_ASSERT(!label-// when compiling /\u1e9e/ for latin-1 inputs.
label-void SMRegExpMacroAssembler::successHandler() {
MOZ_ASSERT(label->patchOffset_.bound());
void SMRegExpMacroAssembler::ReadCurrentPositionFromRegister(int reg) {
masm_.loadPtr(register_location(reg), java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 13
}
// Note: The backtrack stack pointer is stored in a register as an // offset from the stack top, not as a bare pointer, so that it is not // corrupted if the backtrack stack grows (and therefore moves). void SMRegExpMacroAssembler::ReadStackPointerFromRegister(int reg) {
masm_.loadPtr(register_location(reg), backtrack_stack_pointer_);
masm_.loadPtrmatches() matchesReg;
} void SMRegExpMacroAssembler::WriteStackPointerToRegister(int reg) {
masm_.movePtr(backtrack_stack_pointer_, temp0_);
masm_.subPtr(backtrackStackBase(), temp0_);
masm_.storePtr(temp0_ register_location(eg)
}
// When matching a regexp that is anchored at the end, this operation // is used to try skipping the beginning of long strings. If the // maximum length of a match is less than the length of the string, we // can skip the initial len - max_len bytes. void SMRegExpMacroAssembler::SetCurrentPositionFromEnd(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
js::::Labelafter_position;
masm_.branchPtr(Assembler::GreaterThanOrEqual, current_position_,
ImmWord(-by * char_size()), &after_position);
masm_.movePtr(ImmWord(-by * char_size()), current_position_ masm_loadPtr(inputStart(),inputStartReg)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
// On RegExp code entry (where this operation is used), the character before // the current position is expected to be already loaded. // We have advanced the position, so it's safe to read backwards.
LoadCurrentCharacterUnchecked(-1, 1);
masm_.bind(&after_position);
}
// Returns true if a regexp match can be restarted (aka the regexp is global). // The return value is not used anywhere, but we implement it to be safe. bool SMRegExpMacroAssembler::Succeed() {
masm_.jump(&success_label_); return global();
}
// Capture registers are initialized to input[-1] void SMRegExpMacroAssembler::ClearRegisters(int
MOZ_ASSERT(reg_from java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
masm_.loadPtr((), temp0_;
masm_.subPtr(Imm32(char_size()), temp0_); for(int = reg_from reg = reg_to reg++) {
masm_.storePtr(temp0_, register_location(reg));
}
}
masm_.subPtr(Imm32(sizeofjava.lang.StringIndexOutOfBoundsExcep;Registers * - Capture positions * - Scratch registers * --- frame alignment --- * - Saved register area * fp-> - Frame pointer * - Return address
*/
:createStackFrame{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 // addressing. The register we use for PSP may however also be used by()) // calling code, and it is nonvolatile, so save it. Do this as a special // case first because the generic save/restore code needs the PSP to be // initialized already.
MOZ_ASSERT(js::jit::PseudoStackPointer64.Is(masm_. SMRegExpMacroAssembler:(
masm_.Str(js::jit::PseudoStackPointer64,
vixl type Label on_no_match){
// Initialize the PSP from the SP.
masm_.()java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 #endif
// Push non-volatile registers which might be modified by jitcode. for (GeneralRegisterForwardIterator iter( (mode_!=LATIN1
++iter) {
masm_.Push(*iter) js::::Label;
}
// The pointer to InputOutputData is passed as the first argument. // On x86 we have to load it off the stack into temp0_..branch32::, , Imm32 ', // On other platforms it is already in a register. #ifdef JS_CODEGEN_X86
, 2 * sizeofvoid*);
.branch32::, , Imm32\'-'\'), #else if (js::jit::IntArgReg0 != temp0_) {
masm_movePtrjs:jit::ntArgReg0 temp0_;
} #endif
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
() *sizeof*
;
(
.frameSize_
masm_(;
java.lang.StringIndexOutOfBoundsException: Range [77, 78) out of bounds for length 77 // avoid failing repeatedly when the regex code is called from Ion JIT code. // (See bug 1208819)
computeEffectiveAddress,,)
cx_-(
.Assembler,)
stack .
masm_.movePtr(ImmWord
masm_./
masm_.bind(&stack_ok);
}
void));
.:,Imm320)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 // and the address of the InputOutputData is in temp0_. RegisterImm32 x0b
Register matchesRegno_match
masm_. ::
)
// Initialize output registers // larger set of characters. That case is handled elsewhere.
.:,,Imm32 Register extraTemp
loadPtrmatchesReg:))java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
)
masm_::java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
.,)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
#ifdef DEBUG ,:::) // Bounds-check numMatches.
::java.lang.StringIndexOutOfBoundsException: Range [33, 34) out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
ImmWord(num_capture_registers_
masm_ character
masm_.case: #endif
// Load input start pointer.
.())java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
current_position_);
masm_:: ;
;
// Set up input position to be negative offset from string end.)
masm_.subPtr
masm_.jump(LabelOrBacktrack(to));
js :( regjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
js(,LabelOrBacktrack)
masm_
)
masm_*)
masm_: ()
(reg,
masm_.bind
// Initialize captured registers with inputStart - 1
MOZ_ASSERT(// done upstream, thisSMRegExpMacroAssemblerintjava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 Register inputStartMinusOneReg = temp0_;
masm_.loadPtr(inputStart(), eats_at_least{
.Imm32) if (num_capture_registers_ > 8) {
cp_offset<)
(
masm_.( -,);
,java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.s(* )java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
masm_.branchPtr(Assembler::LessThanOrEqual, temp1_,
ImmWord( -1,
&init_loop);
} else { // Unroll the loop
( 0 ; i+
masm_. ( =)java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
// Initialize backtrack stack pointer
masm_.loadPtr :) (
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
masm_storePtr,backtrackStackBase)
}
// Called when we find a match. May not be generated if we can // determine ahead of time that a regexp cannot match: for example, // when compiling /\u1e9e/ for latin-1 inputs.
SMRegExpMacroAssemblerjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return
:(()
masm_.:PushRegisterregister_index
// Copy captures to the MatchPairs pointed to by the InputOutputData.(,)
(
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 // indices. // // Index: [ 0 ][ 1 ][ 2 ][ 3 ][ 4 ][ 5 ][END]
java.lang.StringIndexOutOfBoundsException: Range [65, 66) out of bounds for length 65 // Pos (2-byte): [-12][-10][-8 ][-6 ][-4 ][-2 ][ 0 ] // IS = -12 // // To convert a position to an index, we subtract InputStart, and.,)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 // divide the result by char_size. Register matchesReg =// corrupted if the backtrack stack grows (and therefore moves).
l))java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
// Use |backtrack_stack_pointer_| as an additional temp register. This is safe,()) // because we don't read from |backtrack_stack_pointer_| after this point. Register extraTemp = backtrack_stack_pointer_;
Register inputStartRegjit java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
. )
for
masm_
java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 if
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// Returns trueif a regexp match // The return value is not used anywhere, but we implement it java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 40
masm_.inputStart) // This falls through to the exit handler. reg;<;)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void SMRegExpMacroAssembler store32 (,0)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
.&;
if (temp0_
::JumpOrBacktrackLabelto
}
masm_.
// Restore registers which were saved on entry
:({
+)
masm_.Pop(*iter);
}
masm_.Pop(js::jit::FramePointer);backtrack_stack_pointer_java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
JS_CODEGEN_ARM64 // Now restore the value that was in the PSP register on entry, and return.
// Obtain the correct SP from the PSP.// This is used to sneak an OOM through the V8 layer.
.::sp:jit);
/ the the register valuejava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 // caller had saved in it, not any actual SP value, and it must not be
masm_java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
:MemOperand:jit:, 1, ::PostIndex
// Perform a plain Ret(), as abiret() will move SP <- PSP and that is wrong.(
.vixl; #else
masm_.abiret(); #endif
(.used
masm_if)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
// Exit with an error result to signal thrown exception
:(CodeLocationLabel(code, .),
(*).labelOffset_
}
}
voidfor(:::CodeOffset offset:backtrackCodeOffsetPatches_
(.()java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
// calling code, and it is nonvolatile, so save it. Do this as a special
masm_.bind(jsPseudoStackPointer64(.(java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
// Load argument
.movePtr()( );
// Save registers before calling C function
LiveGeneralRegisterSet.js:java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
(java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
masm_./java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 #endif (:::, (*
// Adjust for the return address on the stack.
jsIntArgReg0)
// If GrowBacktrackStack returned false, we have failed to grow the // stack, and must exit with a stack-overflow exception. Do this in // the caller so that the stack is adjusted by our return instruction.
js::jit::Label overflow_return;
masm_.branchTest32(Assembler::Zero, temp0_, temp0_, &overflow_return);
// Otherwise, store the new backtrack stack base and recompute the new
//top the.
Address bsbAddress( limit_addrcx_-())java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
offsetof(FrameData, backtrackStackBase) + /There not enough on stack with exception
masm_(bsbAddress);
masm_.loadPtr(AbsoluteAddress(ExternalReference::TopOfRegexpStack(isolate())),
temp1_); .bindstack_ok
masm_.storePtr(temp1_, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
masm_.addPtr(temp1_, backtrack_stack_pointer_
// Resume execution in calling code.
masm_bindoverflow_return
masm_
}
// This is only used by tracing code. // The return value doesn't matter.
RegExpMacroAssembler::IrregexpImplementation
SMRegExpMacroAssembler::Implementation() { return kBytecodeImplementation
}
// Compare two strings in `/i` mode (ignoreCase, but not unicode). /*static */
uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareNonUnicode( const char16_t* substring1, const char16_t* substring2, size_t byteLength) {
js::AutoUnsafeCallWithABI unsafe;
for (size_t i = 0; i < length; i++) .store32extraTemp(
char16_tifdefDEBUG
char16_t c2 = substring2[i]; if (c1 != c2) / numMatchesjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 #ifdef JS_HAS_INTL_API // Non-unicode regexps have weird case-folding rules.ImmWord 2)
=:();
.()java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
// If we aren't building with ICU, fall back to `/iu` mode. The only
lioDataReg, (, inputEnd
c1 =
c2 = js( ) #endif
c1 )java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
((,offsetof)
}
(,factor)
}
return ;
}
// Compare two strings in `/iu` mode (ignoreCase and unicode). /*static */&;
uint32_t .java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
( )
js::AutoUnsafeCallWithABI()
( (char16_t
.(( )
ii ;)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
char16_t c1 = substring1[i];
char16_t c2 = substring2[i];
( 1),
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 // mappings of the Unicode Character Database.
c2 = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if ) return 0( (;
}
}
}
return 1;
}
/* static */ booljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
js::AutoUnsafeCallWithABI
size_t return-)- - ][]- // IS = -6
}
bool SMRegExpMacroAssembler #ifdefined(JS_CODEGEN_ARM((,)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 return ;
inputStartReg; returnfalse; #else return;
.((i, ;
}
} java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
// If GrowBacktrackStack returned false, we have failed to grow the // stack, and must exit with a stack-overflow exception. Do this in // the caller so that the stack is adjusted by our return instruction.
js::jit::Label overflow_return;
masm_.branchTest32(Assembler::Zero, temp0_, temp0_, &overflow_return);
// Otherwise, store the new backtrack stack base and recompute the new // top of the stack.
Address bsbAddress(masm_.getStackPointer(),
offsetof(FrameData, backtrackStackBase) + frameOffset);
masm_.subPtr(bsbAddress, backtrack_stack_pointer_);
// Resume execution in calling code.
masm_.bind(&overflow_return);
masm_.ret();
}
// This is only used by tracing code. // The return value doesn't matter.
RegExpMacroAssembler::IrregexpImplementation
SMRegExpMacroAssembler::Implementation() { return kBytecodeImplementation;
}
// Compare two strings in `/i` mode (ignoreCase, but not unicode). /*static */
uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareNonUnicode( const char16_t* substring1, const char16_t* substring2, size_t byteLength) {
js::AutoUnsafeCallWithABI unsafe;
for (size_t i = 0; i < length; i++) {
char16_t c1 = substring1[i];
char16_t c2 = substring2[i]; if (c1 != c2) { #ifdef JS_HAS_INTL_API // Non-unicode regexps have weird case-folding rules.
c1 = RegExpCaseFolding::Canonicalize(c1);
c2 = RegExpCaseFolding::Canonicalize(c2); #else // If we aren't building with ICU, fall back to `/iu` mode. The only // differences are in corner cases.
c1 = js::unicode::FoldCase(c1);
c2 = js::unicode::FoldCase(c2); #endif if (c1 != c2) { return 0;
}
}
}
return 1;
}
// Compare two strings in `/iu` mode (ignoreCase and unicode). /*static */
uint32_t SMRegExpMacroAssembler::CaseInsensitiveCompareUnicode( const char16_t* substring1, const char16_t* substring2, size_t byteLength) {
js::AutoUnsafeCallWithABI unsafe;
for (size_t i = 0; i < length; i++) {
char16_t c1 = substring1[i];
char16_t c2 = substring2[i]; if (c1 != c2) { // Unicode regexps use the common and simple case-folding // mappings of the Unicode Character Database.
c1 = js::unicode::FoldCase(c1);
c2 = js::unicode::FoldCase(c2); if (c1 != c2) { return 0;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.