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 5730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5741 __ mov(eax, ecx); | 5741 __ mov(eax, ecx); |
5742 __ IncrementCounter(counters->string_add_native(), 1); | 5742 __ IncrementCounter(counters->string_add_native(), 1); |
5743 __ ret(2 * kPointerSize); | 5743 __ ret(2 * kPointerSize); |
5744 __ bind(&non_ascii); | 5744 __ bind(&non_ascii); |
5745 // At least one of the strings is two-byte. Check whether it happens | 5745 // At least one of the strings is two-byte. Check whether it happens |
5746 // to contain only ASCII characters. | 5746 // to contain only ASCII characters. |
5747 // ecx: first instance type AND second instance type. | 5747 // ecx: first instance type AND second instance type. |
5748 // edi: second instance type. | 5748 // edi: second instance type. |
5749 __ test(ecx, Immediate(kAsciiDataHintMask)); | 5749 __ test(ecx, Immediate(kAsciiDataHintMask)); |
5750 __ j(not_zero, &ascii_data); | 5750 __ j(not_zero, &ascii_data); |
5751 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); | |
5752 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); | |
5753 __ xor_(edi, ecx); | |
5754 STATIC_ASSERT(kOneByteStringTag != 0 && kAsciiDataHintTag != 0); | |
5755 __ and_(edi, kOneByteStringTag | kAsciiDataHintTag); | |
5756 __ cmp(edi, kOneByteStringTag | kAsciiDataHintTag); | |
5757 __ j(equal, &ascii_data); | |
5758 // Allocate a two byte cons string. | 5751 // Allocate a two byte cons string. |
5759 __ AllocateTwoByteConsString(ecx, edi, no_reg, &call_runtime); | 5752 __ AllocateTwoByteConsString(ecx, edi, no_reg, &call_runtime); |
5760 __ jmp(&allocated); | 5753 __ jmp(&allocated); |
5761 | 5754 |
5762 // We cannot encounter sliced strings or cons strings here since: | 5755 // We cannot encounter sliced strings or cons strings here since: |
5763 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); | 5756 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); |
5764 // Handle creating a flat result from either external or sequential strings. | 5757 // Handle creating a flat result from either external or sequential strings. |
5765 // Locate the first characters' locations. | 5758 // Locate the first characters' locations. |
5766 // eax: first string | 5759 // eax: first string |
5767 // ebx: length of resulting flat string as a smi | 5760 // ebx: length of resulting flat string as a smi |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7527 // Restore ecx. | 7520 // Restore ecx. |
7528 __ pop(ecx); | 7521 __ pop(ecx); |
7529 __ ret(0); | 7522 __ ret(0); |
7530 } | 7523 } |
7531 | 7524 |
7532 #undef __ | 7525 #undef __ |
7533 | 7526 |
7534 } } // namespace v8::internal | 7527 } } // namespace v8::internal |
7535 | 7528 |
7536 #endif // V8_TARGET_ARCH_IA32 | 7529 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |