OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 // (5) One byte sequential. Load regexp code for one byte. | 477 // (5) One byte sequential. Load regexp code for one byte. |
478 // (E) Carry on. | 478 // (E) Carry on. |
479 /// [...] | 479 /// [...] |
480 | 480 |
481 // Deferred code at the end of the stub: | 481 // Deferred code at the end of the stub: |
482 // (6) Long external string? If not, go to (10). | 482 // (6) Long external string? If not, go to (10). |
483 // (7) External string. Make it, offset-wise, look like a sequential string. | 483 // (7) External string. Make it, offset-wise, look like a sequential string. |
484 // (8) Is the external string one byte? If yes, go to (5). | 484 // (8) Is the external string one byte? If yes, go to (5). |
485 // (9) Two byte sequential. Load regexp code for two byte. Go to (E). | 485 // (9) Two byte sequential. Load regexp code for two byte. Go to (E). |
486 // (10) Short external string or not a string? If yes, bail out to runtime. | 486 // (10) Short external string or not a string? If yes, bail out to runtime. |
487 // (11) Sliced string. Replace subject with parent. Go to (1). | 487 // (11) Sliced or thin string. Replace subject with parent. Go to (1). |
488 | 488 |
489 Label seq_one_byte_string /* 5 */, seq_two_byte_string /* 9 */, | 489 Label seq_one_byte_string /* 5 */, seq_two_byte_string /* 9 */, |
490 external_string /* 7 */, check_underlying /* 1 */, | 490 external_string /* 7 */, check_underlying /* 1 */, |
491 not_seq_nor_cons /* 6 */, check_code /* E */, not_long_external /* 10 */; | 491 not_seq_nor_cons /* 6 */, check_code /* E */, not_long_external /* 10 */; |
492 | 492 |
493 __ bind(&check_underlying); | 493 __ bind(&check_underlying); |
494 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); | 494 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); |
495 __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset)); | 495 __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset)); |
496 | 496 |
497 // (1) Sequential two byte? If yes, go to (9). | 497 // (1) Sequential two byte? If yes, go to (9). |
498 __ andb(rbx, Immediate(kIsNotStringMask | | 498 __ andb(rbx, Immediate(kIsNotStringMask | |
499 kStringRepresentationMask | | 499 kStringRepresentationMask | |
500 kStringEncodingMask | | 500 kStringEncodingMask | |
501 kShortExternalStringMask)); | 501 kShortExternalStringMask)); |
502 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0); | 502 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0); |
503 __ j(zero, &seq_two_byte_string); // Go to (9). | 503 __ j(zero, &seq_two_byte_string); // Go to (9). |
504 | 504 |
505 // (2) Sequential one byte? If yes, go to (5). | 505 // (2) Sequential one byte? If yes, go to (5). |
506 // Any other sequential string must be one byte. | 506 // Any other sequential string must be one byte. |
507 __ andb(rbx, Immediate(kIsNotStringMask | | 507 __ andb(rbx, Immediate(kIsNotStringMask | |
508 kStringRepresentationMask | | 508 kStringRepresentationMask | |
509 kShortExternalStringMask)); | 509 kShortExternalStringMask)); |
510 __ j(zero, &seq_one_byte_string, Label::kNear); // Go to (5). | 510 __ j(zero, &seq_one_byte_string, Label::kNear); // Go to (5). |
511 | 511 |
512 // (3) Sequential or cons? If not, go to (6). | 512 // (3) Sequential or cons? If not, go to (6). |
513 // We check whether the subject string is a cons, since sequential strings | 513 // We check whether the subject string is a cons, since sequential strings |
514 // have already been covered. | 514 // have already been covered. |
515 STATIC_ASSERT(kConsStringTag < kExternalStringTag); | 515 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
516 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); | 516 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 517 STATIC_ASSERT(kThinStringTag > kExternalStringTag); |
517 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); | 518 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
518 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); | 519 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); |
519 __ cmpp(rbx, Immediate(kExternalStringTag)); | 520 __ cmpp(rbx, Immediate(kExternalStringTag)); |
520 __ j(greater_equal, ¬_seq_nor_cons); // Go to (6). | 521 __ j(greater_equal, ¬_seq_nor_cons); // Go to (6). |
521 | 522 |
522 // (4) Cons string. Check that it's flat. | 523 // (4) Cons string. Check that it's flat. |
523 // Replace subject with first string and reload instance type. | 524 // Replace subject with first string and reload instance type. |
524 __ CompareRoot(FieldOperand(rdi, ConsString::kSecondOffset), | 525 __ CompareRoot(FieldOperand(rdi, ConsString::kSecondOffset), |
525 Heap::kempty_stringRootIndex); | 526 Heap::kempty_stringRootIndex); |
526 __ j(not_equal, &runtime); | 527 __ j(not_equal, &runtime); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 __ Set(rcx, 0); // Type is two byte. | 796 __ Set(rcx, 0); // Type is two byte. |
796 __ jmp(&check_code); // Go to (E). | 797 __ jmp(&check_code); // Go to (E). |
797 | 798 |
798 // (10) Not a string or a short external string? If yes, bail out to runtime. | 799 // (10) Not a string or a short external string? If yes, bail out to runtime. |
799 __ bind(¬_long_external); | 800 __ bind(¬_long_external); |
800 // Catch non-string subject or short external string. | 801 // Catch non-string subject or short external string. |
801 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); | 802 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); |
802 __ testb(rbx, Immediate(kIsNotStringMask | kShortExternalStringMask)); | 803 __ testb(rbx, Immediate(kIsNotStringMask | kShortExternalStringMask)); |
803 __ j(not_zero, &runtime); | 804 __ j(not_zero, &runtime); |
804 | 805 |
805 // (11) Sliced string. Replace subject with parent. Go to (1). | 806 // (11) Sliced or thin string. Replace subject with parent. Go to (1). |
| 807 Label thin_string; |
| 808 __ cmpl(rbx, Immediate(kThinStringTag)); |
| 809 __ j(equal, &thin_string, Label::kNear); |
806 // Load offset into r14 and replace subject string with parent. | 810 // Load offset into r14 and replace subject string with parent. |
807 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); | 811 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); |
808 __ movp(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); | 812 __ movp(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); |
809 __ jmp(&check_underlying); | 813 __ jmp(&check_underlying); |
| 814 |
| 815 __ bind(&thin_string); |
| 816 __ movp(rdi, FieldOperand(rdi, ThinString::kActualOffset)); |
| 817 __ jmp(&check_underlying); |
810 #endif // V8_INTERPRETED_REGEXP | 818 #endif // V8_INTERPRETED_REGEXP |
811 } | 819 } |
812 | 820 |
813 | 821 |
814 static int NegativeComparisonResult(Condition cc) { | 822 static int NegativeComparisonResult(Condition cc) { |
815 DCHECK(cc != equal); | 823 DCHECK(cc != equal); |
816 DCHECK((cc == less) || (cc == less_equal) | 824 DCHECK((cc == less) || (cc == less_equal) |
817 || (cc == greater) || (cc == greater_equal)); | 825 || (cc == greater) || (cc == greater_equal)); |
818 return (cc == greater || cc == greater_equal) ? LESS : GREATER; | 826 return (cc == greater || cc == greater_equal) ? LESS : GREATER; |
819 } | 827 } |
(...skipping 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4124 kStackUnwindSpace, nullptr, return_value_operand, | 4132 kStackUnwindSpace, nullptr, return_value_operand, |
4125 NULL); | 4133 NULL); |
4126 } | 4134 } |
4127 | 4135 |
4128 #undef __ | 4136 #undef __ |
4129 | 4137 |
4130 } // namespace internal | 4138 } // namespace internal |
4131 } // namespace v8 | 4139 } // namespace v8 |
4132 | 4140 |
4133 #endif // V8_TARGET_ARCH_X64 | 4141 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |