@@ -628,11 +628,19 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
628
628
629
629
__ Bind (&slow);
630
630
631
- __ Push (lhs, rhs);
632
- // Figure out which native to call and setup the arguments.
633
631
if (cond == eq) {
634
- __ TailCallRuntime (strict () ? Runtime::kStrictEquals : Runtime::kEquals );
632
+ {
633
+ FrameScope scope (masm, StackFrame::INTERNAL);
634
+ __ Push (lhs, rhs);
635
+ __ CallRuntime (strict () ? Runtime::kStrictEqual : Runtime::kEqual );
636
+ }
637
+ // Turn true into 0 and false into some non-zero value.
638
+ STATIC_ASSERT (EQUAL == 0 );
639
+ __ LoadRoot (x1, Heap::kTrueValueRootIndex );
640
+ __ Sub (x0, x0, x1);
641
+ __ Ret ();
635
642
} else {
643
+ __ Push (lhs, rhs);
636
644
int ncr; // NaN compare result
637
645
if ((cond == lt) || (cond == le)) {
638
646
ncr = GREATER;
@@ -1739,35 +1747,35 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
1739
1747
__ Peek (subject, kSubjectOffset );
1740
1748
__ JumpIfSmi (subject, &runtime);
1741
1749
1742
- __ Ldr (x10, FieldMemOperand (subject, HeapObject::kMapOffset ));
1743
- __ Ldrb (string_type, FieldMemOperand (x10, Map::kInstanceTypeOffset ));
1744
-
1745
1750
__ Ldr (jsstring_length, FieldMemOperand (subject, String::kLengthOffset ));
1746
1751
1747
1752
// Handle subject string according to its encoding and representation:
1748
- // (1) Sequential string? If yes, go to (5).
1749
- // (2) Anything but sequential or cons? If yes, go to (6).
1750
- // (3) Cons string. If the string is flat, replace subject with first string.
1751
- // Otherwise bailout.
1752
- // (4) Is subject external? If yes, go to (7).
1753
- // (5) Sequential string. Load regexp code according to encoding.
1753
+ // (1) Sequential string? If yes, go to (4).
1754
+ // (2) Sequential or cons? If not, go to (5).
1755
+ // (3) Cons string. If the string is flat, replace subject with first string
1756
+ // and go to (1). Otherwise bail out to runtime.
1757
+ // (4) Sequential string. Load regexp code according to encoding.
1754
1758
// (E) Carry on.
1755
1759
// / [...]
1756
1760
1757
1761
// Deferred code at the end of the stub:
1758
- // (6) Not a long external string? If yes, go to (8).
1759
- // (7) External string. Make it, offset-wise, look like a sequential string.
1760
- // Go to (5).
1761
- // (8) Short external string or not a string? If yes, bail out to runtime.
1762
- // (9) Sliced string. Replace subject with parent. Go to (4).
1763
-
1764
- Label check_underlying; // (4)
1765
- Label seq_string; // (5)
1766
- Label not_seq_nor_cons; // (6)
1767
- Label external_string; // (7)
1768
- Label not_long_external; // (8)
1769
-
1770
- // (1) Sequential string? If yes, go to (5).
1762
+ // (5) Long external string? If not, go to (7).
1763
+ // (6) External string. Make it, offset-wise, look like a sequential string.
1764
+ // Go to (4).
1765
+ // (7) Short external string or not a string? If yes, bail out to runtime.
1766
+ // (8) Sliced string. Replace subject with parent. Go to (1).
1767
+
1768
+ Label check_underlying; // (1)
1769
+ Label seq_string; // (4)
1770
+ Label not_seq_nor_cons; // (5)
1771
+ Label external_string; // (6)
1772
+ Label not_long_external; // (7)
1773
+
1774
+ __ Bind (&check_underlying);
1775
+ __ Ldr (x10, FieldMemOperand (subject, HeapObject::kMapOffset ));
1776
+ __ Ldrb (string_type, FieldMemOperand (x10, Map::kInstanceTypeOffset ));
1777
+
1778
+ // (1) Sequential string? If yes, go to (4).
1771
1779
__ And (string_representation,
1772
1780
string_type,
1773
1781
kIsNotStringMask |
@@ -1784,36 +1792,24 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
1784
1792
// is a String
1785
1793
STATIC_ASSERT ((kStringTag | kSeqStringTag ) == 0 );
1786
1794
STATIC_ASSERT (kShortExternalStringTag != 0 );
1787
- __ Cbz (string_representation, &seq_string); // Go to (5 ).
1795
+ __ Cbz (string_representation, &seq_string); // Go to (4 ).
1788
1796
1789
- // (2) Anything but sequential or cons? If yes , go to (6 ).
1797
+ // (2) Sequential or cons? If not , go to (5 ).
1790
1798
STATIC_ASSERT (kConsStringTag < kExternalStringTag );
1791
1799
STATIC_ASSERT (kSlicedStringTag > kExternalStringTag );
1792
1800
STATIC_ASSERT (kIsNotStringMask > kExternalStringTag );
1793
1801
STATIC_ASSERT (kShortExternalStringTag > kExternalStringTag );
1794
1802
__ Cmp (string_representation, kExternalStringTag );
1795
- __ B (ge, ¬_seq_nor_cons); // Go to (6 ).
1803
+ __ B (ge, ¬_seq_nor_cons); // Go to (5 ).
1796
1804
1797
1805
// (3) Cons string. Check that it's flat.
1798
1806
__ Ldr (x10, FieldMemOperand (subject, ConsString::kSecondOffset ));
1799
1807
__ JumpIfNotRoot (x10, Heap::kempty_stringRootIndex, &runtime);
1800
1808
// Replace subject with first string.
1801
1809
__ Ldr (subject, FieldMemOperand (subject, ConsString::kFirstOffset ));
1810
+ __ B (&check_underlying);
1802
1811
1803
- // (4) Is subject external? If yes, go to (7).
1804
- __ Bind (&check_underlying);
1805
- // Reload the string type.
1806
- __ Ldr (x10, FieldMemOperand (subject, HeapObject::kMapOffset ));
1807
- __ Ldrb (string_type, FieldMemOperand (x10, Map::kInstanceTypeOffset ));
1808
- STATIC_ASSERT (kSeqStringTag == 0 );
1809
- // The underlying external string is never a short external string.
1810
- STATIC_ASSERT (ExternalString::kMaxShortLength < ConsString::kMinLength );
1811
- STATIC_ASSERT (ExternalString::kMaxShortLength < SlicedString::kMinLength );
1812
- __ TestAndBranchIfAnySet (string_type.X (),
1813
- kStringRepresentationMask ,
1814
- &external_string); // Go to (7).
1815
-
1816
- // (5) Sequential string. Load regexp code according to encoding.
1812
+ // (4) Sequential string. Load regexp code according to encoding.
1817
1813
__ Bind (&seq_string);
1818
1814
1819
1815
// Check that the third argument is a positive smi less than the subject
@@ -2083,12 +2079,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
2083
2079
__ TailCallRuntime (Runtime::kRegExpExec );
2084
2080
2085
2081
// Deferred code for string handling.
2086
- // (6) Not a long external string? If yes , go to (8 ).
2082
+ // (5) Long external string? If not , go to (7 ).
2087
2083
__ Bind (¬_seq_nor_cons);
2088
2084
// Compare flags are still set.
2089
- __ B (ne, ¬_long_external); // Go to (8 ).
2085
+ __ B (ne, ¬_long_external); // Go to (7 ).
2090
2086
2091
- // (7 ) External string. Make it, offset-wise, look like a sequential string.
2087
+ // (6 ) External string. Make it, offset-wise, look like a sequential string.
2092
2088
__ Bind (&external_string);
2093
2089
if (masm->emit_debug_code ()) {
2094
2090
// Assert that we do not have a cons or slice (indirect strings) here.
@@ -2106,21 +2102,21 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
2106
2102
// Move the pointer so that offset-wise, it looks like a sequential string.
2107
2103
STATIC_ASSERT (SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize );
2108
2104
__ Sub (subject, subject, SeqTwoByteString::kHeaderSize - kHeapObjectTag );
2109
- __ B (&seq_string); // Go to (5 ).
2105
+ __ B (&seq_string); // Go to (4 ).
2110
2106
2111
- // (8 ) If this is a short external string or not a string, bail out to
2107
+ // (7 ) If this is a short external string or not a string, bail out to
2112
2108
// runtime.
2113
2109
__ Bind (¬_long_external);
2114
2110
STATIC_ASSERT (kShortExternalStringTag != 0 );
2115
2111
__ TestAndBranchIfAnySet (string_representation,
2116
2112
kShortExternalStringMask | kIsNotStringMask ,
2117
2113
&runtime);
2118
2114
2119
- // (9 ) Sliced string. Replace subject with parent.
2115
+ // (8 ) Sliced string. Replace subject with parent.
2120
2116
__ Ldr (sliced_string_offset,
2121
2117
UntagSmiFieldMemOperand (subject, SlicedString::kOffsetOffset ));
2122
2118
__ Ldr (subject, FieldMemOperand (subject, SlicedString::kParentOffset ));
2123
- __ B (&check_underlying); // Go to (4 ).
2119
+ __ B (&check_underlying); // Go to (1 ).
2124
2120
#endif
2125
2121
}
2126
2122
0 commit comments