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 5702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5713 __ mov(eax, ecx); | 5713 __ mov(eax, ecx); |
5714 __ IncrementCounter(counters->string_add_native(), 1); | 5714 __ IncrementCounter(counters->string_add_native(), 1); |
5715 __ ret(2 * kPointerSize); | 5715 __ ret(2 * kPointerSize); |
5716 __ bind(&non_ascii); | 5716 __ bind(&non_ascii); |
5717 // At least one of the strings is two-byte. Check whether it happens | 5717 // At least one of the strings is two-byte. Check whether it happens |
5718 // to contain only ASCII characters. | 5718 // to contain only ASCII characters. |
5719 // ecx: first instance type AND second instance type. | 5719 // ecx: first instance type AND second instance type. |
5720 // edi: second instance type. | 5720 // edi: second instance type. |
5721 __ test(ecx, Immediate(kAsciiDataHintMask)); | 5721 __ test(ecx, Immediate(kAsciiDataHintMask)); |
5722 __ j(not_zero, &ascii_data); | 5722 __ j(not_zero, &ascii_data); |
| 5723 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 5724 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); |
| 5725 __ xor_(edi, ecx); |
| 5726 STATIC_ASSERT(kOneByteStringTag != 0 && kAsciiDataHintTag != 0); |
| 5727 __ and_(edi, kOneByteStringTag | kAsciiDataHintTag); |
| 5728 __ cmp(edi, kOneByteStringTag | kAsciiDataHintTag); |
| 5729 __ j(equal, &ascii_data); |
5723 // Allocate a two byte cons string. | 5730 // Allocate a two byte cons string. |
5724 __ AllocateTwoByteConsString(ecx, edi, no_reg, &call_runtime); | 5731 __ AllocateTwoByteConsString(ecx, edi, no_reg, &call_runtime); |
5725 __ jmp(&allocated); | 5732 __ jmp(&allocated); |
5726 | 5733 |
5727 // We cannot encounter sliced strings or cons strings here since: | 5734 // We cannot encounter sliced strings or cons strings here since: |
5728 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); | 5735 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); |
5729 // Handle creating a flat result from either external or sequential strings. | 5736 // Handle creating a flat result from either external or sequential strings. |
5730 // Locate the first characters' locations. | 5737 // Locate the first characters' locations. |
5731 // eax: first string | 5738 // eax: first string |
5732 // ebx: length of resulting flat string as a smi | 5739 // ebx: length of resulting flat string as a smi |
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7536 // Restore ecx. | 7543 // Restore ecx. |
7537 __ pop(ecx); | 7544 __ pop(ecx); |
7538 __ ret(0); | 7545 __ ret(0); |
7539 } | 7546 } |
7540 | 7547 |
7541 #undef __ | 7548 #undef __ |
7542 | 7549 |
7543 } } // namespace v8::internal | 7550 } } // namespace v8::internal |
7544 | 7551 |
7545 #endif // V8_TARGET_ARCH_IA32 | 7552 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |