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/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
(...skipping 4191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4202 case MethodRecognizer::kDoubleMod: | 4202 case MethodRecognizer::kDoubleMod: |
4203 case MethodRecognizer::kMathDoublePow: | 4203 case MethodRecognizer::kMathDoublePow: |
4204 case MethodRecognizer::kMathAtan2: | 4204 case MethodRecognizer::kMathAtan2: |
4205 return 2; | 4205 return 2; |
4206 default: | 4206 default: |
4207 UNREACHABLE(); | 4207 UNREACHABLE(); |
4208 } | 4208 } |
4209 return 0; | 4209 return 0; |
4210 } | 4210 } |
4211 | 4211 |
4212 // Use expected function signatures to help MSVC compiler resolve overloading. | |
4213 typedef double (*UnaryMathCFunction)(double x); | |
4214 typedef double (*BinaryMathCFunction)(double x, double y); | |
4215 | |
4216 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4217 LibcPow, | |
4218 2, | |
4219 true /* is_float */, | |
4220 reinterpret_cast<RuntimeFunction>(static_cast<BinaryMathCFunction>(&pow))); | |
4221 | |
4222 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4223 DartModulo, | |
4224 2, | |
4225 true /* is_float */, | |
4226 reinterpret_cast<RuntimeFunction>( | |
4227 static_cast<BinaryMathCFunction>(&DartModulo))); | |
4228 | |
4229 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4230 LibcAtan2, | |
4231 2, | |
4232 true /* is_float */, | |
4233 reinterpret_cast<RuntimeFunction>( | |
4234 static_cast<BinaryMathCFunction>(&atan2_ieee))); | |
4235 | |
4236 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4237 LibcFloor, | |
4238 1, | |
4239 true /* is_float */, | |
4240 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&floor))); | |
4241 | |
4242 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4243 LibcCeil, | |
4244 1, | |
4245 true /* is_float */, | |
4246 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&ceil))); | |
4247 | |
4248 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4249 LibcTrunc, | |
4250 1, | |
4251 true /* is_float */, | |
4252 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&trunc))); | |
4253 | |
4254 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4255 LibcRound, | |
4256 1, | |
4257 true /* is_float */, | |
4258 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&round))); | |
4259 | |
4260 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4261 LibcCos, | |
4262 1, | |
4263 true /* is_float */, | |
4264 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&cos))); | |
4265 | |
4266 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4267 LibcSin, | |
4268 1, | |
4269 true /* is_float */, | |
4270 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&sin))); | |
4271 | |
4272 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4273 LibcAsin, | |
4274 1, | |
4275 true /* is_float */, | |
4276 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&asin))); | |
4277 | |
4278 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4279 LibcAcos, | |
4280 1, | |
4281 true /* is_float */, | |
4282 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&acos))); | |
4283 | |
4284 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4285 LibcTan, | |
4286 1, | |
4287 true /* is_float */, | |
4288 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&tan))); | |
4289 | |
4290 DEFINE_RAW_LEAF_RUNTIME_ENTRY( | |
4291 LibcAtan, | |
4292 1, | |
4293 true /* is_float */, | |
4294 reinterpret_cast<RuntimeFunction>(static_cast<UnaryMathCFunction>(&atan))); | |
4295 | |
4296 | 4212 |
4297 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { | 4213 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { |
4298 switch (recognized_kind_) { | 4214 switch (recognized_kind_) { |
4299 case MethodRecognizer::kDoubleTruncate: | 4215 case MethodRecognizer::kDoubleTruncate: |
4300 return kLibcTruncRuntimeEntry; | 4216 return kLibcTruncRuntimeEntry; |
4301 case MethodRecognizer::kDoubleRound: | 4217 case MethodRecognizer::kDoubleRound: |
4302 return kLibcRoundRuntimeEntry; | 4218 return kLibcRoundRuntimeEntry; |
4303 case MethodRecognizer::kDoubleFloor: | 4219 case MethodRecognizer::kDoubleFloor: |
4304 return kLibcFloorRuntimeEntry; | 4220 return kLibcFloorRuntimeEntry; |
4305 case MethodRecognizer::kDoubleCeil: | 4221 case MethodRecognizer::kDoubleCeil: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4393 "native function '%s' (%" Pd " arguments) cannot be found", | 4309 "native function '%s' (%" Pd " arguments) cannot be found", |
4394 native_name().ToCString(), function().NumParameters()); | 4310 native_name().ToCString(), function().NumParameters()); |
4395 } | 4311 } |
4396 set_is_auto_scope(auto_setup_scope); | 4312 set_is_auto_scope(auto_setup_scope); |
4397 set_native_c_function(native_function); | 4313 set_native_c_function(native_function); |
4398 } | 4314 } |
4399 | 4315 |
4400 #undef __ | 4316 #undef __ |
4401 | 4317 |
4402 } // namespace dart | 4318 } // namespace dart |
OLD | NEW |