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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2120703002: DBC: Enables unboxed doubles (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comparison ops 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
Index: runtime/vm/simulator_dbc.cc
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index 645343540935748f2f22a36ca0394da677758344..b2a0e62de4223e8845242dab18df0e4beeea42a9 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -1694,6 +1694,142 @@ RawObject* Simulator::Call(const Code& code,
DISPATCH();
}
+#if defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(BoxDouble, A_D);
Vyacheslav Egorov (Google) 2016/07/14 16:26:24 I would call this bytecode WriteIntoDouble or some
zra 2016/07/14 21:12:10 Done.
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ RawDouble* box = RAW_CAST(Double, *SP--);
+ box->ptr()->value_ = value;
+ FP[rA] = box;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(UnboxDouble, A_D);
+ const RawDouble* box = RAW_CAST(Double, FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(box->ptr()->value_);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckedUnboxDouble, A_D);
+ const intptr_t box_cid = SimulatorHelpers::GetClassId(FP[rD]);
+ if (box_cid == kSmiCid) {
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]) >> kSmiTagSize;
+ const double result = static_cast<double>(value);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ pc++;
+ } else if (box_cid == kDoubleCid) {
+ const RawDouble* box = RAW_CAST(Double, FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(box->ptr()->value_);
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(SmiToDouble, A_D);
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]) >> kSmiTagSize;
+ const double result = static_cast<double>(value);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DAdd, 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>(lhs + rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSub, 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>(lhs - rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMul, 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>(lhs * rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DDiv, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ const double result = lhs / rhs;
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DNeg, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(-value);
+ DISPATCH();
+ }
+#else // defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(BoxDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(UnboxDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckedUnboxDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(SmiToDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DAdd, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSub, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMul, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DDiv, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DNeg, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+#endif // defined(ARCH_IS_64_BIT)
+
// Return and return like instructions (Instrinsic).
{
RawObject* result; // result to return to the caller.
@@ -2089,7 +2225,8 @@ RawObject* Simulator::Call(const Code& code,
{
BYTECODE(CheckClassId, A_D);
- const intptr_t actual_cid = SimulatorHelpers::GetClassId(FP[rA]);
+ const intptr_t actual_cid =
+ reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize;
const intptr_t desired_cid = rD;
pc += (actual_cid == desired_cid) ? 1 : 0;
DISPATCH();
@@ -2294,6 +2431,92 @@ RawObject* Simulator::Call(const Code& code,
DISPATCH();
}
+#if defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(IfDEq, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs == rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDNe, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs != rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLe, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs <= rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLt, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs < rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGe, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs >= rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGt, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs > rhs) ? 0 : 1;
+ DISPATCH();
+ }
+#else // defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(IfDEq, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDNe, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLe, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLt, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGe, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGt, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+#endif // defined(ARCH_IS_64_BIT)
+
{
BYTECODE(IfEqStrictNum, A_D);
RawObject* lhs = FP[rA];
@@ -2528,6 +2751,7 @@ RawObject* Simulator::Call(const Code& code,
return 0;
}
+
void Simulator::Longjmp(uword pc,
uword sp,
uword fp,
@@ -2565,5 +2789,4 @@ void Simulator::Longjmp(uword pc,
} // namespace dart
-
#endif // defined TARGET_ARCH_DBC

Powered by Google App Engine
This is Rietveld 408576698