@@ -962,177 +962,109 @@ bool GraphIntrinsifier::Build_DoubleFlipSignBit(FlowGraph* flow_graph) {
962
962
return true ;
963
963
}
964
964
965
- static bool BuildInvokeMathCFunction (BlockBuilder* builder ,
965
+ static bool BuildInvokeMathCFunction (FlowGraph* flow_graph ,
966
966
MethodRecognizer::Kind kind,
967
- FlowGraph* flow_graph,
968
967
intptr_t num_parameters = 1 ) {
969
968
if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) {
970
969
return false ;
971
970
}
971
+
972
+ GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
973
+ auto normal_entry = graph_entry->normal_entry ();
974
+ BlockBuilder builder (flow_graph, normal_entry);
975
+
972
976
ZoneGrowableArray<Value*>* args =
973
977
new ZoneGrowableArray<Value*>(num_parameters);
974
978
975
979
for (intptr_t i = 0 ; i < num_parameters; i++) {
976
- Definition* value = builder-> AddParameter (i, /* with_frame=*/ false );
980
+ Definition* value = builder. AddParameter (i, /* with_frame=*/ false );
977
981
Definition* unboxed_value = ConvertOrUnboxDoubleParameter (
978
- builder, value, i, /* is_checked = */ false );
982
+ & builder, value, i, /* is_checked = */ false );
979
983
if (unboxed_value == nullptr ) {
980
984
return false ;
981
985
}
982
986
args->Add (new Value (unboxed_value));
983
987
}
984
988
985
989
Definition* unboxed_result =
986
- builder-> AddDefinition (new InvokeMathCFunctionInstr (
987
- args, DeoptId::kNone , kind, builder-> Source ()));
990
+ builder. AddDefinition (new InvokeMathCFunctionInstr (
991
+ args, DeoptId::kNone , kind, builder. Source ()));
988
992
Definition* result =
989
- CreateBoxedResultIfNeeded (builder, unboxed_result, kUnboxedDouble );
990
- builder-> AddReturn (new Value (result));
993
+ CreateBoxedResultIfNeeded (& builder, unboxed_result, kUnboxedDouble );
994
+ builder. AddReturn (new Value (result));
991
995
992
996
return true ;
993
997
}
994
998
995
999
bool GraphIntrinsifier::Build_MathSin (FlowGraph* flow_graph) {
996
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
997
-
998
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
999
- auto normal_entry = graph_entry->normal_entry ();
1000
- BlockBuilder builder (flow_graph, normal_entry);
1001
-
1002
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kMathSin ,
1003
- flow_graph);
1000
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathSin );
1004
1001
}
1005
1002
1006
1003
bool GraphIntrinsifier::Build_MathCos (FlowGraph* flow_graph) {
1007
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1008
-
1009
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1010
- auto normal_entry = graph_entry->normal_entry ();
1011
- BlockBuilder builder (flow_graph, normal_entry);
1012
-
1013
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kMathCos ,
1014
- flow_graph);
1004
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathCos );
1015
1005
}
1016
1006
1017
1007
bool GraphIntrinsifier::Build_MathTan (FlowGraph* flow_graph) {
1018
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1019
-
1020
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1021
- auto normal_entry = graph_entry->normal_entry ();
1022
- BlockBuilder builder (flow_graph, normal_entry);
1023
-
1024
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kMathTan ,
1025
- flow_graph);
1008
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathTan );
1026
1009
}
1027
1010
1028
1011
bool GraphIntrinsifier::Build_MathAsin (FlowGraph* flow_graph) {
1029
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1030
-
1031
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1032
- auto normal_entry = graph_entry->normal_entry ();
1033
- BlockBuilder builder (flow_graph, normal_entry);
1034
-
1035
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kMathAsin ,
1036
- flow_graph);
1012
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathAsin );
1037
1013
}
1038
1014
1039
1015
bool GraphIntrinsifier::Build_MathAcos (FlowGraph* flow_graph) {
1040
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1041
-
1042
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1043
- auto normal_entry = graph_entry->normal_entry ();
1044
- BlockBuilder builder (flow_graph, normal_entry);
1045
-
1046
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kMathAcos ,
1047
- flow_graph);
1016
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathAcos );
1048
1017
}
1049
1018
1050
1019
bool GraphIntrinsifier::Build_MathAtan (FlowGraph* flow_graph) {
1051
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1052
-
1053
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1054
- auto normal_entry = graph_entry->normal_entry ();
1055
- BlockBuilder builder (flow_graph, normal_entry);
1056
-
1057
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kMathAtan ,
1058
- flow_graph);
1020
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathAtan );
1059
1021
}
1060
1022
1061
1023
bool GraphIntrinsifier::Build_MathAtan2 (FlowGraph* flow_graph) {
1062
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1063
-
1064
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1065
- auto normal_entry = graph_entry->normal_entry ();
1066
- BlockBuilder builder (flow_graph, normal_entry);
1067
-
1068
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kMathAtan2 ,
1069
- flow_graph,
1024
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathAtan2 ,
1070
1025
/* num_parameters = */ 2 );
1071
1026
}
1072
1027
1073
- bool GraphIntrinsifier::Build_DoubleMod (FlowGraph* flow_graph) {
1074
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1028
+ bool GraphIntrinsifier::Build_MathExp (FlowGraph* flow_graph) {
1029
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kMathExp );
1030
+ }
1075
1031
1076
- GraphEntryInstr* graph_entry = flow_graph-> graph_entry ();
1077
- auto normal_entry = graph_entry-> normal_entry ( );
1078
- BlockBuilder builder (flow_graph, normal_entry);
1032
+ bool GraphIntrinsifier::Build_MathLog (FlowGraph* flow_graph) {
1033
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer:: kMathLog );
1034
+ }
1079
1035
1080
- return BuildInvokeMathCFunction (&builder, MethodRecognizer:: kDoubleMod ,
1081
- flow_graph,
1036
+ bool GraphIntrinsifier::Build_DoubleMod (FlowGraph* flow_graph) {
1037
+ return BuildInvokeMathCFunction ( flow_graph, MethodRecognizer:: kDoubleMod ,
1082
1038
/* num_parameters = */ 2 );
1083
1039
}
1084
1040
1085
1041
bool GraphIntrinsifier::Build_DoubleCeil (FlowGraph* flow_graph) {
1086
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1087
1042
// TODO(johnmccutchan): On X86 this intrinsic can be written in a different
1088
1043
// way.
1089
1044
if (TargetCPUFeatures::double_truncate_round_supported ()) return false ;
1090
1045
1091
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1092
- auto normal_entry = graph_entry->normal_entry ();
1093
- BlockBuilder builder (flow_graph, normal_entry);
1094
-
1095
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kDoubleCeil ,
1096
- flow_graph);
1046
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kDoubleCeil );
1097
1047
}
1098
1048
1099
1049
bool GraphIntrinsifier::Build_DoubleFloor (FlowGraph* flow_graph) {
1100
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1101
1050
// TODO(johnmccutchan): On X86 this intrinsic can be written in a different
1102
1051
// way.
1103
1052
if (TargetCPUFeatures::double_truncate_round_supported ()) return false ;
1104
1053
1105
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1106
- auto normal_entry = graph_entry->normal_entry ();
1107
- BlockBuilder builder (flow_graph, normal_entry);
1108
-
1109
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kDoubleFloor ,
1110
- flow_graph);
1054
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kDoubleFloor );
1111
1055
}
1112
1056
1113
1057
bool GraphIntrinsifier::Build_DoubleTruncate (FlowGraph* flow_graph) {
1114
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1115
1058
// TODO(johnmccutchan): On X86 this intrinsic can be written in a different
1116
1059
// way.
1117
1060
if (TargetCPUFeatures::double_truncate_round_supported ()) return false ;
1118
1061
1119
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1120
- auto normal_entry = graph_entry->normal_entry ();
1121
- BlockBuilder builder (flow_graph, normal_entry);
1122
-
1123
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kDoubleTruncate ,
1124
- flow_graph);
1062
+ return BuildInvokeMathCFunction (flow_graph,
1063
+ MethodRecognizer::kDoubleTruncate );
1125
1064
}
1126
1065
1127
1066
bool GraphIntrinsifier::Build_DoubleRound (FlowGraph* flow_graph) {
1128
- if (!FlowGraphCompiler::SupportsUnboxedDoubles ()) return false ;
1129
-
1130
- GraphEntryInstr* graph_entry = flow_graph->graph_entry ();
1131
- auto normal_entry = graph_entry->normal_entry ();
1132
- BlockBuilder builder (flow_graph, normal_entry);
1133
-
1134
- return BuildInvokeMathCFunction (&builder, MethodRecognizer::kDoubleRound ,
1135
- flow_graph);
1067
+ return BuildInvokeMathCFunction (flow_graph, MethodRecognizer::kDoubleRound );
1136
1068
}
1137
1069
1138
1070
bool GraphIntrinsifier::Build_ImplicitGetter (FlowGraph* flow_graph) {
0 commit comments