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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2423843002: Add DoubleTestOp instruction (Closed)
Patch Set: Address comments Created 4 years, 2 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/method_recognizer.h ('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 4d271556cb8565e27004c91dbf31aef8b8ace001..c3998aff11a6ba832c47f211676d9cb4c8b44108 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -252,6 +252,17 @@ class SimulatorHelpers {
return true;
}
+ static bool Double_getIsInfinite(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 1);
+ RawDouble* d = static_cast<RawDouble*>(args[0]);
+ *result = isinf(d->ptr()->value_)
+ ? Bool::True().raw()
+ : Bool::False().raw();
+ return true;
+ }
+
static bool ObjectEquals(Thread* thread,
RawObject** FP,
RawObject** result) {
@@ -484,6 +495,8 @@ void Simulator::InitOnce() {
intrinsics_[kDouble_getIsNaNIntrinsic] =
SimulatorHelpers::Double_getIsNan;
+ intrinsics_[kDouble_getIsInfiniteIntrinsic] =
+ SimulatorHelpers::Double_getIsInfinite;
intrinsics_[kDouble_addIntrinsic] =
SimulatorHelpers::Double_add;
intrinsics_[kDouble_mulIntrinsic] =
@@ -2216,6 +2229,20 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(DoubleIsNaN, A_D);
+ const double v = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = isnan(v) ? true_value : false_value;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleIsInfinite, A_D);
+ const double v = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = isinf(v) ? true_value : false_value;
+ DISPATCH();
+ }
+
+ {
BYTECODE(LoadIndexedFloat32, A_B_C);
uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]);
const uint32_t value = *reinterpret_cast<uint32_t*>(data);
@@ -2447,6 +2474,18 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(DoubleIsNaN, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleIsInfinite, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
BYTECODE(LoadIndexedFloat32, A_B_C);
UNREACHABLE();
DISPATCH();
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698