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 4554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4565 __ b(eq, &seq_string); | 4565 __ b(eq, &seq_string); |
4566 | 4566 |
4567 // subject: Subject string | 4567 // subject: Subject string |
4568 // regexp_data: RegExp data (FixedArray) | 4568 // regexp_data: RegExp data (FixedArray) |
4569 // Check for flat cons string or sliced string. | 4569 // Check for flat cons string or sliced string. |
4570 // A flat cons string is a cons string where the second part is the empty | 4570 // A flat cons string is a cons string where the second part is the empty |
4571 // string. In that case the subject string is just the first part of the cons | 4571 // string. In that case the subject string is just the first part of the cons |
4572 // string. Also in this case the first part of the cons string is known to be | 4572 // string. Also in this case the first part of the cons string is known to be |
4573 // a sequential string or an external string. | 4573 // a sequential string or an external string. |
4574 // In the case of a sliced string its offset has to be taken into account. | 4574 // In the case of a sliced string its offset has to be taken into account. |
4575 Label cons_string, check_encoding; | 4575 Label cons_string, external_string, check_encoding; |
4576 STATIC_ASSERT(kConsStringTag < kExternalStringTag); | 4576 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
4577 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); | 4577 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
4578 __ cmp(r1, Operand(kExternalStringTag)); | 4578 __ cmp(r1, Operand(kExternalStringTag)); |
4579 __ b(lt, &cons_string); | 4579 __ b(lt, &cons_string); |
4580 __ b(eq, &runtime); | 4580 __ b(eq, &external_string); |
4581 | 4581 |
4582 // String is sliced. | 4582 // String is sliced. |
4583 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 4583 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
4584 __ mov(r9, Operand(r9, ASR, kSmiTagSize)); | 4584 __ mov(r9, Operand(r9, ASR, kSmiTagSize)); |
4585 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 4585 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
4586 // r9: offset of sliced string, smi-tagged. | 4586 // r9: offset of sliced string, smi-tagged. |
4587 __ jmp(&check_encoding); | 4587 __ jmp(&check_encoding); |
4588 // String is a cons string, check whether it is flat. | 4588 // String is a cons string, check whether it is flat. |
4589 __ bind(&cons_string); | 4589 __ bind(&cons_string); |
4590 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); | 4590 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); |
4591 __ LoadRoot(r1, Heap::kEmptyStringRootIndex); | 4591 __ CompareRoot(r0, Heap::kEmptyStringRootIndex); |
4592 __ cmp(r0, r1); | |
4593 __ b(ne, &runtime); | 4592 __ b(ne, &runtime); |
4594 __ ldr(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); | 4593 __ ldr(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); |
4595 // Is first part of cons or parent of slice a flat string? | 4594 // Is first part of cons or parent of slice a flat string? |
4596 __ bind(&check_encoding); | 4595 __ bind(&check_encoding); |
4597 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 4596 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
4598 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 4597 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
4599 STATIC_ASSERT(kSeqStringTag == 0); | 4598 STATIC_ASSERT(kSeqStringTag == 0); |
4600 __ tst(r0, Operand(kStringRepresentationMask)); | 4599 __ tst(r0, Operand(kStringRepresentationMask)); |
4601 __ b(ne, &runtime); | 4600 __ b(ne, &external_string); |
| 4601 |
4602 __ bind(&seq_string); | 4602 __ bind(&seq_string); |
4603 // subject: Subject string | 4603 // subject: Subject string |
4604 // regexp_data: RegExp data (FixedArray) | 4604 // regexp_data: RegExp data (FixedArray) |
4605 // r0: Instance type of subject string | 4605 // r0: Instance type of subject string |
4606 STATIC_ASSERT(4 == kAsciiStringTag); | 4606 STATIC_ASSERT(4 == kAsciiStringTag); |
4607 STATIC_ASSERT(kTwoByteStringTag == 0); | 4607 STATIC_ASSERT(kTwoByteStringTag == 0); |
4608 // Find the code object based on the assumptions above. | 4608 // Find the code object based on the assumptions above. |
4609 __ and_(r0, r0, Operand(kStringEncodingMask)); | 4609 __ and_(r0, r0, Operand(kStringEncodingMask)); |
4610 __ mov(r3, Operand(r0, ASR, 2), SetCC); | 4610 __ mov(r3, Operand(r0, ASR, 2), SetCC); |
4611 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset), ne); | 4611 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset), ne); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4799 __ mov(r3, Operand(r3, LSL, kSmiTagSize)); | 4799 __ mov(r3, Operand(r3, LSL, kSmiTagSize)); |
4800 __ str(r3, MemOperand(r0, kPointerSize, PostIndex)); | 4800 __ str(r3, MemOperand(r0, kPointerSize, PostIndex)); |
4801 __ jmp(&next_capture); | 4801 __ jmp(&next_capture); |
4802 __ bind(&done); | 4802 __ bind(&done); |
4803 | 4803 |
4804 // Return last match info. | 4804 // Return last match info. |
4805 __ ldr(r0, MemOperand(sp, kLastMatchInfoOffset)); | 4805 __ ldr(r0, MemOperand(sp, kLastMatchInfoOffset)); |
4806 __ add(sp, sp, Operand(4 * kPointerSize)); | 4806 __ add(sp, sp, Operand(4 * kPointerSize)); |
4807 __ Ret(); | 4807 __ Ret(); |
4808 | 4808 |
| 4809 // String is external. |
| 4810 // r0: scratch |
| 4811 __ bind(&external_string); |
| 4812 if (FLAG_debug_code) { |
| 4813 // Assert that we do not have a cons or slice (indirect strings) here. |
| 4814 // Sequential strings have already been ruled out. |
| 4815 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
| 4816 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
| 4817 __ tst(r0, Operand(kIsIndirectStringMask)); |
| 4818 __ Assert(eq, "unexpected indirect string encountered"); |
| 4819 } |
| 4820 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
| 4821 __ ldr(subject, |
| 4822 FieldMemOperand(subject, ExternalString::kResourceDataOffset)); |
| 4823 // Assert that the data pointer cache is valid. |
| 4824 __ tst(subject, subject); |
| 4825 __ b(eq, &runtime); |
| 4826 // Move the pointer so that offset-wise, it looks like a sequential string. |
| 4827 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); |
| 4828 __ sub(subject, |
| 4829 subject, |
| 4830 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
| 4831 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
| 4832 __ jmp(&seq_string); |
| 4833 |
4809 // Do the runtime call to execute the regexp. | 4834 // Do the runtime call to execute the regexp. |
4810 __ bind(&runtime); | 4835 __ bind(&runtime); |
4811 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 4836 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); |
4812 #endif // V8_INTERPRETED_REGEXP | 4837 #endif // V8_INTERPRETED_REGEXP |
4813 } | 4838 } |
4814 | 4839 |
4815 | 4840 |
4816 void RegExpConstructResultStub::Generate(MacroAssembler* masm) { | 4841 void RegExpConstructResultStub::Generate(MacroAssembler* masm) { |
4817 const int kMaxInlineLength = 100; | 4842 const int kMaxInlineLength = 100; |
4818 Label slowcase; | 4843 Label slowcase; |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7179 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, | 7204 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, |
7180 &slow_elements); | 7205 &slow_elements); |
7181 __ Ret(); | 7206 __ Ret(); |
7182 } | 7207 } |
7183 | 7208 |
7184 #undef __ | 7209 #undef __ |
7185 | 7210 |
7186 } } // namespace v8::internal | 7211 } } // namespace v8::internal |
7187 | 7212 |
7188 #endif // V8_TARGET_ARCH_ARM | 7213 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |