@@ -1743,35 +1743,35 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
17431743 __ Peek (subject, kSubjectOffset );
17441744 __ JumpIfSmi (subject, &runtime);
17451745
1746- __ Ldr (x10, FieldMemOperand (subject, HeapObject::kMapOffset ));
1747- __ Ldrb (string_type, FieldMemOperand (x10, Map::kInstanceTypeOffset ));
1748-
17491746 __ Ldr (jsstring_length, FieldMemOperand (subject, String::kLengthOffset ));
17501747
17511748 // Handle subject string according to its encoding and representation:
1752- // (1) Sequential string? If yes, go to (5).
1753- // (2) Anything but sequential or cons? If yes, go to (6).
1754- // (3) Cons string. If the string is flat, replace subject with first string.
1755- // Otherwise bailout.
1756- // (4) Is subject external? If yes, go to (7).
1757- // (5) Sequential string. Load regexp code according to encoding.
1749+ // (1) Sequential string? If yes, go to (4).
1750+ // (2) Sequential or cons? If not, go to (5).
1751+ // (3) Cons string. If the string is flat, replace subject with first string
1752+ // and go to (1). Otherwise bail out to runtime.
1753+ // (4) Sequential string. Load regexp code according to encoding.
17581754 // (E) Carry on.
17591755 // / [...]
17601756
17611757 // Deferred code at the end of the stub:
1762- // (6) Not a long external string? If yes, go to (8).
1763- // (7) External string. Make it, offset-wise, look like a sequential string.
1764- // Go to (5).
1765- // (8) Short external string or not a string? If yes, bail out to runtime.
1766- // (9) Sliced string. Replace subject with parent. Go to (4).
1767-
1768- Label check_underlying; // (4)
1769- Label seq_string; // (5)
1770- Label not_seq_nor_cons; // (6)
1771- Label external_string; // (7)
1772- Label not_long_external; // (8)
1773-
1774- // (1) Sequential string? If yes, go to (5).
1758+ // (5) Long external string? If not, go to (7).
1759+ // (6) External string. Make it, offset-wise, look like a sequential string.
1760+ // Go to (4).
1761+ // (7) Short external string or not a string? If yes, bail out to runtime.
1762+ // (8) Sliced string. Replace subject with parent. Go to (1).
1763+
1764+ Label check_underlying; // (1)
1765+ Label seq_string; // (4)
1766+ Label not_seq_nor_cons; // (5)
1767+ Label external_string; // (6)
1768+ Label not_long_external; // (7)
1769+
1770+ __ Bind (&check_underlying);
1771+ __ Ldr (x10, FieldMemOperand (subject, HeapObject::kMapOffset ));
1772+ __ Ldrb (string_type, FieldMemOperand (x10, Map::kInstanceTypeOffset ));
1773+
1774+ // (1) Sequential string? If yes, go to (4).
17751775 __ And (string_representation,
17761776 string_type,
17771777 kIsNotStringMask |
@@ -1788,36 +1788,24 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
17881788 // is a String
17891789 STATIC_ASSERT ((kStringTag | kSeqStringTag ) == 0 );
17901790 STATIC_ASSERT (kShortExternalStringTag != 0 );
1791- __ Cbz (string_representation, &seq_string); // Go to (5 ).
1791+ __ Cbz (string_representation, &seq_string); // Go to (4 ).
17921792
1793- // (2) Anything but sequential or cons? If yes , go to (6 ).
1793+ // (2) Sequential or cons? If not , go to (5 ).
17941794 STATIC_ASSERT (kConsStringTag < kExternalStringTag );
17951795 STATIC_ASSERT (kSlicedStringTag > kExternalStringTag );
17961796 STATIC_ASSERT (kIsNotStringMask > kExternalStringTag );
17971797 STATIC_ASSERT (kShortExternalStringTag > kExternalStringTag );
17981798 __ Cmp (string_representation, kExternalStringTag );
1799- __ B (ge, ¬_seq_nor_cons); // Go to (6 ).
1799+ __ B (ge, ¬_seq_nor_cons); // Go to (5 ).
18001800
18011801 // (3) Cons string. Check that it's flat.
18021802 __ Ldr (x10, FieldMemOperand (subject, ConsString::kSecondOffset ));
18031803 __ JumpIfNotRoot (x10, Heap::kempty_stringRootIndex, &runtime);
18041804 // Replace subject with first string.
18051805 __ Ldr (subject, FieldMemOperand (subject, ConsString::kFirstOffset ));
1806+ __ B (&check_underlying);
18061807
1807- // (4) Is subject external? If yes, go to (7).
1808- __ Bind (&check_underlying);
1809- // Reload the string type.
1810- __ Ldr (x10, FieldMemOperand (subject, HeapObject::kMapOffset ));
1811- __ Ldrb (string_type, FieldMemOperand (x10, Map::kInstanceTypeOffset ));
1812- STATIC_ASSERT (kSeqStringTag == 0 );
1813- // The underlying external string is never a short external string.
1814- STATIC_ASSERT (ExternalString::kMaxShortLength < ConsString::kMinLength );
1815- STATIC_ASSERT (ExternalString::kMaxShortLength < SlicedString::kMinLength );
1816- __ TestAndBranchIfAnySet (string_type.X (),
1817- kStringRepresentationMask ,
1818- &external_string); // Go to (7).
1819-
1820- // (5) Sequential string. Load regexp code according to encoding.
1808+ // (4) Sequential string. Load regexp code according to encoding.
18211809 __ Bind (&seq_string);
18221810
18231811 // Check that the third argument is a positive smi less than the subject
@@ -2087,12 +2075,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
20872075 __ TailCallRuntime (Runtime::kRegExpExec );
20882076
20892077 // Deferred code for string handling.
2090- // (6) Not a long external string? If yes , go to (8 ).
2078+ // (5) Long external string? If not , go to (7 ).
20912079 __ Bind (¬_seq_nor_cons);
20922080 // Compare flags are still set.
2093- __ B (ne, ¬_long_external); // Go to (8 ).
2081+ __ B (ne, ¬_long_external); // Go to (7 ).
20942082
2095- // (7 ) External string. Make it, offset-wise, look like a sequential string.
2083+ // (6 ) External string. Make it, offset-wise, look like a sequential string.
20962084 __ Bind (&external_string);
20972085 if (masm->emit_debug_code ()) {
20982086 // Assert that we do not have a cons or slice (indirect strings) here.
@@ -2110,21 +2098,21 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
21102098 // Move the pointer so that offset-wise, it looks like a sequential string.
21112099 STATIC_ASSERT (SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize );
21122100 __ Sub (subject, subject, SeqTwoByteString::kHeaderSize - kHeapObjectTag );
2113- __ B (&seq_string); // Go to (5 ).
2101+ __ B (&seq_string); // Go to (4 ).
21142102
2115- // (8 ) If this is a short external string or not a string, bail out to
2103+ // (7 ) If this is a short external string or not a string, bail out to
21162104 // runtime.
21172105 __ Bind (¬_long_external);
21182106 STATIC_ASSERT (kShortExternalStringTag != 0 );
21192107 __ TestAndBranchIfAnySet (string_representation,
21202108 kShortExternalStringMask | kIsNotStringMask ,
21212109 &runtime);
21222110
2123- // (9 ) Sliced string. Replace subject with parent.
2111+ // (8 ) Sliced string. Replace subject with parent.
21242112 __ Ldr (sliced_string_offset,
21252113 UntagSmiFieldMemOperand (subject, SlicedString::kOffsetOffset ));
21262114 __ Ldr (subject, FieldMemOperand (subject, SlicedString::kParentOffset ));
2127- __ B (&check_underlying); // Go to (4 ).
2115+ __ B (&check_underlying); // Go to (1 ).
21282116#endif
21292117}
21302118
0 commit comments