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

Unified Diff: src/ppc/lithium-gap-resolver-ppc.cc

Issue 422063005: Contribution of PowerPC port. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: re-upload - catch up to 8/19 level Created 6 years, 4 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
Index: src/ppc/lithium-gap-resolver-ppc.cc
diff --git a/src/mips/lithium-gap-resolver-mips.cc b/src/ppc/lithium-gap-resolver-ppc.cc
similarity index 72%
copy from src/mips/lithium-gap-resolver-mips.cc
copy to src/ppc/lithium-gap-resolver-ppc.cc
index 1bec0c8cda9c397e3bc85232d2a0a667b60cf423..fafc06139fa8fba9448fd009eb5cebb880175e3f 100644
--- a/src/mips/lithium-gap-resolver-mips.cc
+++ b/src/ppc/lithium-gap-resolver-ppc.cc
@@ -1,15 +1,20 @@
// Copyright 2012 the V8 project authors. All rights reserved.
+//
+// Copyright IBM Corp. 2012, 2013. All rights reserved.
+//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/v8.h"
-#include "src/mips/lithium-codegen-mips.h"
-#include "src/mips/lithium-gap-resolver-mips.h"
+#include "src/ppc/lithium-codegen-ppc.h"
+#include "src/ppc/lithium-gap-resolver-ppc.h"
namespace v8 {
namespace internal {
+static const Register kSavedValueRegister = {11};
+
LGapResolver::LGapResolver(LCodeGen* owner)
: cgen_(owner),
moves_(32, owner->zone()),
@@ -145,13 +150,13 @@ void LGapResolver::BreakCycle(int index) {
LOperand* source = moves_[index].source();
saved_destination_ = moves_[index].destination();
if (source->IsRegister()) {
- __ mov(kLithiumScratchReg, cgen_->ToRegister(source));
+ __ mr(kSavedValueRegister, cgen_->ToRegister(source));
} else if (source->IsStackSlot()) {
- __ lw(kLithiumScratchReg, cgen_->ToMemOperand(source));
+ __ LoadP(kSavedValueRegister, cgen_->ToMemOperand(source));
} else if (source->IsDoubleRegister()) {
- __ mov_d(kLithiumScratchDouble, cgen_->ToDoubleRegister(source));
+ __ fmr(kScratchDoubleReg, cgen_->ToDoubleRegister(source));
} else if (source->IsDoubleStackSlot()) {
- __ ldc1(kLithiumScratchDouble, cgen_->ToMemOperand(source));
+ __ lfd(kScratchDoubleReg, cgen_->ToMemOperand(source));
} else {
UNREACHABLE();
}
@@ -164,17 +169,15 @@ void LGapResolver::RestoreValue() {
DCHECK(in_cycle_);
DCHECK(saved_destination_ != NULL);
- // Spilled value is in kLithiumScratchReg or kLithiumScratchDouble.
+ // Spilled value is in kSavedValueRegister or kSavedDoubleValueRegister.
if (saved_destination_->IsRegister()) {
- __ mov(cgen_->ToRegister(saved_destination_), kLithiumScratchReg);
+ __ mr(cgen_->ToRegister(saved_destination_), kSavedValueRegister);
} else if (saved_destination_->IsStackSlot()) {
- __ sw(kLithiumScratchReg, cgen_->ToMemOperand(saved_destination_));
+ __ StoreP(kSavedValueRegister, cgen_->ToMemOperand(saved_destination_));
} else if (saved_destination_->IsDoubleRegister()) {
- __ mov_d(cgen_->ToDoubleRegister(saved_destination_),
- kLithiumScratchDouble);
+ __ fmr(cgen_->ToDoubleRegister(saved_destination_), kScratchDoubleReg);
} else if (saved_destination_->IsDoubleStackSlot()) {
- __ sdc1(kLithiumScratchDouble,
- cgen_->ToMemOperand(saved_destination_));
+ __ stfd(kScratchDoubleReg, cgen_->ToMemOperand(saved_destination_));
} else {
UNREACHABLE();
}
@@ -194,33 +197,24 @@ void LGapResolver::EmitMove(int index) {
if (source->IsRegister()) {
Register source_register = cgen_->ToRegister(source);
if (destination->IsRegister()) {
- __ mov(cgen_->ToRegister(destination), source_register);
+ __ mr(cgen_->ToRegister(destination), source_register);
} else {
DCHECK(destination->IsStackSlot());
- __ sw(source_register, cgen_->ToMemOperand(destination));
+ __ StoreP(source_register, cgen_->ToMemOperand(destination));
}
} else if (source->IsStackSlot()) {
MemOperand source_operand = cgen_->ToMemOperand(source);
if (destination->IsRegister()) {
- __ lw(cgen_->ToRegister(destination), source_operand);
+ __ LoadP(cgen_->ToRegister(destination), source_operand);
} else {
DCHECK(destination->IsStackSlot());
MemOperand destination_operand = cgen_->ToMemOperand(destination);
if (in_cycle_) {
- if (!destination_operand.OffsetIsInt16Encodable()) {
- // 'at' is overwritten while saving the value to the destination.
- // Therefore we can't use 'at'. It is OK if the read from the source
- // destroys 'at', since that happens before the value is read.
- // This uses only a single reg of the double reg-pair.
- __ lwc1(kLithiumScratchDouble, source_operand);
- __ swc1(kLithiumScratchDouble, destination_operand);
- } else {
- __ lw(at, source_operand);
- __ sw(at, destination_operand);
- }
+ __ LoadP(ip, source_operand);
+ __ StoreP(ip, destination_operand);
} else {
- __ lw(kLithiumScratchReg, source_operand);
- __ sw(kLithiumScratchReg, destination_operand);
+ __ LoadP(kSavedValueRegister, source_operand);
+ __ StoreP(kSavedValueRegister, destination_operand);
}
}
@@ -228,62 +222,60 @@ void LGapResolver::EmitMove(int index) {
LConstantOperand* constant_source = LConstantOperand::cast(source);
if (destination->IsRegister()) {
Register dst = cgen_->ToRegister(destination);
- Representation r = cgen_->IsSmi(constant_source)
- ? Representation::Smi() : Representation::Integer32();
if (cgen_->IsInteger32(constant_source)) {
- __ li(dst, Operand(cgen_->ToRepresentation(constant_source, r)));
+ cgen_->EmitLoadIntegerConstant(constant_source, dst);
} else {
- __ li(dst, cgen_->ToHandle(constant_source));
+ __ Move(dst, cgen_->ToHandle(constant_source));
}
} else if (destination->IsDoubleRegister()) {
DoubleRegister result = cgen_->ToDoubleRegister(destination);
double v = cgen_->ToDouble(constant_source);
- __ Move(result, v);
+ __ LoadDoubleLiteral(result, v, ip);
} else {
DCHECK(destination->IsStackSlot());
DCHECK(!in_cycle_); // Constant moves happen after all cycles are gone.
- Representation r = cgen_->IsSmi(constant_source)
- ? Representation::Smi() : Representation::Integer32();
if (cgen_->IsInteger32(constant_source)) {
- __ li(kLithiumScratchReg,
- Operand(cgen_->ToRepresentation(constant_source, r)));
+ cgen_->EmitLoadIntegerConstant(constant_source, kSavedValueRegister);
} else {
- __ li(kLithiumScratchReg, cgen_->ToHandle(constant_source));
+ __ Move(kSavedValueRegister, cgen_->ToHandle(constant_source));
}
- __ sw(kLithiumScratchReg, cgen_->ToMemOperand(destination));
+ __ StoreP(kSavedValueRegister, cgen_->ToMemOperand(destination));
}
} else if (source->IsDoubleRegister()) {
DoubleRegister source_register = cgen_->ToDoubleRegister(source);
if (destination->IsDoubleRegister()) {
- __ mov_d(cgen_->ToDoubleRegister(destination), source_register);
+ __ fmr(cgen_->ToDoubleRegister(destination), source_register);
} else {
DCHECK(destination->IsDoubleStackSlot());
- MemOperand destination_operand = cgen_->ToMemOperand(destination);
- __ sdc1(source_register, destination_operand);
+ __ stfd(source_register, cgen_->ToMemOperand(destination));
}
} else if (source->IsDoubleStackSlot()) {
MemOperand source_operand = cgen_->ToMemOperand(source);
if (destination->IsDoubleRegister()) {
- __ ldc1(cgen_->ToDoubleRegister(destination), source_operand);
+ __ lfd(cgen_->ToDoubleRegister(destination), source_operand);
} else {
DCHECK(destination->IsDoubleStackSlot());
MemOperand destination_operand = cgen_->ToMemOperand(destination);
if (in_cycle_) {
- // kLithiumScratchDouble was used to break the cycle,
- // but kLithiumScratchReg is free.
- MemOperand source_high_operand =
- cgen_->ToHighMemOperand(source);
+// kSavedDoubleValueRegister was used to break the cycle,
+// but kSavedValueRegister is free.
+#if V8_TARGET_ARCH_PPC64
+ __ ld(kSavedValueRegister, source_operand);
+ __ std(kSavedValueRegister, destination_operand);
+#else
+ MemOperand source_high_operand = cgen_->ToHighMemOperand(source);
MemOperand destination_high_operand =
cgen_->ToHighMemOperand(destination);
- __ lw(kLithiumScratchReg, source_operand);
- __ sw(kLithiumScratchReg, destination_operand);
- __ lw(kLithiumScratchReg, source_high_operand);
- __ sw(kLithiumScratchReg, destination_high_operand);
+ __ lwz(kSavedValueRegister, source_operand);
+ __ stw(kSavedValueRegister, destination_operand);
+ __ lwz(kSavedValueRegister, source_high_operand);
+ __ stw(kSavedValueRegister, destination_high_operand);
+#endif
} else {
- __ ldc1(kLithiumScratchDouble, source_operand);
- __ sdc1(kLithiumScratchDouble, destination_operand);
+ __ lfd(kScratchDoubleReg, source_operand);
+ __ stfd(kScratchDoubleReg, destination_operand);
}
}
} else {
@@ -295,5 +287,5 @@ void LGapResolver::EmitMove(int index) {
#undef __
-
-} } // namespace v8::internal
+}
+} // namespace v8::internal

Powered by Google App Engine
This is Rietveld 408576698