OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4916 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 4916 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
4917 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 4917 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
4918 STATIC_ASSERT(kSeqStringTag == 0); | 4918 STATIC_ASSERT(kSeqStringTag == 0); |
4919 __ tst(r0, Operand(kStringRepresentationMask)); | 4919 __ tst(r0, Operand(kStringRepresentationMask)); |
4920 __ b(ne, &external_string); | 4920 __ b(ne, &external_string); |
4921 | 4921 |
4922 __ bind(&seq_string); | 4922 __ bind(&seq_string); |
4923 // subject: Subject string | 4923 // subject: Subject string |
4924 // regexp_data: RegExp data (FixedArray) | 4924 // regexp_data: RegExp data (FixedArray) |
4925 // r0: Instance type of subject string | 4925 // r0: Instance type of subject string |
4926 STATIC_ASSERT(4 == kAsciiStringTag); | 4926 STATIC_ASSERT(4 == kOneByteStringTag); |
4927 STATIC_ASSERT(kTwoByteStringTag == 0); | 4927 STATIC_ASSERT(kTwoByteStringTag == 0); |
4928 // Find the code object based on the assumptions above. | 4928 // Find the code object based on the assumptions above. |
4929 __ and_(r0, r0, Operand(kStringEncodingMask)); | 4929 __ and_(r0, r0, Operand(kStringEncodingMask)); |
4930 __ mov(r3, Operand(r0, ASR, 2), SetCC); | 4930 __ mov(r3, Operand(r0, ASR, 2), SetCC); |
4931 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset), ne); | 4931 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset), ne); |
4932 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq); | 4932 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq); |
4933 | 4933 |
4934 // Check that the irregexp code has been generated for the actual string | 4934 // Check that the irregexp code has been generated for the actual string |
4935 // encoding. If it has, the field contains a code object otherwise it contains | 4935 // encoding. If it has, the field contains a code object otherwise it contains |
4936 // a smi (code flushing support). | 4936 // a smi (code flushing support). |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6084 // r3: adjusted start index (untagged) | 6084 // r3: adjusted start index (untagged) |
6085 __ cmp(r2, Operand(SlicedString::kMinLength)); | 6085 __ cmp(r2, Operand(SlicedString::kMinLength)); |
6086 // Short slice. Copy instead of slicing. | 6086 // Short slice. Copy instead of slicing. |
6087 __ b(lt, ©_routine); | 6087 __ b(lt, ©_routine); |
6088 // Allocate new sliced string. At this point we do not reload the instance | 6088 // Allocate new sliced string. At this point we do not reload the instance |
6089 // type including the string encoding because we simply rely on the info | 6089 // type including the string encoding because we simply rely on the info |
6090 // provided by the original string. It does not matter if the original | 6090 // provided by the original string. It does not matter if the original |
6091 // string's encoding is wrong because we always have to recheck encoding of | 6091 // string's encoding is wrong because we always have to recheck encoding of |
6092 // the newly created string's parent anyways due to externalized strings. | 6092 // the newly created string's parent anyways due to externalized strings. |
6093 Label two_byte_slice, set_slice_header; | 6093 Label two_byte_slice, set_slice_header; |
6094 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); | 6094 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); |
6095 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); | 6095 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); |
6096 __ tst(r1, Operand(kStringEncodingMask)); | 6096 __ tst(r1, Operand(kStringEncodingMask)); |
6097 __ b(eq, &two_byte_slice); | 6097 __ b(eq, &two_byte_slice); |
6098 __ AllocateAsciiSlicedString(r0, r2, r6, r7, &runtime); | 6098 __ AllocateAsciiSlicedString(r0, r2, r6, r7, &runtime); |
6099 __ jmp(&set_slice_header); | 6099 __ jmp(&set_slice_header); |
6100 __ bind(&two_byte_slice); | 6100 __ bind(&two_byte_slice); |
6101 __ AllocateTwoByteSlicedString(r0, r2, r6, r7, &runtime); | 6101 __ AllocateTwoByteSlicedString(r0, r2, r6, r7, &runtime); |
6102 __ bind(&set_slice_header); | 6102 __ bind(&set_slice_header); |
6103 __ mov(r3, Operand(r3, LSL, 1)); | 6103 __ mov(r3, Operand(r3, LSL, 1)); |
6104 __ str(r5, FieldMemOperand(r0, SlicedString::kParentOffset)); | 6104 __ str(r5, FieldMemOperand(r0, SlicedString::kParentOffset)); |
(...skipping 22 matching lines...) Expand all Loading... |
6127 // r5 already points to the first character of underlying string. | 6127 // r5 already points to the first character of underlying string. |
6128 __ jmp(&allocate_result); | 6128 __ jmp(&allocate_result); |
6129 | 6129 |
6130 __ bind(&sequential_string); | 6130 __ bind(&sequential_string); |
6131 // Locate first character of underlying subject string. | 6131 // Locate first character of underlying subject string. |
6132 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); | 6132 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); |
6133 __ add(r5, r5, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); | 6133 __ add(r5, r5, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
6134 | 6134 |
6135 __ bind(&allocate_result); | 6135 __ bind(&allocate_result); |
6136 // Sequential acii string. Allocate the result. | 6136 // Sequential acii string. Allocate the result. |
6137 STATIC_ASSERT((kAsciiStringTag & kStringEncodingMask) != 0); | 6137 STATIC_ASSERT((kOneByteStringTag & kStringEncodingMask) != 0); |
6138 __ tst(r1, Operand(kStringEncodingMask)); | 6138 __ tst(r1, Operand(kStringEncodingMask)); |
6139 __ b(eq, &two_byte_sequential); | 6139 __ b(eq, &two_byte_sequential); |
6140 | 6140 |
6141 // Allocate and copy the resulting ASCII string. | 6141 // Allocate and copy the resulting ASCII string. |
6142 __ AllocateAsciiString(r0, r2, r4, r6, r7, &runtime); | 6142 __ AllocateAsciiString(r0, r2, r4, r6, r7, &runtime); |
6143 | 6143 |
6144 // Locate first character of substring to copy. | 6144 // Locate first character of substring to copy. |
6145 __ add(r5, r5, r3); | 6145 __ add(r5, r5, r3); |
6146 // Locate first character of result. | 6146 // Locate first character of result. |
6147 __ add(r1, r0, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); | 6147 __ add(r1, r0, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6492 | 6492 |
6493 __ bind(&non_ascii); | 6493 __ bind(&non_ascii); |
6494 // At least one of the strings is two-byte. Check whether it happens | 6494 // At least one of the strings is two-byte. Check whether it happens |
6495 // to contain only ASCII characters. | 6495 // to contain only ASCII characters. |
6496 // r4: first instance type. | 6496 // r4: first instance type. |
6497 // r5: second instance type. | 6497 // r5: second instance type. |
6498 __ tst(r4, Operand(kAsciiDataHintMask)); | 6498 __ tst(r4, Operand(kAsciiDataHintMask)); |
6499 __ tst(r5, Operand(kAsciiDataHintMask), ne); | 6499 __ tst(r5, Operand(kAsciiDataHintMask), ne); |
6500 __ b(ne, &ascii_data); | 6500 __ b(ne, &ascii_data); |
6501 __ eor(r4, r4, Operand(r5)); | 6501 __ eor(r4, r4, Operand(r5)); |
6502 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0); | 6502 STATIC_ASSERT(kOneByteStringTag != 0 && kAsciiDataHintTag != 0); |
6503 __ and_(r4, r4, Operand(kAsciiStringTag | kAsciiDataHintTag)); | 6503 __ and_(r4, r4, Operand(kOneByteStringTag | kAsciiDataHintTag)); |
6504 __ cmp(r4, Operand(kAsciiStringTag | kAsciiDataHintTag)); | 6504 __ cmp(r4, Operand(kOneByteStringTag | kAsciiDataHintTag)); |
6505 __ b(eq, &ascii_data); | 6505 __ b(eq, &ascii_data); |
6506 | 6506 |
6507 // Allocate a two byte cons string. | 6507 // Allocate a two byte cons string. |
6508 __ AllocateTwoByteConsString(r7, r6, r4, r5, &call_runtime); | 6508 __ AllocateTwoByteConsString(r7, r6, r4, r5, &call_runtime); |
6509 __ jmp(&allocated); | 6509 __ jmp(&allocated); |
6510 | 6510 |
6511 // We cannot encounter sliced strings or cons strings here since: | 6511 // We cannot encounter sliced strings or cons strings here since: |
6512 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); | 6512 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); |
6513 // Handle creating a flat result from either external or sequential strings. | 6513 // Handle creating a flat result from either external or sequential strings. |
6514 // Locate the first characters' locations. | 6514 // Locate the first characters' locations. |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7629 | 7629 |
7630 __ Pop(lr, r5, r1); | 7630 __ Pop(lr, r5, r1); |
7631 __ Ret(); | 7631 __ Ret(); |
7632 } | 7632 } |
7633 | 7633 |
7634 #undef __ | 7634 #undef __ |
7635 | 7635 |
7636 } } // namespace v8::internal | 7636 } } // namespace v8::internal |
7637 | 7637 |
7638 #endif // V8_TARGET_ARCH_ARM | 7638 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |