OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 9230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9241 __ ldr(r0, | 9241 __ ldr(r0, |
9242 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); | 9242 FieldMemOperand(last_match_info_elements, FixedArray::kLengthOffset)); |
9243 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); | 9243 __ add(r2, r2, Operand(RegExpImpl::kLastMatchOverhead)); |
9244 __ cmp(r2, Operand(r0, ASR, kSmiTagSize)); | 9244 __ cmp(r2, Operand(r0, ASR, kSmiTagSize)); |
9245 __ b(gt, &runtime); | 9245 __ b(gt, &runtime); |
9246 | 9246 |
9247 // subject: Subject string | 9247 // subject: Subject string |
9248 // regexp_data: RegExp data (FixedArray) | 9248 // regexp_data: RegExp data (FixedArray) |
9249 // Check the representation and encoding of the subject string. | 9249 // Check the representation and encoding of the subject string. |
9250 Label seq_string; | 9250 Label seq_string; |
9251 const int kStringRepresentationEncodingMask = | |
9252 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | |
9253 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 9251 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
9254 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 9252 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
9255 __ and_(r1, r0, Operand(kStringRepresentationEncodingMask)); | 9253 // First check for flat string. |
9256 // First check for sequential string. | 9254 __ tst(r0, Operand(kIsNotStringMask | kStringRepresentationMask)); |
9257 ASSERT_EQ(0, kStringTag); | 9255 ASSERT_EQ(0, kStringTag | kSeqStringTag); |
9258 ASSERT_EQ(0, kSeqStringTag); | |
9259 __ tst(r1, Operand(kIsNotStringMask | kStringRepresentationMask)); | |
9260 __ b(eq, &seq_string); | 9256 __ b(eq, &seq_string); |
9261 | 9257 |
9262 // subject: Subject string | 9258 // subject: Subject string |
9263 // regexp_data: RegExp data (FixedArray) | 9259 // regexp_data: RegExp data (FixedArray) |
9264 // Check for flat cons string. | 9260 // Check for flat cons string. |
9265 // A flat cons string is a cons string where the second part is the empty | 9261 // A flat cons string is a cons string where the second part is the empty |
9266 // string. In that case the subject string is just the first part of the cons | 9262 // string. In that case the subject string is just the first part of the cons |
9267 // string. Also in this case the first part of the cons string is known to be | 9263 // string. Also in this case the first part of the cons string is known to be |
9268 // a sequential string or an external string. | 9264 // a sequential string or an external string. |
9269 __ and_(r0, r0, Operand(kStringRepresentationMask)); | 9265 ASSERT(kExternalStringTag !=0); |
9270 __ cmp(r0, Operand(kConsStringTag)); | 9266 ASSERT_EQ(0, kConsStringTag & kExternalStringTag); |
| 9267 __ tst(r0, Operand(kIsNotStringMask | kExternalStringTag)); |
9271 __ b(ne, &runtime); | 9268 __ b(ne, &runtime); |
9272 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); | 9269 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); |
9273 __ LoadRoot(r1, Heap::kEmptyStringRootIndex); | 9270 __ LoadRoot(r1, Heap::kEmptyStringRootIndex); |
9274 __ cmp(r0, r1); | 9271 __ cmp(r0, r1); |
9275 __ b(ne, &runtime); | 9272 __ b(ne, &runtime); |
9276 __ ldr(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); | 9273 __ ldr(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); |
9277 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); | 9274 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); |
9278 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 9275 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
| 9276 // Is first part a flat string? |
9279 ASSERT_EQ(0, kSeqStringTag); | 9277 ASSERT_EQ(0, kSeqStringTag); |
9280 __ tst(r0, Operand(kStringRepresentationMask)); | 9278 __ tst(r0, Operand(kStringRepresentationMask)); |
9281 __ b(nz, &runtime); | 9279 __ b(nz, &runtime); |
9282 __ and_(r1, r0, Operand(kStringRepresentationEncodingMask)); | |
9283 | 9280 |
9284 __ bind(&seq_string); | 9281 __ bind(&seq_string); |
9285 // r1: suject string type & kStringRepresentationEncodingMask | |
9286 // subject: Subject string | 9282 // subject: Subject string |
9287 // regexp_data: RegExp data (FixedArray) | 9283 // regexp_data: RegExp data (FixedArray) |
9288 // Check that the irregexp code has been generated for an ascii string. If | 9284 // r0: Instance type of subject string |
9289 // it has, the field contains a code object otherwise it contains the hole. | 9285 ASSERT_EQ(4, kAsciiStringTag); |
9290 #ifdef DEBUG | 9286 ASSERT_EQ(0, kTwoByteStringTag); |
9291 const int kSeqAsciiString = kStringTag | kSeqStringTag | kAsciiStringTag; | |
9292 const int kSeqTwoByteString = kStringTag | kSeqStringTag | kTwoByteStringTag; | |
9293 CHECK_EQ(4, kSeqAsciiString); | |
9294 CHECK_EQ(0, kSeqTwoByteString); | |
9295 #endif | |
9296 // Find the code object based on the assumptions above. | 9287 // Find the code object based on the assumptions above. |
9297 __ mov(r3, Operand(r1, ASR, 2), SetCC); | 9288 __ and_(r0, r0, Operand(kStringEncodingMask)); |
| 9289 __ mov(r3, Operand(r0, ASR, 2), SetCC); |
9298 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset), ne); | 9290 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset), ne); |
9299 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq); | 9291 __ ldr(r7, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq); |
9300 | 9292 |
9301 // Check that the irregexp code has been generated for the actual string | 9293 // Check that the irregexp code has been generated for the actual string |
9302 // encoding. If it has, the field contains a code object otherwise it contains | 9294 // encoding. If it has, the field contains a code object otherwise it contains |
9303 // the hole. | 9295 // the hole. |
9304 __ CompareObjectType(r7, r0, r0, CODE_TYPE); | 9296 __ CompareObjectType(r7, r0, r0, CODE_TYPE); |
9305 __ b(ne, &runtime); | 9297 __ b(ne, &runtime); |
9306 | 9298 |
9307 // r3: encoding of subject string (1 if ascii, 0 if two_byte); | 9299 // r3: encoding of subject string (1 if ascii, 0 if two_byte); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10655 __ bind(&string_add_runtime); | 10647 __ bind(&string_add_runtime); |
10656 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 10648 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
10657 } | 10649 } |
10658 | 10650 |
10659 | 10651 |
10660 #undef __ | 10652 #undef __ |
10661 | 10653 |
10662 } } // namespace v8::internal | 10654 } } // namespace v8::internal |
10663 | 10655 |
10664 #endif // V8_TARGET_ARCH_ARM | 10656 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |