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 4747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4758 __ IncrementCounter(counters->string_add_native(), 1); | 4758 __ IncrementCounter(counters->string_add_native(), 1); |
4759 __ ret(2 * kPointerSize); | 4759 __ ret(2 * kPointerSize); |
4760 __ bind(&non_ascii); | 4760 __ bind(&non_ascii); |
4761 // At least one of the strings is two-byte. Check whether it happens | 4761 // At least one of the strings is two-byte. Check whether it happens |
4762 // to contain only ASCII characters. | 4762 // to contain only ASCII characters. |
4763 // rcx: first instance type AND second instance type. | 4763 // rcx: first instance type AND second instance type. |
4764 // r8: first instance type. | 4764 // r8: first instance type. |
4765 // r9: second instance type. | 4765 // r9: second instance type. |
4766 __ testb(rcx, Immediate(kAsciiDataHintMask)); | 4766 __ testb(rcx, Immediate(kAsciiDataHintMask)); |
4767 __ j(not_zero, &ascii_data); | 4767 __ j(not_zero, &ascii_data); |
4768 __ xor_(r8, r9); | |
4769 STATIC_ASSERT(kOneByteStringTag != 0 && kAsciiDataHintTag != 0); | |
4770 __ andb(r8, Immediate(kOneByteStringTag | kAsciiDataHintTag)); | |
4771 __ cmpb(r8, Immediate(kOneByteStringTag | kAsciiDataHintTag)); | |
4772 __ j(equal, &ascii_data); | |
4773 // Allocate a two byte cons string. | 4768 // Allocate a two byte cons string. |
4774 __ AllocateTwoByteConsString(rcx, rdi, no_reg, &call_runtime); | 4769 __ AllocateTwoByteConsString(rcx, rdi, no_reg, &call_runtime); |
4775 __ jmp(&allocated); | 4770 __ jmp(&allocated); |
4776 | 4771 |
4777 // We cannot encounter sliced strings or cons strings here since: | 4772 // We cannot encounter sliced strings or cons strings here since: |
4778 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); | 4773 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); |
4779 // Handle creating a flat result from either external or sequential strings. | 4774 // Handle creating a flat result from either external or sequential strings. |
4780 // Locate the first characters' locations. | 4775 // Locate the first characters' locations. |
4781 // rax: first string | 4776 // rax: first string |
4782 // rbx: length of resulting flat string as smi | 4777 // rbx: length of resulting flat string as smi |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6499 #endif | 6494 #endif |
6500 | 6495 |
6501 __ Ret(); | 6496 __ Ret(); |
6502 } | 6497 } |
6503 | 6498 |
6504 #undef __ | 6499 #undef __ |
6505 | 6500 |
6506 } } // namespace v8::internal | 6501 } } // namespace v8::internal |
6507 | 6502 |
6508 #endif // V8_TARGET_ARCH_X64 | 6503 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |