@@ -1685,48 +1685,53 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
16851685 __ mov (a3, subject); // Make a copy of the original subject string.
16861686 __ ld (a0, FieldMemOperand (subject, HeapObject::kMapOffset ));
16871687 __ lbu (a0, FieldMemOperand (a0, Map::kInstanceTypeOffset ));
1688+
16881689 // subject: subject string
1689- // a3: subject string
16901690 // a0: subject string instance type
1691+ // a3: subject string
16911692 // regexp_data: RegExp data (FixedArray)
16921693 // Handle subject string according to its encoding and representation:
1693- // (1) Sequential string? If yes, go to (5).
1694- // (2) Anything but sequential or cons? If yes, go to (6).
1695- // (3) Cons string. If the string is flat, replace subject with first string.
1696- // Otherwise bailout.
1697- // (4) Is subject external? If yes, go to (7).
1698- // (5) Sequential string. Load regexp code according to encoding.
1694+ // (1) Sequential string? If yes, go to (4).
1695+ // (2) Sequential or cons? If not, go to (5).
1696+ // (3) Cons string. If the string is flat, replace subject with first string
1697+ // and go to (1). Otherwise bail out to runtime.
1698+ // (4) Sequential string. Load regexp code according to encoding.
16991699 // (E) Carry on.
17001700 // / [...]
17011701
17021702 // Deferred code at the end of the stub:
1703- // (6) Not a long external string? If yes, go to (8).
1704- // (7) External string. Make it, offset-wise, look like a sequential string.
1705- // Go to (5).
1706- // (8) Short external string or not a string? If yes, bail out to runtime.
1707- // (9) Sliced string. Replace subject with parent. Go to (4).
1708-
1709- Label check_underlying; // (4)
1710- Label seq_string; // (5)
1711- Label not_seq_nor_cons; // (6)
1712- Label external_string; // (7)
1713- Label not_long_external; // (8)
1714-
1715- // (1) Sequential string? If yes, go to (5).
1703+ // (5) Long external string? If not, go to (7).
1704+ // (6) External string. Make it, offset-wise, look like a sequential string.
1705+ // Go to (4).
1706+ // (7) Short external string or not a string? If yes, bail out to runtime.
1707+ // (8) Sliced string. Replace subject with parent. Go to (1).
1708+
1709+ Label check_underlying; // (1)
1710+ Label seq_string; // (4)
1711+ Label not_seq_nor_cons; // (5)
1712+ Label external_string; // (6)
1713+ Label not_long_external; // (7)
1714+
1715+ __ bind (&check_underlying);
1716+ __ ld (a2, FieldMemOperand (subject, HeapObject::kMapOffset ));
1717+ __ Daddu (a0, a2, Map::kInstanceTypeOffset );
1718+ __ lbu (a0, MemOperand (a0));
1719+
1720+ // (1) Sequential string? If yes, go to (4).
17161721 __ And (a1,
17171722 a0,
17181723 Operand (kIsNotStringMask |
17191724 kStringRepresentationMask |
17201725 kShortExternalStringMask ));
17211726 STATIC_ASSERT ((kStringTag | kSeqStringTag ) == 0 );
1722- __ Branch (&seq_string, eq, a1, Operand (zero_reg)); // Go to (5 ).
1727+ __ Branch (&seq_string, eq, a1, Operand (zero_reg)); // Go to (4 ).
17231728
1724- // (2) Anything but sequential or cons? If yes , go to (6 ).
1729+ // (2) Sequential or cons? If not , go to (5 ).
17251730 STATIC_ASSERT (kConsStringTag < kExternalStringTag );
17261731 STATIC_ASSERT (kSlicedStringTag > kExternalStringTag );
17271732 STATIC_ASSERT (kIsNotStringMask > kExternalStringTag );
17281733 STATIC_ASSERT (kShortExternalStringTag > kExternalStringTag );
1729- // Go to (6 ).
1734+ // Go to (5 ).
17301735 __ Branch (¬_seq_nor_cons, ge, a1, Operand (kExternalStringTag ));
17311736
17321737 // (3) Cons string. Check that it's flat.
@@ -1735,16 +1740,9 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
17351740 __ LoadRoot (a1, Heap::kempty_stringRootIndex);
17361741 __ Branch (&runtime, ne, a0, Operand (a1));
17371742 __ ld (subject, FieldMemOperand (subject, ConsString::kFirstOffset ));
1743+ __ jmp (&check_underlying);
17381744
1739- // (4) Is subject external? If yes, go to (7).
1740- __ bind (&check_underlying);
1741- __ ld (a0, FieldMemOperand (subject, HeapObject::kMapOffset ));
1742- __ lbu (a0, FieldMemOperand (a0, Map::kInstanceTypeOffset ));
1743- STATIC_ASSERT (kSeqStringTag == 0 );
1744- __ And (at, a0, Operand (kStringRepresentationMask ));
1745- __ Branch (&external_string, ne, at, Operand (zero_reg)); // Go to (7).
1746-
1747- // (5) Sequential string. Load regexp code according to encoding.
1745+ // (4) Sequential string. Load regexp code according to encoding.
17481746 __ bind (&seq_string);
17491747 // subject: sequential subject string (or look-alike, external string)
17501748 // a3: original subject string
@@ -1987,12 +1985,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
19871985 __ TailCallRuntime (Runtime::kRegExpExec );
19881986
19891987 // Deferred code for string handling.
1990- // (6) Not a long external string? If yes , go to (8 ).
1988+ // (5) Long external string? If not , go to (7 ).
19911989 __ bind (¬_seq_nor_cons);
1992- // Go to (8 ).
1990+ // Go to (7 ).
19931991 __ Branch (¬_long_external, gt, a1, Operand (kExternalStringTag ));
19941992
1995- // (7 ) External string. Make it, offset-wise, look like a sequential string.
1993+ // (6 ) External string. Make it, offset-wise, look like a sequential string.
19961994 __ bind (&external_string);
19971995 __ ld (a0, FieldMemOperand (subject, HeapObject::kMapOffset ));
19981996 __ lbu (a0, FieldMemOperand (a0, Map::kInstanceTypeOffset ));
@@ -2012,20 +2010,20 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
20122010 __ Dsubu (subject,
20132011 subject,
20142012 SeqTwoByteString::kHeaderSize - kHeapObjectTag );
2015- __ jmp (&seq_string); // Go to (5 ).
2013+ __ jmp (&seq_string); // Go to (4 ).
20162014
2017- // (8 ) Short external string or not a string? If yes, bail out to runtime.
2015+ // (7 ) Short external string or not a string? If yes, bail out to runtime.
20182016 __ bind (¬_long_external);
20192017 STATIC_ASSERT (kNotStringTag != 0 && kShortExternalStringTag !=0 );
20202018 __ And (at, a1, Operand (kIsNotStringMask | kShortExternalStringMask ));
20212019 __ Branch (&runtime, ne, at, Operand (zero_reg));
20222020
2023- // (9 ) Sliced string. Replace subject with parent. Go to (4).
2021+ // (8 ) Sliced string. Replace subject with parent. Go to (4).
20242022 // Load offset into t0 and replace subject string with parent.
20252023 __ ld (t0, FieldMemOperand (subject, SlicedString::kOffsetOffset ));
20262024 __ SmiUntag (t0);
20272025 __ ld (subject, FieldMemOperand (subject, SlicedString::kParentOffset ));
2028- __ jmp (&check_underlying); // Go to (4 ).
2026+ __ jmp (&check_underlying); // Go to (1 ).
20292027#endif // V8_INTERPRETED_REGEXP
20302028}
20312029
0 commit comments