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

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: Rename BoxDouble -> WriteIntoDouble 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') | tools/build.py » ('j') | 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 645343540935748f2f22a36ca0394da677758344..4102e8f1c71ec4182193bbafa51e30ba6e9e47df 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(WriteIntoDouble, A_D);
+ 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(WriteIntoDouble, 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.
@@ -2088,8 +2224,20 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(CheckEitherNonSmi, A_D);
+ const intptr_t obj1 = reinterpret_cast<intptr_t>(FP[rA]);
+ const intptr_t obj2 = reinterpret_cast<intptr_t>(FP[rD]);
+ const intptr_t tag = (obj1 | obj2) & kSmiTagMask;
+ if (tag != kSmiTag) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
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 +2442,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 +2762,7 @@ RawObject* Simulator::Call(const Code& code,
return 0;
}
+
void Simulator::Longjmp(uword pc,
uword sp,
uword fp,
@@ -2565,5 +2800,4 @@ void Simulator::Longjmp(uword pc,
} // namespace dart
-
#endif // defined TARGET_ARCH_DBC
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | tools/build.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698