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 10389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10400 __ b(hs, &string_add_runtime); | 10400 __ b(hs, &string_add_runtime); |
10401 | 10401 |
10402 // If result is not supposed to be flat, allocate a cons string object. | 10402 // If result is not supposed to be flat, allocate a cons string object. |
10403 // If both strings are ascii the result is an ascii cons string. | 10403 // If both strings are ascii the result is an ascii cons string. |
10404 if (!string_check_) { | 10404 if (!string_check_) { |
10405 __ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); | 10405 __ ldr(r4, FieldMemOperand(r0, HeapObject::kMapOffset)); |
10406 __ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); | 10406 __ ldr(r5, FieldMemOperand(r1, HeapObject::kMapOffset)); |
10407 __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); | 10407 __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
10408 __ ldrb(r5, FieldMemOperand(r5, Map::kInstanceTypeOffset)); | 10408 __ ldrb(r5, FieldMemOperand(r5, Map::kInstanceTypeOffset)); |
10409 } | 10409 } |
10410 Label non_ascii, allocated; | 10410 Label non_ascii, allocated, ascii_data; |
10411 ASSERT_EQ(0, kTwoByteStringTag); | 10411 ASSERT_EQ(0, kTwoByteStringTag); |
10412 __ tst(r4, Operand(kStringEncodingMask)); | 10412 __ tst(r4, Operand(kStringEncodingMask)); |
10413 __ tst(r5, Operand(kStringEncodingMask), ne); | 10413 __ tst(r5, Operand(kStringEncodingMask), ne); |
10414 __ b(eq, &non_ascii); | 10414 __ b(eq, &non_ascii); |
10415 | 10415 |
10416 // Allocate an ASCII cons string. | 10416 // Allocate an ASCII cons string. |
| 10417 __ bind(&ascii_data); |
10417 __ AllocateAsciiConsString(r7, r6, r4, r5, &string_add_runtime); | 10418 __ AllocateAsciiConsString(r7, r6, r4, r5, &string_add_runtime); |
10418 __ bind(&allocated); | 10419 __ bind(&allocated); |
10419 // Fill the fields of the cons string. | 10420 // Fill the fields of the cons string. |
10420 __ str(r0, FieldMemOperand(r7, ConsString::kFirstOffset)); | 10421 __ str(r0, FieldMemOperand(r7, ConsString::kFirstOffset)); |
10421 __ str(r1, FieldMemOperand(r7, ConsString::kSecondOffset)); | 10422 __ str(r1, FieldMemOperand(r7, ConsString::kSecondOffset)); |
10422 __ mov(r0, Operand(r7)); | 10423 __ mov(r0, Operand(r7)); |
10423 __ IncrementCounter(&Counters::string_add_native, 1, r2, r3); | 10424 __ IncrementCounter(&Counters::string_add_native, 1, r2, r3); |
10424 __ add(sp, sp, Operand(2 * kPointerSize)); | 10425 __ add(sp, sp, Operand(2 * kPointerSize)); |
10425 __ Ret(); | 10426 __ Ret(); |
10426 | 10427 |
10427 __ bind(&non_ascii); | 10428 __ bind(&non_ascii); |
| 10429 // At least one of the strings is two-byte. Check whether it happens |
| 10430 // to contain only ascii characters. |
| 10431 // r4: first instance type. |
| 10432 // r5: second instance type. |
| 10433 __ tst(r4, Operand(kAsciiDataHintMask)); |
| 10434 __ tst(r5, Operand(kAsciiDataHintMask), ne); |
| 10435 __ b(ne, &ascii_data); |
| 10436 __ eor(r4, r4, Operand(r5)); |
| 10437 ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0); |
| 10438 __ and_(r4, r4, Operand(kAsciiStringTag | kAsciiDataHintTag)); |
| 10439 __ cmp(r4, Operand(kAsciiStringTag | kAsciiDataHintTag)); |
| 10440 __ b(eq, &ascii_data); |
| 10441 |
10428 // Allocate a two byte cons string. | 10442 // Allocate a two byte cons string. |
10429 __ AllocateTwoByteConsString(r7, r6, r4, r5, &string_add_runtime); | 10443 __ AllocateTwoByteConsString(r7, r6, r4, r5, &string_add_runtime); |
10430 __ jmp(&allocated); | 10444 __ jmp(&allocated); |
10431 | 10445 |
10432 // Handle creating a flat result. First check that both strings are | 10446 // Handle creating a flat result. First check that both strings are |
10433 // sequential and that they have the same encoding. | 10447 // sequential and that they have the same encoding. |
10434 // r0: first string | 10448 // r0: first string |
10435 // r1: second string | 10449 // r1: second string |
10436 // r2: length of first string | 10450 // r2: length of first string |
10437 // r3: length of second string | 10451 // r3: length of second string |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10538 __ bind(&string_add_runtime); | 10552 __ bind(&string_add_runtime); |
10539 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 10553 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
10540 } | 10554 } |
10541 | 10555 |
10542 | 10556 |
10543 #undef __ | 10557 #undef __ |
10544 | 10558 |
10545 } } // namespace v8::internal | 10559 } } // namespace v8::internal |
10546 | 10560 |
10547 #endif // V8_TARGET_ARCH_ARM | 10561 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |