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 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 #ifdef DEBUG | 1551 #ifdef DEBUG |
1552 // Check that the layout of cache elements match expectations. | 1552 // Check that the layout of cache elements match expectations. |
1553 { // NOLINT - doesn't like a single brace on a line. | 1553 { // NOLINT - doesn't like a single brace on a line. |
1554 TranscendentalCache::SubCache::Element test_elem[2]; | 1554 TranscendentalCache::SubCache::Element test_elem[2]; |
1555 char* elem_start = reinterpret_cast<char*>(&test_elem[0]); | 1555 char* elem_start = reinterpret_cast<char*>(&test_elem[0]); |
1556 char* elem2_start = reinterpret_cast<char*>(&test_elem[1]); | 1556 char* elem2_start = reinterpret_cast<char*>(&test_elem[1]); |
1557 char* elem_in0 = reinterpret_cast<char*>(&(test_elem[0].in[0])); | 1557 char* elem_in0 = reinterpret_cast<char*>(&(test_elem[0].in[0])); |
1558 char* elem_in1 = reinterpret_cast<char*>(&(test_elem[0].in[1])); | 1558 char* elem_in1 = reinterpret_cast<char*>(&(test_elem[0].in[1])); |
1559 char* elem_out = reinterpret_cast<char*>(&(test_elem[0].output)); | 1559 char* elem_out = reinterpret_cast<char*>(&(test_elem[0].output)); |
1560 // Two uint_32's and a pointer per element. | 1560 // Two uint_32's and a pointer per element. |
1561 CHECK_EQ(16, static_cast<int>(elem2_start - elem_start)); | 1561 CHECK_EQ(2 * kIntSize + 1 * kPointerSize, |
| 1562 static_cast<int>(elem2_start - elem_start)); |
1562 CHECK_EQ(0, static_cast<int>(elem_in0 - elem_start)); | 1563 CHECK_EQ(0, static_cast<int>(elem_in0 - elem_start)); |
1563 CHECK_EQ(kIntSize, static_cast<int>(elem_in1 - elem_start)); | 1564 CHECK_EQ(kIntSize, static_cast<int>(elem_in1 - elem_start)); |
1564 CHECK_EQ(2 * kIntSize, static_cast<int>(elem_out - elem_start)); | 1565 CHECK_EQ(2 * kIntSize, static_cast<int>(elem_out - elem_start)); |
1565 } | 1566 } |
1566 #endif | 1567 #endif |
1567 // Find the address of the rcx'th entry in the cache, i.e., &rax[rcx*16]. | 1568 // Find the address of the rcx'th entry in the cache, i.e., &rax[rcx*16]. |
1568 __ addl(rcx, rcx); | 1569 __ addl(rcx, rcx); |
1569 __ lea(rcx, Operand(rax, rcx, times_8, 0)); | 1570 __ lea(rcx, Operand(rax, rcx, times_8, 0)); |
1570 // Check if cache matches: Double value is stored in uint32_t[2] array. | 1571 // Check if cache matches: Double value is stored in uint32_t[2] array. |
1571 Label cache_miss; | 1572 Label cache_miss; |
(...skipping 3526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5098 __ j(zero, &done, Label::kNear); | 5099 __ j(zero, &done, Label::kNear); |
5099 | 5100 |
5100 // Make count the number of bytes to copy. | 5101 // Make count the number of bytes to copy. |
5101 if (!ascii) { | 5102 if (!ascii) { |
5102 STATIC_ASSERT(2 == sizeof(uc16)); | 5103 STATIC_ASSERT(2 == sizeof(uc16)); |
5103 __ addl(count, count); | 5104 __ addl(count, count); |
5104 } | 5105 } |
5105 | 5106 |
5106 // Don't enter the rep movs if there are less than 4 bytes to copy. | 5107 // Don't enter the rep movs if there are less than 4 bytes to copy. |
5107 Label last_bytes; | 5108 Label last_bytes; |
5108 __ testl(count, Immediate(~7)); | 5109 __ testl(count, Immediate(~(kPointerSize - 1))); |
5109 __ j(zero, &last_bytes, Label::kNear); | 5110 __ j(zero, &last_bytes, Label::kNear); |
5110 | 5111 |
5111 // Copy from edi to esi using rep movs instruction. | 5112 // Copy from edi to esi using rep movs instruction. |
5112 __ movl(kScratchRegister, count); | 5113 __ movl(kScratchRegister, count); |
5113 __ shr(count, Immediate(3)); // Number of doublewords to copy. | 5114 __ shr(count, Immediate(kPointerSizeLog2)); // Number of doublewords to copy. |
5114 __ repmovsq(); | 5115 __ repmovsq(); |
5115 | 5116 |
5116 // Find number of bytes left. | 5117 // Find number of bytes left. |
5117 __ movl(count, kScratchRegister); | 5118 __ movl(count, kScratchRegister); |
5118 __ and_(count, Immediate(7)); | 5119 __ and_(count, Immediate(kPointerSize - 1)); |
5119 | 5120 |
5120 // Check if there are more bytes to copy. | 5121 // Check if there are more bytes to copy. |
5121 __ bind(&last_bytes); | 5122 __ bind(&last_bytes); |
5122 __ testl(count, count); | 5123 __ testl(count, count); |
5123 __ j(zero, &done, Label::kNear); | 5124 __ j(zero, &done, Label::kNear); |
5124 | 5125 |
5125 // Copy remaining characters. | 5126 // Copy remaining characters. |
5126 Label loop; | 5127 Label loop; |
5127 __ bind(&loop); | 5128 __ bind(&loop); |
5128 __ movb(kScratchRegister, Operand(src, 0)); | 5129 __ movb(kScratchRegister, Operand(src, 0)); |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 __ bind(&fast_elements_case); | 7025 __ bind(&fast_elements_case); |
7025 GenerateCase(masm, FAST_ELEMENTS); | 7026 GenerateCase(masm, FAST_ELEMENTS); |
7026 } | 7027 } |
7027 | 7028 |
7028 | 7029 |
7029 #undef __ | 7030 #undef __ |
7030 | 7031 |
7031 } } // namespace v8::internal | 7032 } } // namespace v8::internal |
7032 | 7033 |
7033 #endif // V8_TARGET_ARCH_X64 | 7034 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |