| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
| (...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 static const struct ALIGN16 { | 2074 static const struct ALIGN16 { |
| 2075 uint64_t a; | 2075 uint64_t a; |
| 2076 uint64_t b; | 2076 uint64_t b; |
| 2077 } double_abs_constant = | 2077 } double_abs_constant = |
| 2078 {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}; | 2078 {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}; |
| 2079 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&double_abs_constant))); | 2079 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&double_abs_constant))); |
| 2080 andpd(reg, Address(TMP, 0)); | 2080 andpd(reg, Address(TMP, 0)); |
| 2081 } | 2081 } |
| 2082 | 2082 |
| 2083 | 2083 |
| 2084 void Assembler::DoubleRound(XmmRegister dst, XmmRegister src, XmmRegister tmp) { | |
| 2085 ASSERT(tmp != src); | |
| 2086 static double kZeroFiveConst = 0.5; | |
| 2087 static double kNegZeroFiveConst = -0.5; | |
| 2088 static double kOneConst = 1.0; | |
| 2089 static double kNegOneConst = -1.0; | |
| 2090 Label is_negative, round; | |
| 2091 if (src != dst) { | |
| 2092 movsd(dst, src); | |
| 2093 } | |
| 2094 // Special handling: 0.5 -> 1.0, -0.5 -> -1.0; | |
| 2095 Label done, equal_point5, equal_neg_point5; | |
| 2096 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&kZeroFiveConst))); | |
| 2097 movsd(tmp, Address(TMP, 0)); | |
| 2098 comisd(tmp, dst); | |
| 2099 j(EQUAL, &equal_point5, Assembler::kNearJump); | |
| 2100 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&kNegZeroFiveConst))); | |
| 2101 movsd(tmp, Address(TMP, 0)); | |
| 2102 comisd(tmp, dst); | |
| 2103 j(EQUAL, &equal_neg_point5, Assembler::kNearJump); | |
| 2104 | |
| 2105 roundsd(dst, dst, Assembler::kRoundToNearest); | |
| 2106 jmp(&done, Assembler::kNearJump); | |
| 2107 | |
| 2108 Bind(&equal_point5); | |
| 2109 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&kOneConst))); | |
| 2110 movsd(dst, Address(TMP, 0)); | |
| 2111 jmp(&done); | |
| 2112 | |
| 2113 Bind(&equal_neg_point5); | |
| 2114 movq(TMP, Immediate(reinterpret_cast<intptr_t>(&kNegOneConst))); | |
| 2115 movsd(dst, Address(TMP, 0)); | |
| 2116 Bind(&done); | |
| 2117 } | |
| 2118 | |
| 2119 | |
| 2120 void Assembler::Stop(const char* message) { | 2084 void Assembler::Stop(const char* message) { |
| 2121 int64_t message_address = reinterpret_cast<int64_t>(message); | 2085 int64_t message_address = reinterpret_cast<int64_t>(message); |
| 2122 if (FLAG_print_stop_message) { | 2086 if (FLAG_print_stop_message) { |
| 2123 pushq(TMP); // Preserve TMP register. | 2087 pushq(TMP); // Preserve TMP register. |
| 2124 pushq(RDI); // Preserve RDI register. | 2088 pushq(RDI); // Preserve RDI register. |
| 2125 movq(RDI, Immediate(message_address)); | 2089 movq(RDI, Immediate(message_address)); |
| 2126 call(&StubCode::PrintStopMessageLabel()); | 2090 call(&StubCode::PrintStopMessageLabel()); |
| 2127 popq(RDI); // Restore RDI register. | 2091 popq(RDI); // Restore RDI register. |
| 2128 popq(TMP); // Restore TMP register. | 2092 popq(TMP); // Restore TMP register. |
| 2129 } else { | 2093 } else { |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 | 2405 |
| 2442 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2406 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 2443 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2407 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 2444 return xmm_reg_names[reg]; | 2408 return xmm_reg_names[reg]; |
| 2445 } | 2409 } |
| 2446 | 2410 |
| 2447 | 2411 |
| 2448 } // namespace dart | 2412 } // namespace dart |
| 2449 | 2413 |
| 2450 #endif // defined TARGET_ARCH_X64 | 2414 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |