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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2162173002: DBC: Misc double instructions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Make test deopt Created 4 years, 5 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
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_dbc.cc
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index 757e54b1756934d703cee642f929052b8234b053..22b159f9c13dea18140f57b85bd63ed01853de21 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -1710,6 +1710,22 @@ RawObject* Simulator::Call(const Code& code,
DISPATCH();
}
+ {
+ BYTECODE(Min, A_B_C);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]);
+ FP[rA] = reinterpret_cast<RawObject*>((lhs < rhs) ? lhs : rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Max, A_B_C);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]);
+ FP[rA] = reinterpret_cast<RawObject*>((lhs > rhs) ? lhs : rhs);
+ DISPATCH();
+ }
+
#if defined(ARCH_IS_64_BIT)
{
BYTECODE(WriteIntoDouble, A_D);
@@ -1744,6 +1760,19 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(DoubleToSmi, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ if (!isnan(value)) {
+ const intptr_t result = static_cast<intptr_t>(value);
+ if ((result <= Smi::kMaxValue) && (result >= Smi::kMinValue)) {
+ FP[rA] = reinterpret_cast<RawObject*>(result << kSmiTagSize);
+ pc++;
+ }
+ }
+ DISPATCH();
+ }
+
+ {
BYTECODE(SmiToDouble, A_D);
const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]) >> kSmiTagSize;
const double result = static_cast<double>(value);
@@ -1790,6 +1819,29 @@ RawObject* Simulator::Call(const Code& code,
FP[rA] = bit_cast<RawObject*, double>(-value);
DISPATCH();
}
+
+ {
+ BYTECODE(DSqrt, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(sqrt(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMin, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ FP[rA] = bit_cast<RawObject*, double>(fmin(lhs, rhs));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMax, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ FP[rA] = bit_cast<RawObject*, double>(fmax(lhs, rhs));
+ DISPATCH();
+ }
#else // defined(ARCH_IS_64_BIT)
{
BYTECODE(WriteIntoDouble, A_D);
@@ -1810,6 +1862,12 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(DoubleToSmi, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
BYTECODE(SmiToDouble, A_D);
UNIMPLEMENTED();
DISPATCH();
@@ -1844,6 +1902,24 @@ RawObject* Simulator::Call(const Code& code,
UNIMPLEMENTED();
DISPATCH();
}
+
+ {
+ BYTECODE(DSqrt, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMin, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMax, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
#endif // defined(ARCH_IS_64_BIT)
// Return and return like instructions (Instrinsic).
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698