| 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 4523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4534 // subject: Subject string | 4534 // subject: Subject string |
| 4535 // a0: instance type if Subject string | 4535 // a0: instance type if Subject string |
| 4536 // regexp_data: RegExp data (FixedArray) | 4536 // regexp_data: RegExp data (FixedArray) |
| 4537 // Check for flat cons string or sliced string. | 4537 // Check for flat cons string or sliced string. |
| 4538 // A flat cons string is a cons string where the second part is the empty | 4538 // A flat cons string is a cons string where the second part is the empty |
| 4539 // string. In that case the subject string is just the first part of the cons | 4539 // string. In that case the subject string is just the first part of the cons |
| 4540 // string. Also in this case the first part of the cons string is known to be | 4540 // string. Also in this case the first part of the cons string is known to be |
| 4541 // a sequential string or an external string. | 4541 // a sequential string or an external string. |
| 4542 // In the case of a sliced string its offset has to be taken into account. | 4542 // In the case of a sliced string its offset has to be taken into account. |
| 4543 Label cons_string, check_encoding; | 4543 Label cons_string, check_encoding; |
| 4544 STATIC_ASSERT((kConsStringTag < kExternalStringTag)); | 4544 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
| 4545 STATIC_ASSERT((kSlicedStringTag > kExternalStringTag)); | 4545 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 4546 __ Branch(&cons_string, lt, at, Operand(kExternalStringTag)); | 4546 __ Branch(&cons_string, lt, at, Operand(kExternalStringTag)); |
| 4547 __ Branch(&runtime, eq, at, Operand(kExternalStringTag)); | 4547 __ Branch(&runtime, eq, at, Operand(kExternalStringTag)); |
| 4548 | 4548 |
| 4549 // String is sliced. | 4549 // String is sliced. |
| 4550 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 4550 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
| 4551 __ sra(t0, t0, kSmiTagSize); | 4551 __ sra(t0, t0, kSmiTagSize); |
| 4552 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 4552 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
| 4553 // t5: offset of sliced string, smi-tagged. | 4553 // t5: offset of sliced string, smi-tagged. |
| 4554 __ jmp(&check_encoding); | 4554 __ jmp(&check_encoding); |
| 4555 // String is a cons string, check whether it is flat. | 4555 // String is a cons string, check whether it is flat. |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5018 __ lw(t0, FieldMemOperand(object_, String::kLengthOffset)); | 5018 __ lw(t0, FieldMemOperand(object_, String::kLengthOffset)); |
| 5019 __ Branch(index_out_of_range_, ls, t0, Operand(scratch_)); | 5019 __ Branch(index_out_of_range_, ls, t0, Operand(scratch_)); |
| 5020 | 5020 |
| 5021 // We need special handling for non-flat strings. | 5021 // We need special handling for non-flat strings. |
| 5022 STATIC_ASSERT(kSeqStringTag == 0); | 5022 STATIC_ASSERT(kSeqStringTag == 0); |
| 5023 __ And(t0, result_, Operand(kStringRepresentationMask)); | 5023 __ And(t0, result_, Operand(kStringRepresentationMask)); |
| 5024 __ Branch(&flat_string, eq, t0, Operand(zero_reg)); | 5024 __ Branch(&flat_string, eq, t0, Operand(zero_reg)); |
| 5025 | 5025 |
| 5026 // Handle non-flat strings. | 5026 // Handle non-flat strings. |
| 5027 __ And(result_, result_, Operand(kStringRepresentationMask)); | 5027 __ And(result_, result_, Operand(kStringRepresentationMask)); |
| 5028 STATIC_ASSERT((kConsStringTag < kExternalStringTag)); | 5028 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
| 5029 STATIC_ASSERT((kSlicedStringTag > kExternalStringTag)); | 5029 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 5030 __ Branch(&sliced_string, gt, result_, Operand(kExternalStringTag)); | 5030 __ Branch(&sliced_string, gt, result_, Operand(kExternalStringTag)); |
| 5031 __ Branch(&call_runtime_, eq, result_, Operand(kExternalStringTag)); | 5031 __ Branch(&call_runtime_, eq, result_, Operand(kExternalStringTag)); |
| 5032 | 5032 |
| 5033 // ConsString. | 5033 // ConsString. |
| 5034 // Check whether the right hand side is the empty string (i.e. if | 5034 // Check whether the right hand side is the empty string (i.e. if |
| 5035 // this is really a flat string in a cons string). If that is not | 5035 // this is really a flat string in a cons string). If that is not |
| 5036 // the case we would rather go to the runtime system now to flatten | 5036 // the case we would rather go to the runtime system now to flatten |
| 5037 // the string. | 5037 // the string. |
| 5038 Label assure_seq_string; | 5038 Label assure_seq_string; |
| 5039 __ lw(result_, FieldMemOperand(object_, ConsString::kSecondOffset)); | 5039 __ lw(result_, FieldMemOperand(object_, ConsString::kSecondOffset)); |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6868 __ mov(result, zero_reg); | 6868 __ mov(result, zero_reg); |
| 6869 __ Ret(); | 6869 __ Ret(); |
| 6870 } | 6870 } |
| 6871 | 6871 |
| 6872 | 6872 |
| 6873 #undef __ | 6873 #undef __ |
| 6874 | 6874 |
| 6875 } } // namespace v8::internal | 6875 } } // namespace v8::internal |
| 6876 | 6876 |
| 6877 #endif // V8_TARGET_ARCH_MIPS | 6877 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |