OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4540 __ movzxbq(rcx, FieldOperand(rdx, SeqAsciiString::kHeaderSize)); | 4540 __ movzxbq(rcx, FieldOperand(rdx, SeqAsciiString::kHeaderSize)); |
4541 __ shll(rcx, Immediate(kBitsPerByte)); | 4541 __ shll(rcx, Immediate(kBitsPerByte)); |
4542 __ orl(rbx, rcx); | 4542 __ orl(rbx, rcx); |
4543 // Write both characters to the new string. | 4543 // Write both characters to the new string. |
4544 __ movw(FieldOperand(rax, SeqAsciiString::kHeaderSize), rbx); | 4544 __ movw(FieldOperand(rax, SeqAsciiString::kHeaderSize), rbx); |
4545 __ IncrementCounter(counters->string_add_native(), 1); | 4545 __ IncrementCounter(counters->string_add_native(), 1); |
4546 __ ret(2 * kPointerSize); | 4546 __ ret(2 * kPointerSize); |
4547 | 4547 |
4548 __ bind(&longer_than_two); | 4548 __ bind(&longer_than_two); |
4549 // Check if resulting string will be flat. | 4549 // Check if resulting string will be flat. |
4550 __ SmiCompare(rbx, Smi::FromInt(String::kMinNonFlatLength)); | 4550 __ SmiCompare(rbx, Smi::FromInt(ConsString::kMinLength)); |
4551 __ j(below, &string_add_flat_result); | 4551 __ j(below, &string_add_flat_result); |
4552 // Handle exceptionally long strings in the runtime system. | 4552 // Handle exceptionally long strings in the runtime system. |
4553 STATIC_ASSERT((String::kMaxLength & 0x80000000) == 0); | 4553 STATIC_ASSERT((String::kMaxLength & 0x80000000) == 0); |
4554 __ SmiCompare(rbx, Smi::FromInt(String::kMaxLength)); | 4554 __ SmiCompare(rbx, Smi::FromInt(String::kMaxLength)); |
4555 __ j(above, &call_runtime); | 4555 __ j(above, &call_runtime); |
4556 | 4556 |
4557 // If result is not supposed to be flat, allocate a cons string object. If | 4557 // If result is not supposed to be flat, allocate a cons string object. If |
4558 // both strings are ASCII the result is an ASCII cons string. | 4558 // both strings are ASCII the result is an ASCII cons string. |
4559 // rax: first string | 4559 // rax: first string |
4560 // rbx: length of resulting flat string | 4560 // rbx: length of resulting flat string |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4592 __ xor_(r8, r9); | 4592 __ xor_(r8, r9); |
4593 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0); | 4593 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0); |
4594 __ andb(r8, Immediate(kAsciiStringTag | kAsciiDataHintTag)); | 4594 __ andb(r8, Immediate(kAsciiStringTag | kAsciiDataHintTag)); |
4595 __ cmpb(r8, Immediate(kAsciiStringTag | kAsciiDataHintTag)); | 4595 __ cmpb(r8, Immediate(kAsciiStringTag | kAsciiDataHintTag)); |
4596 __ j(equal, &ascii_data); | 4596 __ j(equal, &ascii_data); |
4597 // Allocate a two byte cons string. | 4597 // Allocate a two byte cons string. |
4598 __ AllocateTwoByteConsString(rcx, rdi, no_reg, &call_runtime); | 4598 __ AllocateTwoByteConsString(rcx, rdi, no_reg, &call_runtime); |
4599 __ jmp(&allocated); | 4599 __ jmp(&allocated); |
4600 | 4600 |
4601 // We cannot encounter sliced strings or cons strings here since: | 4601 // We cannot encounter sliced strings or cons strings here since: |
4602 STATIC_ASSERT(SlicedString::kMinLength >= String::kMinNonFlatLength); | 4602 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); |
4603 // Handle creating a flat result from either external or sequential strings. | 4603 // Handle creating a flat result from either external or sequential strings. |
4604 // Locate the first characters' locations. | 4604 // Locate the first characters' locations. |
4605 // rax: first string | 4605 // rax: first string |
4606 // rbx: length of resulting flat string as smi | 4606 // rbx: length of resulting flat string as smi |
4607 // rdx: second string | 4607 // rdx: second string |
4608 // r8: instance type of first string | 4608 // r8: instance type of first string |
4609 // r9: instance type of first string | 4609 // r9: instance type of first string |
4610 Label first_prepared, second_prepared; | 4610 Label first_prepared, second_prepared; |
4611 Label first_is_sequential, second_is_sequential; | 4611 Label first_is_sequential, second_is_sequential; |
4612 __ bind(&string_add_flat_result); | 4612 __ bind(&string_add_flat_result); |
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6232 xmm0, | 6232 xmm0, |
6233 &slow_elements); | 6233 &slow_elements); |
6234 __ ret(0); | 6234 __ ret(0); |
6235 } | 6235 } |
6236 | 6236 |
6237 #undef __ | 6237 #undef __ |
6238 | 6238 |
6239 } } // namespace v8::internal | 6239 } } // namespace v8::internal |
6240 | 6240 |
6241 #endif // V8_TARGET_ARCH_X64 | 6241 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |