@@ -628,11 +628,19 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) {
628628
629629 __ Bind (&slow);
630630
631- __ Push (lhs, rhs);
632- // Figure out which native to call and setup the arguments.
633631 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 ();
635642 } else {
643+ __ Push (lhs, rhs);
636644 int ncr; // NaN compare result
637645 if ((cond == lt) || (cond == le)) {
638646 ncr = GREATER;
@@ -1739,35 +1747,35 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
17391747 __ Peek (subject, kSubjectOffset );
17401748 __ JumpIfSmi (subject, &runtime);
17411749
1742- __ Ldr (x10, FieldMemOperand (subject, HeapObject::kMapOffset ));
1743- __ Ldrb (string_type, FieldMemOperand (x10, Map::kInstanceTypeOffset ));
1744-
17451750 __ Ldr (jsstring_length, FieldMemOperand (subject, String::kLengthOffset ));
17461751
17471752 // 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.
17541758 // (E) Carry on.
17551759 // / [...]
17561760
17571761 // 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).
17711779 __ And (string_representation,
17721780 string_type,
17731781 kIsNotStringMask |
@@ -1784,36 +1792,24 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
17841792 // is a String
17851793 STATIC_ASSERT ((kStringTag | kSeqStringTag ) == 0 );
17861794 STATIC_ASSERT (kShortExternalStringTag != 0 );
1787- __ Cbz (string_representation, &seq_string); // Go to (5 ).
1795+ __ Cbz (string_representation, &seq_string); // Go to (4 ).
17881796
1789- // (2) Anything but sequential or cons? If yes , go to (6 ).
1797+ // (2) Sequential or cons? If not , go to (5 ).
17901798 STATIC_ASSERT (kConsStringTag < kExternalStringTag );
17911799 STATIC_ASSERT (kSlicedStringTag > kExternalStringTag );
17921800 STATIC_ASSERT (kIsNotStringMask > kExternalStringTag );
17931801 STATIC_ASSERT (kShortExternalStringTag > kExternalStringTag );
17941802 __ Cmp (string_representation, kExternalStringTag );
1795- __ B (ge, ¬_seq_nor_cons); // Go to (6 ).
1803+ __ B (ge, ¬_seq_nor_cons); // Go to (5 ).
17961804
17971805 // (3) Cons string. Check that it's flat.
17981806 __ Ldr (x10, FieldMemOperand (subject, ConsString::kSecondOffset ));
17991807 __ JumpIfNotRoot (x10, Heap::kempty_stringRootIndex, &runtime);
18001808 // Replace subject with first string.
18011809 __ Ldr (subject, FieldMemOperand (subject, ConsString::kFirstOffset ));
1810+ __ B (&check_underlying);
18021811
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.
18171813 __ Bind (&seq_string);
18181814
18191815 // Check that the third argument is a positive smi less than the subject
@@ -2083,12 +2079,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
20832079 __ TailCallRuntime (Runtime::kRegExpExec );
20842080
20852081 // 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 ).
20872083 __ Bind (¬_seq_nor_cons);
20882084 // Compare flags are still set.
2089- __ B (ne, ¬_long_external); // Go to (8 ).
2085+ __ B (ne, ¬_long_external); // Go to (7 ).
20902086
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.
20922088 __ Bind (&external_string);
20932089 if (masm->emit_debug_code ()) {
20942090 // Assert that we do not have a cons or slice (indirect strings) here.
@@ -2106,21 +2102,21 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
21062102 // Move the pointer so that offset-wise, it looks like a sequential string.
21072103 STATIC_ASSERT (SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize );
21082104 __ Sub (subject, subject, SeqTwoByteString::kHeaderSize - kHeapObjectTag );
2109- __ B (&seq_string); // Go to (5 ).
2105+ __ B (&seq_string); // Go to (4 ).
21102106
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
21122108 // runtime.
21132109 __ Bind (¬_long_external);
21142110 STATIC_ASSERT (kShortExternalStringTag != 0 );
21152111 __ TestAndBranchIfAnySet (string_representation,
21162112 kShortExternalStringMask | kIsNotStringMask ,
21172113 &runtime);
21182114
2119- // (9 ) Sliced string. Replace subject with parent.
2115+ // (8 ) Sliced string. Replace subject with parent.
21202116 __ Ldr (sliced_string_offset,
21212117 UntagSmiFieldMemOperand (subject, SlicedString::kOffsetOffset ));
21222118 __ Ldr (subject, FieldMemOperand (subject, SlicedString::kParentOffset ));
2123- __ B (&check_underlying); // Go to (4 ).
2119+ __ B (&check_underlying); // Go to (1 ).
21242120#endif
21252121}
21262122
0 commit comments