OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset)); | 2647 __ movzxbl(rbx, FieldOperand(rbx, Map::kInstanceTypeOffset)); |
2648 // First check for flat two byte string. | 2648 // First check for flat two byte string. |
2649 __ andb(rbx, Immediate( | 2649 __ andb(rbx, Immediate( |
2650 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask)); | 2650 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask)); |
2651 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0); | 2651 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0); |
2652 __ j(zero, &seq_two_byte_string, Label::kNear); | 2652 __ j(zero, &seq_two_byte_string, Label::kNear); |
2653 // Any other flat string must be a flat ascii string. | 2653 // Any other flat string must be a flat ascii string. |
2654 __ andb(rbx, Immediate(kIsNotStringMask | kStringRepresentationMask)); | 2654 __ andb(rbx, Immediate(kIsNotStringMask | kStringRepresentationMask)); |
2655 __ j(zero, &seq_ascii_string, Label::kNear); | 2655 __ j(zero, &seq_ascii_string, Label::kNear); |
2656 | 2656 |
| 2657 // rbx: whether subject is a string and if yes, its string representation |
2657 // Check for flat cons string or sliced string. | 2658 // Check for flat cons string or sliced string. |
2658 // A flat cons string is a cons string where the second part is the empty | 2659 // A flat cons string is a cons string where the second part is the empty |
2659 // string. In that case the subject string is just the first part of the cons | 2660 // string. In that case the subject string is just the first part of the cons |
2660 // string. Also in this case the first part of the cons string is known to be | 2661 // string. Also in this case the first part of the cons string is known to be |
2661 // a sequential string or an external string. | 2662 // a sequential string or an external string. |
2662 // In the case of a sliced string its offset has to be taken into account. | 2663 // In the case of a sliced string its offset has to be taken into account. |
2663 Label cons_string, check_encoding; | 2664 Label cons_string, check_encoding; |
2664 STATIC_ASSERT(kConsStringTag < kExternalStringTag); | 2665 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
2665 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); | 2666 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 2667 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
2666 __ cmpq(rbx, Immediate(kExternalStringTag)); | 2668 __ cmpq(rbx, Immediate(kExternalStringTag)); |
2667 __ j(less, &cons_string, Label::kNear); | 2669 __ j(less, &cons_string, Label::kNear); |
2668 __ j(equal, &runtime); | 2670 __ j(equal, &runtime); |
2669 | 2671 |
| 2672 // Catch non-string subject (should already have been guarded against). |
| 2673 STATIC_ASSERT(kIsNotStringTag != 0); |
| 2674 __ testb(rbx, Immediate(kIsNotStringMask)); |
| 2675 __ j(not_zero, &runtime); |
| 2676 |
2670 // String is sliced. | 2677 // String is sliced. |
2671 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); | 2678 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); |
2672 __ movq(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); | 2679 __ movq(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); |
2673 // r14: slice offset | 2680 // r14: slice offset |
2674 // r15: original subject string | 2681 // r15: original subject string |
2675 // rdi: parent string | 2682 // rdi: parent string |
2676 __ jmp(&check_encoding, Label::kNear); | 2683 __ jmp(&check_encoding, Label::kNear); |
2677 // String is a cons string, check whether it is flat. | 2684 // String is a cons string, check whether it is flat. |
2678 __ bind(&cons_string); | 2685 __ bind(&cons_string); |
2679 __ CompareRoot(FieldOperand(rdi, ConsString::kSecondOffset), | 2686 __ CompareRoot(FieldOperand(rdi, ConsString::kSecondOffset), |
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6046 xmm0, | 6053 xmm0, |
6047 &slow_elements); | 6054 &slow_elements); |
6048 __ ret(0); | 6055 __ ret(0); |
6049 } | 6056 } |
6050 | 6057 |
6051 #undef __ | 6058 #undef __ |
6052 | 6059 |
6053 } } // namespace v8::internal | 6060 } } // namespace v8::internal |
6054 | 6061 |
6055 #endif // V8_TARGET_ARCH_X64 | 6062 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |