Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: runtime/vm/intermediate_language.cc

Issue 12038013: Reland r17365. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: replace enter with EnterFrame Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 0c8c52166fa61ab027b70e025dbce49e3690b957..f7b4b0385bb95761fa11e31514bb098a0650f66e 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1550,6 +1550,11 @@ RawAbstractType* DoubleToDoubleInstr::CompileType() const {
}
+RawAbstractType* InvokeMathCFunctionInstr::CompileType() const {
+ return Type::Double();
+}
+
+
RawAbstractType* CheckClassInstr::CompileType() const {
return AbstractType::null();
}
@@ -2616,6 +2621,69 @@ intptr_t CheckArrayBoundInstr::LengthOffsetFor(intptr_t class_id) {
}
}
+
+intptr_t InvokeMathCFunctionInstr::ArgumentCountFor(
+ MethodRecognizer::Kind kind) {
+ switch (kind) {
+ case MethodRecognizer::kDoubleTruncate:
+ case MethodRecognizer::kDoubleRound:
+ case MethodRecognizer::kDoubleFloor:
+ case MethodRecognizer::kDoubleCeil: {
+ ASSERT(!CPUFeatures::double_truncate_round_supported());
+ return 1;
+ }
+ case MethodRecognizer::kDoublePow:
+ return 2;
+ default:
+ UNREACHABLE();
+ }
+ return 0;
+}
+
+// Use expected function signatures to help MSVC compiler resolve overloading.
+typedef double (*UnaryMathCFunction) (double x);
+typedef double (*BinaryMathCFunction) (double x, double y);
+
+extern const RuntimeEntry kPowRuntimeEntry(
+ "libc_pow", reinterpret_cast<RuntimeFunction>(
+ static_cast<BinaryMathCFunction>(&pow)), 0, true);
+
+extern const RuntimeEntry kFloorRuntimeEntry(
+ "libc_floor", reinterpret_cast<RuntimeFunction>(
+ static_cast<UnaryMathCFunction>(&floor)), 0, true);
+
+extern const RuntimeEntry kCeilRuntimeEntry(
+ "libc_ceil", reinterpret_cast<RuntimeFunction>(
+ static_cast<UnaryMathCFunction>(&ceil)), 0, true);
+
+extern const RuntimeEntry kTruncRuntimeEntry(
+ "libc_trunc", reinterpret_cast<RuntimeFunction>(
+ static_cast<UnaryMathCFunction>(&trunc)), 0, true);
+
+extern const RuntimeEntry kRoundRuntimeEntry(
+ "libc_round", reinterpret_cast<RuntimeFunction>(
+ static_cast<UnaryMathCFunction>(&round)), 0, true);
+
+
+const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const {
+ switch (recognized_kind_) {
+ case MethodRecognizer::kDoubleTruncate:
+ return kTruncRuntimeEntry;
+ case MethodRecognizer::kDoubleRound:
+ return kRoundRuntimeEntry;
+ case MethodRecognizer::kDoubleFloor:
+ return kFloorRuntimeEntry;
+ case MethodRecognizer::kDoubleCeil:
+ return kCeilRuntimeEntry;
+ case MethodRecognizer::kDoublePow:
+ return kPowRuntimeEntry;
+ default:
+ UNREACHABLE();
+ }
+ return kPowRuntimeEntry;
+}
+
+
#undef __
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698