| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index 3dd2f45cbcc15c7fe858bbe870a582a98fa49c30..f314b9cfcb6ecea4438a8b7cc0f7e68539401c8a 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -667,35 +667,34 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| __ movp(rdi, args.GetArgumentOperand(SUBJECT_STRING_ARGUMENT_INDEX));
|
| __ JumpIfSmi(rdi, &runtime);
|
| __ movp(r15, rdi); // Make a copy of the original subject string.
|
| - __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset));
|
| - __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset));
|
| // rax: RegExp data (FixedArray)
|
| // rdi: subject string
|
| // r15: subject string
|
| // Handle subject string according to its encoding and representation:
|
| // (1) Sequential two byte? If yes, go to (9).
|
| - // (2) Sequential one byte? If yes, go to (6).
|
| - // (3) Anything but sequential or cons? If yes, go to (7).
|
| - // (4) Cons string. If the string is flat, replace subject with first string.
|
| - // Otherwise bailout.
|
| - // (5a) Is subject sequential two byte? If yes, go to (9).
|
| - // (5b) Is subject external? If yes, go to (8).
|
| - // (6) One byte sequential. Load regexp code for one byte.
|
| + // (2) Sequential one byte? If yes, go to (5).
|
| + // (3) Sequential or cons? If not, go to (6).
|
| + // (4) Cons string. If the string is flat, replace subject with first string
|
| + // and go to (1). Otherwise bail out to runtime.
|
| + // (5) One byte sequential. Load regexp code for one byte.
|
| // (E) Carry on.
|
| /// [...]
|
|
|
| // Deferred code at the end of the stub:
|
| - // (7) Not a long external string? If yes, go to (10).
|
| - // (8) External string. Make it, offset-wise, look like a sequential string.
|
| - // (8a) Is the external string one byte? If yes, go to (6).
|
| - // (9) Two byte sequential. Load regexp code for one byte. Go to (E).
|
| + // (6) Long external string? If not, go to (10).
|
| + // (7) External string. Make it, offset-wise, look like a sequential string.
|
| + // (8) Is the external string one byte? If yes, go to (5).
|
| + // (9) Two byte sequential. Load regexp code for two byte. Go to (E).
|
| // (10) Short external string or not a string? If yes, bail out to runtime.
|
| - // (11) Sliced string. Replace subject with parent. Go to (5a).
|
| + // (11) Sliced string. Replace subject with parent. Go to (1).
|
| +
|
| + Label seq_one_byte_string /* 5 */, seq_two_byte_string /* 9 */,
|
| + external_string /* 7 */, check_underlying /* 1 */,
|
| + not_seq_nor_cons /* 6 */, check_code /* E */, not_long_external /* 10 */;
|
|
|
| - Label seq_one_byte_string /* 6 */, seq_two_byte_string /* 9 */,
|
| - external_string /* 8 */, check_underlying /* 5a */,
|
| - not_seq_nor_cons /* 7 */, check_code /* E */,
|
| - not_long_external /* 10 */;
|
| + __ bind(&check_underlying);
|
| + __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset));
|
| + __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset));
|
|
|
| // (1) Sequential two byte? If yes, go to (9).
|
| __ andb(rbx, Immediate(kIsNotStringMask |
|
| @@ -705,14 +704,14 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0);
|
| __ j(zero, &seq_two_byte_string); // Go to (9).
|
|
|
| - // (2) Sequential one byte? If yes, go to (6).
|
| + // (2) Sequential one byte? If yes, go to (5).
|
| // Any other sequential string must be one byte.
|
| __ andb(rbx, Immediate(kIsNotStringMask |
|
| kStringRepresentationMask |
|
| kShortExternalStringMask));
|
| - __ j(zero, &seq_one_byte_string, Label::kNear); // Go to (6).
|
| + __ j(zero, &seq_one_byte_string, Label::kNear); // Go to (5).
|
|
|
| - // (3) Anything but sequential or cons? If yes, go to (7).
|
| + // (3) Sequential or cons? If not, go to (6).
|
| // We check whether the subject string is a cons, since sequential strings
|
| // have already been covered.
|
| STATIC_ASSERT(kConsStringTag < kExternalStringTag);
|
| @@ -720,7 +719,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
|
| STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
|
| __ cmpp(rbx, Immediate(kExternalStringTag));
|
| - __ j(greater_equal, ¬_seq_nor_cons); // Go to (7).
|
| + __ j(greater_equal, ¬_seq_nor_cons); // Go to (6).
|
|
|
| // (4) Cons string. Check that it's flat.
|
| // Replace subject with first string and reload instance type.
|
| @@ -728,22 +727,9 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| Heap::kempty_stringRootIndex);
|
| __ j(not_equal, &runtime);
|
| __ movp(rdi, FieldOperand(rdi, ConsString::kFirstOffset));
|
| - __ bind(&check_underlying);
|
| - __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset));
|
| - __ movp(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset));
|
| + __ jmp(&check_underlying);
|
|
|
| - // (5a) Is subject sequential two byte? If yes, go to (9).
|
| - __ testb(rbx, Immediate(kStringRepresentationMask | kStringEncodingMask));
|
| - STATIC_ASSERT((kSeqStringTag | kTwoByteStringTag) == 0);
|
| - __ j(zero, &seq_two_byte_string); // Go to (9).
|
| - // (5b) Is subject external? If yes, go to (8).
|
| - __ testb(rbx, Immediate(kStringRepresentationMask));
|
| - // The underlying external string is never a short external string.
|
| - STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength);
|
| - STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength);
|
| - __ j(not_zero, &external_string); // Go to (8)
|
| -
|
| - // (6) One byte sequential. Load regexp code for one byte.
|
| + // (5) One byte sequential. Load regexp code for one byte.
|
| __ bind(&seq_one_byte_string);
|
| // rax: RegExp data (FixedArray)
|
| __ movp(r11, FieldOperand(rax, JSRegExp::kDataOneByteCodeOffset));
|
| @@ -990,12 +976,12 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| __ TailCallRuntime(Runtime::kRegExpExec);
|
|
|
| // Deferred code for string handling.
|
| - // (7) Not a long external string? If yes, go to (10).
|
| + // (6) Long external string? If not, go to (10).
|
| __ bind(¬_seq_nor_cons);
|
| // Compare flags are still set from (3).
|
| __ j(greater, ¬_long_external, Label::kNear); // Go to (10).
|
|
|
| - // (8) External string. Short external strings have been ruled out.
|
| + // (7) External string. Short external strings have been ruled out.
|
| __ bind(&external_string);
|
| __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset));
|
| __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset));
|
| @@ -1010,13 +996,13 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize);
|
| __ subp(rdi, Immediate(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
|
| STATIC_ASSERT(kTwoByteStringTag == 0);
|
| - // (8a) Is the external string one byte? If yes, go to (6).
|
| + // (8) Is the external string one byte? If yes, go to (5).
|
| __ testb(rbx, Immediate(kStringEncodingMask));
|
| - __ j(not_zero, &seq_one_byte_string); // Goto (6).
|
| + __ j(not_zero, &seq_one_byte_string); // Go to (5).
|
|
|
| // rdi: subject string (flat two-byte)
|
| // rax: RegExp data (FixedArray)
|
| - // (9) Two byte sequential. Load regexp code for one byte. Go to (E).
|
| + // (9) Two byte sequential. Load regexp code for two byte. Go to (E).
|
| __ bind(&seq_two_byte_string);
|
| __ movp(r11, FieldOperand(rax, JSRegExp::kDataUC16CodeOffset));
|
| __ Set(rcx, 0); // Type is two byte.
|
| @@ -1029,7 +1015,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
|
| __ testb(rbx, Immediate(kIsNotStringMask | kShortExternalStringMask));
|
| __ j(not_zero, &runtime);
|
|
|
| - // (11) Sliced string. Replace subject with parent. Go to (5a).
|
| + // (11) Sliced string. Replace subject with parent. Go to (1).
|
| // Load offset into r14 and replace subject string with parent.
|
| __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset));
|
| __ movp(rdi, FieldOperand(rdi, SlicedString::kParentOffset));
|
|
|