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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2181713002: DBC: More Load/Store Indexed variants, A few more math instructions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add ShrImm and use it in Load/StoreIndexed 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 22b159f9c13dea18140f57b85bd63ed01853de21..44e1e5c97cca85d35ffc7eead8e48b4854084a60 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -1711,6 +1711,14 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(ShrImm, A_B_C);
+ const uint8_t shift = rC;
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]) >> kSmiTagSize;
+ *reinterpret_cast<intptr_t*>(&FP[rA]) = (lhs >> shift) << kSmiTagSize;
+ 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]);
@@ -1828,6 +1836,38 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(DSin, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(sin(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DCos, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(cos(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DPow, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ const double result = pow(lhs, rhs);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMod, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ const double result = DartModulo(lhs, rhs);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
BYTECODE(DMin, A_B_C);
const double lhs = bit_cast<double, RawObject*>(FP[rB]);
const double rhs = bit_cast<double, RawObject*>(FP[rC]);
@@ -1910,6 +1950,30 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(DSin, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DCos, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DPow, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMod, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
BYTECODE(DMin, A_B_C);
UNREACHABLE();
DISPATCH();
@@ -2700,6 +2764,17 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(StoreFloat64Indexed, A_B_C);
+ ASSERT(RawObject::IsTypedDataClassId(FP[rA]->GetClassId()));
+ RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rA]);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_));
+ double* data = reinterpret_cast<double*>(array->ptr()->data());
+ data[Smi::Value(index)] = bit_cast<double, RawObject*>(FP[rC]);
+ DISPATCH();
+ }
+
+ {
BYTECODE(LoadIndexed, A_B_C);
RawArray* array = RAW_CAST(Array, FP[rB]);
RawSmi* index = RAW_CAST(Smi, FP[rC]);
@@ -2709,6 +2784,35 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(LoadFloat64Indexed, A_B_C);
+ ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId()));
+ RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_));
+ double* data = reinterpret_cast<double*>(array->ptr()->data());
+ FP[rA] = bit_cast<RawObject*, double>(data[Smi::Value(index)]);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadOneByteStringIndexed, A_B_C);
+ RawOneByteString* array = RAW_CAST(OneByteString, FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_));
+ FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadTwoByteStringIndexed, A_B_C);
+ RawTwoByteString* array = RAW_CAST(TwoByteString, FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_));
+ FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]);
+ DISPATCH();
+ }
+
+ {
BYTECODE(Deopt, A_D);
const bool is_lazy = rD == 0;
« 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