| 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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2554 // Check for overflow and that it fits into Smi. | 2554 // Check for overflow and that it fits into Smi. |
| 2555 __ movq(temp, result); | 2555 __ movq(temp, result); |
| 2556 __ shlq(temp, Immediate(1)); | 2556 __ shlq(temp, Immediate(1)); |
| 2557 __ j(OVERFLOW, deopt); | 2557 __ j(OVERFLOW, deopt); |
| 2558 __ SmiTag(result); | 2558 __ SmiTag(result); |
| 2559 } | 2559 } |
| 2560 | 2560 |
| 2561 | 2561 |
| 2562 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const { | 2562 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const { |
| 2563 const intptr_t kNumInputs = 1; | 2563 const intptr_t kNumInputs = 1; |
| 2564 const intptr_t kNumTemps = | 2564 const intptr_t kNumTemps = 0; |
| 2565 (recognized_kind() == MethodRecognizer::kDoubleRound) ? 1 : 0; | |
| 2566 LocationSummary* result = | 2565 LocationSummary* result = |
| 2567 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2566 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2568 result->set_in(0, Location::RequiresFpuRegister()); | 2567 result->set_in(0, Location::RequiresFpuRegister()); |
| 2569 result->set_out(Location::RequiresFpuRegister()); | 2568 result->set_out(Location::RequiresFpuRegister()); |
| 2570 if (recognized_kind() == MethodRecognizer::kDoubleRound) { | |
| 2571 result->set_temp(0, Location::RequiresFpuRegister()); | |
| 2572 } | |
| 2573 return result; | 2569 return result; |
| 2574 } | 2570 } |
| 2575 | 2571 |
| 2576 | 2572 |
| 2577 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2573 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2578 XmmRegister value = locs()->in(0).fpu_reg(); | 2574 XmmRegister value = locs()->in(0).fpu_reg(); |
| 2579 XmmRegister result = locs()->out().fpu_reg(); | 2575 XmmRegister result = locs()->out().fpu_reg(); |
| 2580 switch (recognized_kind()) { | 2576 switch (recognized_kind()) { |
| 2581 case MethodRecognizer::kDoubleTruncate: | 2577 case MethodRecognizer::kDoubleTruncate: |
| 2582 __ roundsd(result, value, Assembler::kRoundToZero); | 2578 __ roundsd(result, value, Assembler::kRoundToZero); |
| 2583 break; | 2579 break; |
| 2584 case MethodRecognizer::kDoubleFloor: | 2580 case MethodRecognizer::kDoubleFloor: |
| 2585 __ roundsd(result, value, Assembler::kRoundDown); | 2581 __ roundsd(result, value, Assembler::kRoundDown); |
| 2586 break; | 2582 break; |
| 2587 case MethodRecognizer::kDoubleCeil: | 2583 case MethodRecognizer::kDoubleCeil: |
| 2588 __ roundsd(result, value, Assembler::kRoundUp); | 2584 __ roundsd(result, value, Assembler::kRoundUp); |
| 2589 break; | 2585 break; |
| 2590 case MethodRecognizer::kDoubleRound: { | |
| 2591 XmmRegister temp = locs()->temp(0).fpu_reg(); | |
| 2592 __ DoubleRound(result, value, temp); | |
| 2593 break; | |
| 2594 } | |
| 2595 default: | 2586 default: |
| 2596 UNREACHABLE(); | 2587 UNREACHABLE(); |
| 2597 } | 2588 } |
| 2598 } | 2589 } |
| 2599 | 2590 |
| 2600 | 2591 |
| 2601 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { | 2592 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { |
| 2602 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two | 2593 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two |
| 2603 // double arguments and XMM0 to return the result. Unfortunately | 2594 // double arguments and XMM0 to return the result. Unfortunately |
| 2604 // currently we can't specify these registers because ParallelMoveResolver | 2595 // currently we can't specify these registers because ParallelMoveResolver |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3169 PcDescriptors::kOther, | 3160 PcDescriptors::kOther, |
| 3170 locs()); | 3161 locs()); |
| 3171 __ Drop(2); // Discard type arguments and receiver. | 3162 __ Drop(2); // Discard type arguments and receiver. |
| 3172 } | 3163 } |
| 3173 | 3164 |
| 3174 } // namespace dart | 3165 } // namespace dart |
| 3175 | 3166 |
| 3176 #undef __ | 3167 #undef __ |
| 3177 | 3168 |
| 3178 #endif // defined TARGET_ARCH_X64 | 3169 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |