| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Class for intrinsifying functions. | 4 // Class for intrinsifying functions. |
| 5 | 5 |
| 6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/cpu.h" |
| 8 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 9 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
| 10 #include "vm/flow_graph_compiler.h" | 11 #include "vm/flow_graph_compiler.h" |
| 11 #include "vm/flow_graph_allocator.h" | 12 #include "vm/flow_graph_allocator.h" |
| 12 #include "vm/flow_graph_builder.h" | 13 #include "vm/flow_graph_builder.h" |
| 13 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
| 14 #include "vm/intermediate_language.h" | 15 #include "vm/intermediate_language.h" |
| 15 #include "vm/intrinsifier.h" | 16 #include "vm/intrinsifier.h" |
| 16 #include "vm/object.h" | 17 #include "vm/object.h" |
| 17 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 BlockBuilder builder(flow_graph, normal_entry); | 1078 BlockBuilder builder(flow_graph, normal_entry); |
| 1078 | 1079 |
| 1079 return BuildInvokeMathCFunction(&builder, | 1080 return BuildInvokeMathCFunction(&builder, |
| 1080 MethodRecognizer::kDoubleMod, | 1081 MethodRecognizer::kDoubleMod, |
| 1081 /* num_parameters = */ 2); | 1082 /* num_parameters = */ 2); |
| 1082 } | 1083 } |
| 1083 | 1084 |
| 1084 | 1085 |
| 1085 bool Intrinsifier::Build_DoubleCeil(FlowGraph* flow_graph) { | 1086 bool Intrinsifier::Build_DoubleCeil(FlowGraph* flow_graph) { |
| 1086 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; | 1087 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; |
| 1088 // TODO(johnmccutchan): On X86 this intrinsic can be written in a different |
| 1089 // way. |
| 1090 if (TargetCPUFeatures::double_truncate_round_supported()) return false; |
| 1087 | 1091 |
| 1088 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); | 1092 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
| 1089 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1093 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 1090 BlockBuilder builder(flow_graph, normal_entry); | 1094 BlockBuilder builder(flow_graph, normal_entry); |
| 1091 | 1095 |
| 1092 return BuildInvokeMathCFunction(&builder, | 1096 return BuildInvokeMathCFunction(&builder, |
| 1093 MethodRecognizer::kDoubleCeil); | 1097 MethodRecognizer::kDoubleCeil); |
| 1094 } | 1098 } |
| 1095 | 1099 |
| 1096 | 1100 |
| 1097 bool Intrinsifier::Build_DoubleFloor(FlowGraph* flow_graph) { | 1101 bool Intrinsifier::Build_DoubleFloor(FlowGraph* flow_graph) { |
| 1098 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; | 1102 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; |
| 1103 // TODO(johnmccutchan): On X86 this intrinsic can be written in a different |
| 1104 // way. |
| 1105 if (TargetCPUFeatures::double_truncate_round_supported()) return false; |
| 1099 | 1106 |
| 1100 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); | 1107 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
| 1101 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1108 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 1102 BlockBuilder builder(flow_graph, normal_entry); | 1109 BlockBuilder builder(flow_graph, normal_entry); |
| 1103 | 1110 |
| 1104 return BuildInvokeMathCFunction(&builder, | 1111 return BuildInvokeMathCFunction(&builder, |
| 1105 MethodRecognizer::kDoubleFloor); | 1112 MethodRecognizer::kDoubleFloor); |
| 1106 } | 1113 } |
| 1107 | 1114 |
| 1108 | 1115 |
| 1109 bool Intrinsifier::Build_DoubleTruncate(FlowGraph* flow_graph) { | 1116 bool Intrinsifier::Build_DoubleTruncate(FlowGraph* flow_graph) { |
| 1110 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; | 1117 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; |
| 1118 // TODO(johnmccutchan): On X86 this intrinsic can be written in a different |
| 1119 // way. |
| 1120 if (TargetCPUFeatures::double_truncate_round_supported()) return false; |
| 1111 | 1121 |
| 1112 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); | 1122 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
| 1113 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1123 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 1114 BlockBuilder builder(flow_graph, normal_entry); | 1124 BlockBuilder builder(flow_graph, normal_entry); |
| 1115 | 1125 |
| 1116 return BuildInvokeMathCFunction(&builder, | 1126 return BuildInvokeMathCFunction(&builder, |
| 1117 MethodRecognizer::kDoubleTruncate); | 1127 MethodRecognizer::kDoubleTruncate); |
| 1118 } | 1128 } |
| 1119 | 1129 |
| 1120 | 1130 |
| 1121 bool Intrinsifier::Build_DoubleRound(FlowGraph* flow_graph) { | 1131 bool Intrinsifier::Build_DoubleRound(FlowGraph* flow_graph) { |
| 1122 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; | 1132 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) return false; |
| 1123 | 1133 |
| 1124 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); | 1134 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
| 1125 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1135 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 1126 BlockBuilder builder(flow_graph, normal_entry); | 1136 BlockBuilder builder(flow_graph, normal_entry); |
| 1127 | 1137 |
| 1128 return BuildInvokeMathCFunction(&builder, | 1138 return BuildInvokeMathCFunction(&builder, |
| 1129 MethodRecognizer::kDoubleRound); | 1139 MethodRecognizer::kDoubleRound); |
| 1130 } | 1140 } |
| 1131 | 1141 |
| 1132 } // namespace dart | 1142 } // namespace dart |
| OLD | NEW |