@@ -477,87 +477,72 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
477477 __ mov (eax, Operand (esp, kSubjectOffset ));
478478 __ JumpIfSmi (eax, &runtime);
479479 __ mov (edx, eax); // Make a copy of the original subject string.
480- __ mov (ebx, FieldOperand (eax, HeapObject::kMapOffset ));
481- __ movzx_b (ebx, FieldOperand (ebx, Map::kInstanceTypeOffset ));
482480
483481 // eax: subject string
484482 // edx: subject string
485- // ebx: subject string instance type
486483 // ecx: RegExp data (FixedArray)
487484 // Handle subject string according to its encoding and representation:
488485 // (1) Sequential two byte? If yes, go to (9).
489- // (2) Sequential one byte? If yes, go to (6).
490- // (3) Anything but sequential or cons? If yes, go to (7).
491- // (4) Cons string. If the string is flat, replace subject with first string.
492- // Otherwise bailout.
493- // (5a) Is subject sequential two byte? If yes, go to (9).
494- // (5b) Is subject external? If yes, go to (8).
495- // (6) One byte sequential. Load regexp code for one byte.
486+ // (2) Sequential one byte? If yes, go to (5).
487+ // (3) Sequential or cons? If not, go to (6).
488+ // (4) Cons string. If the string is flat, replace subject with first string
489+ // and go to (1). Otherwise bail out to runtime.
490+ // (5) One byte sequential. Load regexp code for one byte.
496491 // (E) Carry on.
497492 // / [...]
498493
499494 // Deferred code at the end of the stub:
500- // (7) Not a long external string? If yes , go to (10).
501- // (8 ) External string. Make it, offset-wise, look like a sequential string.
502- // (8a ) Is the external string one byte? If yes, go to (6 ).
503- // (9) Two byte sequential. Load regexp code for one byte. Go to (E).
495+ // (6) Long external string? If not , go to (10).
496+ // (7 ) External string. Make it, offset-wise, look like a sequential string.
497+ // (8 ) Is the external string one byte? If yes, go to (5 ).
498+ // (9) Two byte sequential. Load regexp code for two byte. Go to (E).
504499 // (10) Short external string or not a string? If yes, bail out to runtime.
505- // (11) Sliced string. Replace subject with parent. Go to (5a ).
500+ // (11) Sliced string. Replace subject with parent. Go to (1 ).
506501
507- Label seq_one_byte_string /* 6 */ , seq_two_byte_string /* 9 */ ,
508- external_string /* 8 */ , check_underlying /* 5a */ ,
509- not_seq_nor_cons /* 7 */ , check_code /* E */ ,
510- not_long_external /* 10 */ ;
502+ Label seq_one_byte_string /* 5 */ , seq_two_byte_string /* 9 */ ,
503+ external_string /* 7 */ , check_underlying /* 1 */ ,
504+ not_seq_nor_cons /* 6 */ , check_code /* E */ , not_long_external /* 10 */ ;
511505
506+ __ bind (&check_underlying);
512507 // (1) Sequential two byte? If yes, go to (9).
508+ __ mov (ebx, FieldOperand (eax, HeapObject::kMapOffset ));
509+ __ movzx_b (ebx, FieldOperand (ebx, Map::kInstanceTypeOffset ));
510+
513511 __ and_ (ebx, kIsNotStringMask |
514512 kStringRepresentationMask |
515513 kStringEncodingMask |
516514 kShortExternalStringMask );
517515 STATIC_ASSERT ((kStringTag | kSeqStringTag | kTwoByteStringTag ) == 0 );
518516 __ j (zero, &seq_two_byte_string); // Go to (9).
519517
520- // (2) Sequential one byte? If yes, go to (6 ).
518+ // (2) Sequential one byte? If yes, go to (5 ).
521519 // Any other sequential string must be one byte.
522520 __ and_ (ebx, Immediate (kIsNotStringMask |
523521 kStringRepresentationMask |
524522 kShortExternalStringMask ));
525- __ j (zero, &seq_one_byte_string, Label::kNear ); // Go to (6 ).
523+ __ j (zero, &seq_one_byte_string, Label::kNear ); // Go to (5 ).
526524
527- // (3) Anything but sequential or cons? If yes , go to (7 ).
525+ // (3) Sequential or cons? If not , go to (6 ).
528526 // We check whether the subject string is a cons, since sequential strings
529527 // have already been covered.
530528 STATIC_ASSERT (kConsStringTag < kExternalStringTag );
531529 STATIC_ASSERT (kSlicedStringTag > kExternalStringTag );
532530 STATIC_ASSERT (kIsNotStringMask > kExternalStringTag );
533531 STATIC_ASSERT (kShortExternalStringTag > kExternalStringTag );
534532 __ cmp (ebx, Immediate (kExternalStringTag ));
535- __ j (greater_equal, ¬_seq_nor_cons); // Go to (7 ).
533+ __ j (greater_equal, ¬_seq_nor_cons); // Go to (6 ).
536534
537535 // (4) Cons string. Check that it's flat.
538536 // Replace subject with first string and reload instance type.
539537 __ cmp (FieldOperand (eax, ConsString::kSecondOffset ), factory->empty_string ());
540538 __ j (not_equal, &runtime);
541539 __ mov (eax, FieldOperand (eax, ConsString::kFirstOffset ));
542- __ bind (&check_underlying);
543- __ mov (ebx, FieldOperand (eax, HeapObject::kMapOffset ));
544- __ mov (ebx, FieldOperand (ebx, Map::kInstanceTypeOffset ));
545-
546- // (5a) Is subject sequential two byte? If yes, go to (9).
547- __ test_b (ebx, Immediate (kStringRepresentationMask | kStringEncodingMask ));
548- STATIC_ASSERT ((kSeqStringTag | kTwoByteStringTag ) == 0 );
549- __ j (zero, &seq_two_byte_string); // Go to (9).
550- // (5b) Is subject external? If yes, go to (8).
551- __ test_b (ebx, Immediate (kStringRepresentationMask ));
552- // The underlying external string is never a short external string.
553- STATIC_ASSERT (ExternalString::kMaxShortLength < ConsString::kMinLength );
554- STATIC_ASSERT (ExternalString::kMaxShortLength < SlicedString::kMinLength );
555- __ j (not_zero, &external_string); // Go to (8).
540+ __ jmp (&check_underlying);
556541
557542 // eax: sequential subject string (or look-alike, external string)
558543 // edx: original subject string
559544 // ecx: RegExp data (FixedArray)
560- // (6 ) One byte sequential. Load regexp code for one byte.
545+ // (5 ) One byte sequential. Load regexp code for one byte.
561546 __ bind (&seq_one_byte_string);
562547 // Load previous index and check range before edx is overwritten. We have
563548 // to use edx instead of eax here because it might have been only made to
@@ -778,12 +763,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
778763 __ TailCallRuntime (Runtime::kRegExpExec );
779764
780765 // Deferred code for string handling.
781- // (7) Not a long external string? If yes , go to (10).
766+ // (6) Long external string? If not , go to (10).
782767 __ bind (¬_seq_nor_cons);
783768 // Compare flags are still set from (3).
784769 __ j (greater, ¬_long_external, Label::kNear ); // Go to (10).
785770
786- // (8 ) External string. Short external strings have been ruled out.
771+ // (7 ) External string. Short external strings have been ruled out.
787772 __ bind (&external_string);
788773 // Reload instance type.
789774 __ mov (ebx, FieldOperand (eax, HeapObject::kMapOffset ));
@@ -799,14 +784,14 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
799784 STATIC_ASSERT (SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize );
800785 __ sub (eax, Immediate (SeqTwoByteString::kHeaderSize - kHeapObjectTag ));
801786 STATIC_ASSERT (kTwoByteStringTag == 0 );
802- // (8a ) Is the external string one byte? If yes, go to (6 ).
787+ // (8 ) Is the external string one byte? If yes, go to (5 ).
803788 __ test_b (ebx, Immediate (kStringEncodingMask ));
804- __ j (not_zero, &seq_one_byte_string); // Goto (6 ).
789+ __ j (not_zero, &seq_one_byte_string); // Go to (5 ).
805790
806791 // eax: sequential subject string (or look-alike, external string)
807792 // edx: original subject string
808793 // ecx: RegExp data (FixedArray)
809- // (9) Two byte sequential. Load regexp code for one byte. Go to (E).
794+ // (9) Two byte sequential. Load regexp code for two byte. Go to (E).
810795 __ bind (&seq_two_byte_string);
811796 // Load previous index and check range before edx is overwritten. We have
812797 // to use edx instead of eax here because it might have been only made to
@@ -826,11 +811,11 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
826811 __ test (ebx, Immediate (kIsNotStringMask | kShortExternalStringTag ));
827812 __ j (not_zero, &runtime);
828813
829- // (11) Sliced string. Replace subject with parent. Go to (5a ).
814+ // (11) Sliced string. Replace subject with parent. Go to (1 ).
830815 // Load offset into edi and replace subject string with parent.
831816 __ mov (edi, FieldOperand (eax, SlicedString::kOffsetOffset ));
832817 __ mov (eax, FieldOperand (eax, SlicedString::kParentOffset ));
833- __ jmp (&check_underlying); // Go to (5a ).
818+ __ jmp (&check_underlying); // Go to (1 ).
834819#endif // V8_INTERPRETED_REGEXP
835820}
836821
0 commit comments