| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 intptr_t InvokeMathCFunctionInstr::ArgumentCountFor( | 2625 intptr_t InvokeMathCFunctionInstr::ArgumentCountFor( |
| 2626 MethodRecognizer::Kind kind) { | 2626 MethodRecognizer::Kind kind) { |
| 2627 switch (kind) { | 2627 switch (kind) { |
| 2628 case MethodRecognizer::kDoubleTruncate: | 2628 case MethodRecognizer::kDoubleTruncate: |
| 2629 case MethodRecognizer::kDoubleRound: | 2629 case MethodRecognizer::kDoubleRound: |
| 2630 case MethodRecognizer::kDoubleFloor: | 2630 case MethodRecognizer::kDoubleFloor: |
| 2631 case MethodRecognizer::kDoubleCeil: { | 2631 case MethodRecognizer::kDoubleCeil: { |
| 2632 ASSERT(!CPUFeatures::double_truncate_round_supported()); | 2632 ASSERT(!CPUFeatures::double_truncate_round_supported()); |
| 2633 return 1; | 2633 return 1; |
| 2634 } | 2634 } |
| 2635 case MethodRecognizer::kDoubleMod: |
| 2635 case MethodRecognizer::kDoublePow: | 2636 case MethodRecognizer::kDoublePow: |
| 2636 return 2; | 2637 return 2; |
| 2637 default: | 2638 default: |
| 2638 UNREACHABLE(); | 2639 UNREACHABLE(); |
| 2639 } | 2640 } |
| 2640 return 0; | 2641 return 0; |
| 2641 } | 2642 } |
| 2642 | 2643 |
| 2643 // Use expected function signatures to help MSVC compiler resolve overloading. | 2644 // Use expected function signatures to help MSVC compiler resolve overloading. |
| 2644 typedef double (*UnaryMathCFunction) (double x); | 2645 typedef double (*UnaryMathCFunction) (double x); |
| 2645 typedef double (*BinaryMathCFunction) (double x, double y); | 2646 typedef double (*BinaryMathCFunction) (double x, double y); |
| 2646 | 2647 |
| 2647 extern const RuntimeEntry kPowRuntimeEntry( | 2648 extern const RuntimeEntry kPowRuntimeEntry( |
| 2648 "libc_pow", reinterpret_cast<RuntimeFunction>( | 2649 "libc_pow", reinterpret_cast<RuntimeFunction>( |
| 2649 static_cast<BinaryMathCFunction>(&pow)), 0, true); | 2650 static_cast<BinaryMathCFunction>(&pow)), 0, true); |
| 2650 | 2651 |
| 2652 extern const RuntimeEntry kModRuntimeEntry( |
| 2653 "libc_fmod", reinterpret_cast<RuntimeFunction>( |
| 2654 static_cast<BinaryMathCFunction>(&fmod)), 0, true); |
| 2655 |
| 2651 extern const RuntimeEntry kFloorRuntimeEntry( | 2656 extern const RuntimeEntry kFloorRuntimeEntry( |
| 2652 "libc_floor", reinterpret_cast<RuntimeFunction>( | 2657 "libc_floor", reinterpret_cast<RuntimeFunction>( |
| 2653 static_cast<UnaryMathCFunction>(&floor)), 0, true); | 2658 static_cast<UnaryMathCFunction>(&floor)), 0, true); |
| 2654 | 2659 |
| 2655 extern const RuntimeEntry kCeilRuntimeEntry( | 2660 extern const RuntimeEntry kCeilRuntimeEntry( |
| 2656 "libc_ceil", reinterpret_cast<RuntimeFunction>( | 2661 "libc_ceil", reinterpret_cast<RuntimeFunction>( |
| 2657 static_cast<UnaryMathCFunction>(&ceil)), 0, true); | 2662 static_cast<UnaryMathCFunction>(&ceil)), 0, true); |
| 2658 | 2663 |
| 2659 extern const RuntimeEntry kTruncRuntimeEntry( | 2664 extern const RuntimeEntry kTruncRuntimeEntry( |
| 2660 "libc_trunc", reinterpret_cast<RuntimeFunction>( | 2665 "libc_trunc", reinterpret_cast<RuntimeFunction>( |
| 2661 static_cast<UnaryMathCFunction>(&trunc)), 0, true); | 2666 static_cast<UnaryMathCFunction>(&trunc)), 0, true); |
| 2662 | 2667 |
| 2663 extern const RuntimeEntry kRoundRuntimeEntry( | 2668 extern const RuntimeEntry kRoundRuntimeEntry( |
| 2664 "libc_round", reinterpret_cast<RuntimeFunction>( | 2669 "libc_round", reinterpret_cast<RuntimeFunction>( |
| 2665 static_cast<UnaryMathCFunction>(&round)), 0, true); | 2670 static_cast<UnaryMathCFunction>(&round)), 0, true); |
| 2666 | 2671 |
| 2667 | 2672 |
| 2668 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { | 2673 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { |
| 2669 switch (recognized_kind_) { | 2674 switch (recognized_kind_) { |
| 2670 case MethodRecognizer::kDoubleTruncate: | 2675 case MethodRecognizer::kDoubleTruncate: |
| 2671 return kTruncRuntimeEntry; | 2676 return kTruncRuntimeEntry; |
| 2672 case MethodRecognizer::kDoubleRound: | 2677 case MethodRecognizer::kDoubleRound: |
| 2673 return kRoundRuntimeEntry; | 2678 return kRoundRuntimeEntry; |
| 2674 case MethodRecognizer::kDoubleFloor: | 2679 case MethodRecognizer::kDoubleFloor: |
| 2675 return kFloorRuntimeEntry; | 2680 return kFloorRuntimeEntry; |
| 2676 case MethodRecognizer::kDoubleCeil: | 2681 case MethodRecognizer::kDoubleCeil: |
| 2677 return kCeilRuntimeEntry; | 2682 return kCeilRuntimeEntry; |
| 2678 case MethodRecognizer::kDoublePow: | 2683 case MethodRecognizer::kDoublePow: |
| 2679 return kPowRuntimeEntry; | 2684 return kPowRuntimeEntry; |
| 2685 case MethodRecognizer::kDoubleMod: |
| 2686 return kModRuntimeEntry; |
| 2680 default: | 2687 default: |
| 2681 UNREACHABLE(); | 2688 UNREACHABLE(); |
| 2682 } | 2689 } |
| 2683 return kPowRuntimeEntry; | 2690 return kPowRuntimeEntry; |
| 2684 } | 2691 } |
| 2685 | 2692 |
| 2686 | 2693 |
| 2687 #undef __ | 2694 #undef __ |
| 2688 | 2695 |
| 2689 } // namespace dart | 2696 } // namespace dart |
| OLD | NEW |