| 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 5803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5814 | 5814 |
| 5815 // Short-cut for the case of trivial substring. | 5815 // Short-cut for the case of trivial substring. |
| 5816 Label return_r0; | 5816 Label return_r0; |
| 5817 // r0: original string | 5817 // r0: original string |
| 5818 // r2: result string length | 5818 // r2: result string length |
| 5819 __ ldr(r4, FieldMemOperand(r0, String::kLengthOffset)); | 5819 __ ldr(r4, FieldMemOperand(r0, String::kLengthOffset)); |
| 5820 __ cmp(r2, Operand(r4, ASR, 1)); | 5820 __ cmp(r2, Operand(r4, ASR, 1)); |
| 5821 __ b(eq, &return_r0); | 5821 __ b(eq, &return_r0); |
| 5822 | 5822 |
| 5823 Label result_longer_than_two; | 5823 Label result_longer_than_two; |
| 5824 // Check for special case of two character ascii string, in which case | 5824 // Check for special case of two character ASCII string, in which case |
| 5825 // we do a lookup in the symbol table first. | 5825 // we do a lookup in the symbol table first. |
| 5826 __ cmp(r2, Operand(2)); | 5826 __ cmp(r2, Operand(2)); |
| 5827 __ b(gt, &result_longer_than_two); | 5827 __ b(gt, &result_longer_than_two); |
| 5828 __ b(lt, &runtime); | 5828 __ b(lt, &runtime); |
| 5829 | 5829 |
| 5830 __ JumpIfInstanceTypeIsNotSequentialAscii(r1, r1, &runtime); | 5830 __ JumpIfInstanceTypeIsNotSequentialAscii(r1, r1, &runtime); |
| 5831 | 5831 |
| 5832 // Get the two characters forming the sub string. | 5832 // Get the two characters forming the sub string. |
| 5833 __ add(r0, r0, Operand(r3)); | 5833 __ add(r0, r0, Operand(r3)); |
| 5834 __ ldrb(r3, FieldMemOperand(r0, SeqAsciiString::kHeaderSize)); | 5834 __ ldrb(r3, FieldMemOperand(r0, SeqAsciiString::kHeaderSize)); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5944 // Locate first character of underlying subject string. | 5944 // Locate first character of underlying subject string. |
| 5945 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); | 5945 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); |
| 5946 __ add(r5, r5, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); | 5946 __ add(r5, r5, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
| 5947 | 5947 |
| 5948 __ bind(&allocate_result); | 5948 __ bind(&allocate_result); |
| 5949 // Sequential acii string. Allocate the result. | 5949 // Sequential acii string. Allocate the result. |
| 5950 STATIC_ASSERT((kAsciiStringTag & kStringEncodingMask) != 0); | 5950 STATIC_ASSERT((kAsciiStringTag & kStringEncodingMask) != 0); |
| 5951 __ tst(r1, Operand(kStringEncodingMask)); | 5951 __ tst(r1, Operand(kStringEncodingMask)); |
| 5952 __ b(eq, &two_byte_sequential); | 5952 __ b(eq, &two_byte_sequential); |
| 5953 | 5953 |
| 5954 // Allocate and copy the resulting ascii string. | 5954 // Allocate and copy the resulting ASCII string. |
| 5955 __ AllocateAsciiString(r0, r2, r4, r6, r7, &runtime); | 5955 __ AllocateAsciiString(r0, r2, r4, r6, r7, &runtime); |
| 5956 | 5956 |
| 5957 // Locate first character of substring to copy. | 5957 // Locate first character of substring to copy. |
| 5958 __ add(r5, r5, r3); | 5958 __ add(r5, r5, r3); |
| 5959 // Locate first character of result. | 5959 // Locate first character of result. |
| 5960 __ add(r1, r0, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); | 5960 __ add(r1, r0, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
| 5961 | 5961 |
| 5962 // r0: result string | 5962 // r0: result string |
| 5963 // r1: first character of result string | 5963 // r1: first character of result string |
| 5964 // r2: result string length | 5964 // r2: result string length |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7314 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, | 7314 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, |
| 7315 &slow_elements); | 7315 &slow_elements); |
| 7316 __ Ret(); | 7316 __ Ret(); |
| 7317 } | 7317 } |
| 7318 | 7318 |
| 7319 #undef __ | 7319 #undef __ |
| 7320 | 7320 |
| 7321 } } // namespace v8::internal | 7321 } } // namespace v8::internal |
| 7322 | 7322 |
| 7323 #endif // V8_TARGET_ARCH_ARM | 7323 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |