Commit f8c29ff0 authored by baptiste.afsa@arm.com's avatar baptiste.afsa@arm.com

ARM64: Use a double register to break cycle involving double values.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/208183002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20198 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9c0f5be8
...@@ -42,6 +42,12 @@ namespace internal { ...@@ -42,6 +42,12 @@ namespace internal {
// once we have resolved a cycle. // once we have resolved a cycle.
#define kSavedValue root #define kSavedValue root
// We use the MacroAssembler floating-point scratch register to break a cycle
// involving double values as the MacroAssembler will not need it for the
// operations performed by the gap resolver.
#define kSavedDoubleValue fp_scratch
LGapResolver::LGapResolver(LCodeGen* owner) LGapResolver::LGapResolver(LCodeGen* owner)
: cgen_(owner), moves_(32, owner->zone()), root_index_(0), in_cycle_(false), : cgen_(owner), moves_(32, owner->zone()), root_index_(0), in_cycle_(false),
saved_destination_(NULL), need_to_restore_root_(false) { } saved_destination_(NULL), need_to_restore_root_(false) { }
...@@ -169,10 +175,10 @@ void LGapResolver::BreakCycle(int index) { ...@@ -169,10 +175,10 @@ void LGapResolver::BreakCycle(int index) {
ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source())); ASSERT(moves_[index].destination()->Equals(moves_[root_index_].source()));
ASSERT(!in_cycle_); ASSERT(!in_cycle_);
// We use a register which is not allocatable by crankshaft to break the cycle // We use registers which are not allocatable by crankshaft to break the cycle
// to be sure it doesn't interfere with the moves we are resolving. // to be sure they don't interfere with the moves we are resolving.
ASSERT(!kSavedValue.IsAllocatable()); ASSERT(!kSavedValue.IsAllocatable());
need_to_restore_root_ = true; ASSERT(!kSavedDoubleValue.IsAllocatable());
// We save in a register the source of that move and we remember its // We save in a register the source of that move and we remember its
// destination. Then we mark this move as resolved so the cycle is // destination. Then we mark this move as resolved so the cycle is
...@@ -182,19 +188,19 @@ void LGapResolver::BreakCycle(int index) { ...@@ -182,19 +188,19 @@ void LGapResolver::BreakCycle(int index) {
saved_destination_ = moves_[index].destination(); saved_destination_ = moves_[index].destination();
if (source->IsRegister()) { if (source->IsRegister()) {
need_to_restore_root_ = true;
__ Mov(kSavedValue, cgen_->ToRegister(source)); __ Mov(kSavedValue, cgen_->ToRegister(source));
} else if (source->IsStackSlot()) { } else if (source->IsStackSlot()) {
need_to_restore_root_ = true;
__ Ldr(kSavedValue, cgen_->ToMemOperand(source)); __ Ldr(kSavedValue, cgen_->ToMemOperand(source));
} else if (source->IsDoubleRegister()) { } else if (source->IsDoubleRegister()) {
// TODO(all): We should use a double register to store the value to avoid ASSERT(cgen_->masm()->FPTmpList()->IncludesAliasOf(kSavedDoubleValue));
// the penalty of the mov across register banks. We are going to reserve cgen_->masm()->FPTmpList()->Remove(kSavedDoubleValue);
// d31 to hold 0.0 value. We could clobber this register while breaking the __ Fmov(kSavedDoubleValue, cgen_->ToDoubleRegister(source));
// cycle and restore it after like we do with the root register.
// LGapResolver::RestoreValue() will need to be updated as well when we'll
// do that.
__ Fmov(kSavedValue, cgen_->ToDoubleRegister(source));
} else if (source->IsDoubleStackSlot()) { } else if (source->IsDoubleStackSlot()) {
__ Ldr(kSavedValue, cgen_->ToMemOperand(source)); ASSERT(cgen_->masm()->FPTmpList()->IncludesAliasOf(kSavedDoubleValue));
cgen_->masm()->FPTmpList()->Remove(kSavedDoubleValue);
__ Ldr(kSavedDoubleValue, cgen_->ToMemOperand(source));
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
...@@ -215,9 +221,11 @@ void LGapResolver::RestoreValue() { ...@@ -215,9 +221,11 @@ void LGapResolver::RestoreValue() {
} else if (saved_destination_->IsStackSlot()) { } else if (saved_destination_->IsStackSlot()) {
__ Str(kSavedValue, cgen_->ToMemOperand(saved_destination_)); __ Str(kSavedValue, cgen_->ToMemOperand(saved_destination_));
} else if (saved_destination_->IsDoubleRegister()) { } else if (saved_destination_->IsDoubleRegister()) {
__ Fmov(cgen_->ToDoubleRegister(saved_destination_), kSavedValue); __ Fmov(cgen_->ToDoubleRegister(saved_destination_), kSavedDoubleValue);
cgen_->masm()->FPTmpList()->Combine(kSavedDoubleValue);
} else if (saved_destination_->IsDoubleStackSlot()) { } else if (saved_destination_->IsDoubleStackSlot()) {
__ Str(kSavedValue, cgen_->ToMemOperand(saved_destination_)); __ Str(kSavedDoubleValue, cgen_->ToMemOperand(saved_destination_));
cgen_->masm()->FPTmpList()->Combine(kSavedDoubleValue);
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
......
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