Chromium Code Reviews| Index: runtime/vm/simulator_dbc.cc |
| diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc |
| index 53f637ad7ca3075b145ebcf47ff7bbc63c74f3f5..6c3532d42a2cbdff5ba659d8a532789b09bfe87c 100644 |
| --- a/runtime/vm/simulator_dbc.cc |
| +++ b/runtime/vm/simulator_dbc.cc |
| @@ -251,7 +251,7 @@ class SimulatorHelpers { |
| } |
| DART_FORCE_INLINE static uint8_t* GetTypedData( |
| - RawObject* obj, RawObject* index, intptr_t scale) { |
| + RawObject* obj, RawObject* index) { |
| ASSERT(RawObject::IsTypedDataClassId(obj->GetClassId())); |
| RawTypedData* array = reinterpret_cast<RawTypedData*>(obj); |
| const intptr_t byte_offset = Smi::Value(RAW_CAST(Smi, index)); |
| @@ -1969,9 +1969,69 @@ RawObject* Simulator::Call(const Code& code, |
| } |
| { |
| + BYTECODE(DTruncate, A_D); |
| + const double value = bit_cast<double, RawObject*>(FP[rD]); |
| + FP[rA] = bit_cast<RawObject*, double>(trunc(value)); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(DFloor, A_D); |
| + const double value = bit_cast<double, RawObject*>(FP[rD]); |
| + FP[rA] = bit_cast<RawObject*, double>(floor(value)); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(DCeil, A_D); |
| + const double value = bit_cast<double, RawObject*>(FP[rD]); |
| + FP[rA] = bit_cast<RawObject*, double>(ceil(value)); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(DoubleToFloat, A_D); |
| + const double value = bit_cast<double, RawObject*>(FP[rD]); |
| + const float valuef = static_cast<float>(value); |
| + *reinterpret_cast<float*>(&FP[rA]) = valuef; |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(FloatToDouble, A_D); |
| + const float valuef = *reinterpret_cast<float*>(&FP[rD]); |
| + const double value = static_cast<double>(valuef); |
| + FP[rA] = bit_cast<RawObject*, double>(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); |
| + const int64_t value64 = value; |
|
Florian Schneider
2016/09/15 16:05:45
uint64_t?
zra
2016/09/15 16:18:21
Done.
|
| + FP[rA] = reinterpret_cast<RawObject*>(value64); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(LoadIndexed4Float32, 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_)); |
| + const uint32_t value = |
| + reinterpret_cast<uint32_t*>(array->ptr()->data())[Smi::Value(index)]; |
| + const int64_t value64 = value; // sign extend to clear high bits. |
|
Florian Schneider
2016/09/15 16:05:45
uint64_t? The upper bits of the value that holds t
zra
2016/09/15 16:18:21
Done.
|
| + FP[rA] = reinterpret_cast<RawObject*>(value64); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| BYTECODE(LoadIndexedFloat64, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC], 3); |
| - *reinterpret_cast<uint64_t*>(&FP[rA]) = *reinterpret_cast<uint64_t*>(data); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]); |
| + const int64_t value = *reinterpret_cast<uint64_t*>(data); |
| + FP[rA] = reinterpret_cast<RawObject*>(value); |
| DISPATCH(); |
| } |
| @@ -1988,8 +2048,30 @@ RawObject* Simulator::Call(const Code& code, |
| } |
| { |
| + BYTECODE(StoreIndexedFloat32, A_B_C); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rA], FP[rB]); |
| + const uint64_t value = reinterpret_cast<uint64_t>(FP[rC]); |
| + const uint32_t value32 = value; |
| + *reinterpret_cast<uint32_t*>(data) = value32; |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(StoreIndexed4Float32, 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_)); |
| + const uint64_t value = reinterpret_cast<uint64_t>(FP[rC]); |
| + const uint32_t value32 = value; |
| + reinterpret_cast<uint32_t*>(array->ptr()->data())[Smi::Value(index)] = |
| + value32; |
| + DISPATCH(); |
| + } |
| + |
| + { |
| BYTECODE(StoreIndexedFloat64, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rA], FP[rB], 3); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rA], FP[rB]); |
| *reinterpret_cast<uint64_t*>(data) = reinterpret_cast<uint64_t>(FP[rC]); |
| DISPATCH(); |
| } |
| @@ -2126,6 +2208,48 @@ RawObject* Simulator::Call(const Code& code, |
| } |
| { |
| + BYTECODE(DTruncate, A_D); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(DFloor, A_D); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(DCeil, A_D); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(DoubleToFloat, A_D); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(FloatToDouble, A_D); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(LoadIndexedFloat32, A_B_C); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(LoadIndexed4Float32, A_B_C); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| BYTECODE(LoadIndexedFloat64, A_B_C); |
| UNREACHABLE(); |
| DISPATCH(); |
| @@ -2138,6 +2262,18 @@ RawObject* Simulator::Call(const Code& code, |
| } |
| { |
| + BYTECODE(StoreIndexedFloat32, A_B_C); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| + BYTECODE(StoreIndexed4Float32, A_B_C); |
| + UNREACHABLE(); |
| + DISPATCH(); |
| + } |
| + |
| + { |
| BYTECODE(StoreIndexedFloat64, A_B_C); |
| UNREACHABLE(); |
| DISPATCH(); |
| @@ -3043,7 +3179,7 @@ RawObject* Simulator::Call(const Code& code, |
| { |
| BYTECODE(StoreIndexedUint8, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rA], FP[rB], 0); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rA], FP[rB]); |
| *data = Smi::Value(RAW_CAST(Smi, FP[rC])); |
| DISPATCH(); |
| } |
| @@ -3069,7 +3205,7 @@ RawObject* Simulator::Call(const Code& code, |
| { |
| BYTECODE(StoreIndexedUint32, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rA], FP[rB], 2); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rA], FP[rB]); |
| const uintptr_t value = reinterpret_cast<uintptr_t>(FP[rC]); |
| *reinterpret_cast<uint32_t*>(data) = static_cast<uint32_t>(value); |
| DISPATCH(); |
| @@ -3088,28 +3224,28 @@ RawObject* Simulator::Call(const Code& code, |
| { |
| BYTECODE(LoadIndexedUint8, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC], 0); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]); |
| FP[rA] = Smi::New(*data); |
| DISPATCH(); |
| } |
| { |
| BYTECODE(LoadIndexedInt8, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC], 0); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]); |
| FP[rA] = Smi::New(*reinterpret_cast<int8_t*>(data)); |
| DISPATCH(); |
| } |
| { |
| BYTECODE(LoadIndexedUint32, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC], 2); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]); |
| FP[rA] = reinterpret_cast<RawObject*>(*reinterpret_cast<uintptr_t*>(data)); |
| DISPATCH(); |
| } |
| { |
| BYTECODE(LoadIndexedInt32, A_B_C); |
| - uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC], 2); |
| + uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]); |
| FP[rA] = reinterpret_cast<RawObject*>(*reinterpret_cast<intptr_t*>(data)); |
| DISPATCH(); |
| } |