Commit 5df9be93 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

[deoptimizer, cleanup] Separating the implementation of GetFloatRegister

Trying to use double_registers for fetching single precision fp values creates
four different implementations of this method depending on the architecture, hence
separating them out into their respective folder.


Change-Id: Ide61fe2e7a95bd8427b377959b262633d8c57e61
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1730663Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarMilad Farazmand <miladfar@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#63042}
parent 5611f70b
...@@ -221,6 +221,13 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -221,6 +221,13 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop(); __ stop();
} }
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
const int kShift = n % 2 == 0 ? 0 : 32;
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n / 2].get_bits() >> kShift));
}
bool Deoptimizer::PadTopOfStackRegister() { return false; } bool Deoptimizer::PadTopOfStackRegister() { return false; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
...@@ -274,6 +274,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -274,6 +274,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ Br(continuation); __ Br(continuation);
} }
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n].get_bits()));
}
bool Deoptimizer::PadTopOfStackRegister() { return true; } bool Deoptimizer::PadTopOfStackRegister() { return true; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
...@@ -635,18 +635,7 @@ class RegisterValues { ...@@ -635,18 +635,7 @@ class RegisterValues {
return registers_[n]; return registers_[n];
} }
Float32 GetFloatRegister(unsigned n) const { Float32 GetFloatRegister(unsigned n) const;
DCHECK(n < arraysize(double_registers_));
if (kSimpleFPAliasing) {
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n].get_bits()));
} else {
const int kShift = n % 2 == 0 ? 0 : 32;
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n / 2].get_bits() >> kShift));
}
}
Float64 GetDoubleRegister(unsigned n) const { Float64 GetDoubleRegister(unsigned n) const {
DCHECK(n < arraysize(double_registers_)); DCHECK(n < arraysize(double_registers_));
......
...@@ -199,6 +199,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -199,6 +199,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ ret(0); __ ret(0);
} }
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n].get_bits()));
}
bool Deoptimizer::PadTopOfStackRegister() { return false; } bool Deoptimizer::PadTopOfStackRegister() { return false; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
...@@ -218,6 +218,11 @@ const int Deoptimizer::table_entry_size_ = 2 * kInstrSize; ...@@ -218,6 +218,11 @@ const int Deoptimizer::table_entry_size_ = 2 * kInstrSize;
const int Deoptimizer::table_entry_size_ = 3 * kInstrSize; const int Deoptimizer::table_entry_size_ = 3 * kInstrSize;
#endif #endif
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n].get_bits()));
}
bool Deoptimizer::PadTopOfStackRegister() { return false; } bool Deoptimizer::PadTopOfStackRegister() { return false; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
...@@ -218,6 +218,11 @@ const int Deoptimizer::table_entry_size_ = 2 * kInstrSize; ...@@ -218,6 +218,11 @@ const int Deoptimizer::table_entry_size_ = 2 * kInstrSize;
const int Deoptimizer::table_entry_size_ = 3 * kInstrSize; const int Deoptimizer::table_entry_size_ = 3 * kInstrSize;
#endif #endif
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n].get_bits()));
}
bool Deoptimizer::PadTopOfStackRegister() { return false; } bool Deoptimizer::PadTopOfStackRegister() { return false; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
...@@ -219,6 +219,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -219,6 +219,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop(); __ stop();
} }
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
float float_val = static_cast<float>(double_registers_[n].get_scalar());
return Float32::FromBits(bit_cast<uint32_t>(float_val));
}
bool Deoptimizer::PadTopOfStackRegister() { return false; } bool Deoptimizer::PadTopOfStackRegister() { return false; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
...@@ -212,6 +212,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -212,6 +212,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ stop(); __ stop();
} }
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n].get_bits() >> 32));
}
bool Deoptimizer::PadTopOfStackRegister() { return false; } bool Deoptimizer::PadTopOfStackRegister() { return false; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
...@@ -215,6 +215,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm, ...@@ -215,6 +215,11 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
__ ret(0); __ ret(0);
} }
Float32 RegisterValues::GetFloatRegister(unsigned n) const {
return Float32::FromBits(
static_cast<uint32_t>(double_registers_[n].get_bits()));
}
bool Deoptimizer::PadTopOfStackRegister() { return false; } bool Deoptimizer::PadTopOfStackRegister() { return false; }
void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) { void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment