Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
index 851ba24..7130c3d 100644
--- a/src/compiler/instruction.h
+++ b/src/compiler/instruction.h
@@ -103,6 +103,8 @@
return this->GetCanonicalizedValue() < that.GetCanonicalizedValue();
}
+ bool InterferesWith(const InstructionOperand& that) const;
+
void Print(const RegisterConfiguration* config) const;
void Print() const;
@@ -155,7 +157,7 @@
NONE,
ANY,
FIXED_REGISTER,
- FIXED_DOUBLE_REGISTER,
+ FIXED_FP_REGISTER,
MUST_HAVE_REGISTER,
MUST_HAVE_SLOT,
SAME_AS_FIRST_INPUT
@@ -192,7 +194,7 @@
UnallocatedOperand(ExtendedPolicy policy, int index, int virtual_register)
: UnallocatedOperand(virtual_register) {
- DCHECK(policy == FIXED_REGISTER || policy == FIXED_DOUBLE_REGISTER);
+ DCHECK(policy == FIXED_REGISTER || policy == FIXED_FP_REGISTER);
value_ |= BasicPolicyField::encode(EXTENDED_POLICY);
value_ |= ExtendedPolicyField::encode(policy);
value_ |= LifetimeField::encode(USED_AT_END);
@@ -220,7 +222,7 @@
bool HasFixedPolicy() const {
return basic_policy() == FIXED_SLOT ||
extended_policy() == FIXED_REGISTER ||
- extended_policy() == FIXED_DOUBLE_REGISTER;
+ extended_policy() == FIXED_FP_REGISTER;
}
bool HasRegisterPolicy() const {
return basic_policy() == EXTENDED_POLICY &&
@@ -239,9 +241,9 @@
return basic_policy() == EXTENDED_POLICY &&
extended_policy() == FIXED_REGISTER;
}
- bool HasFixedDoubleRegisterPolicy() const {
+ bool HasFixedFPRegisterPolicy() const {
return basic_policy() == EXTENDED_POLICY &&
- extended_policy() == FIXED_DOUBLE_REGISTER;
+ extended_policy() == FIXED_FP_REGISTER;
}
bool HasSecondaryStorage() const {
return basic_policy() == EXTENDED_POLICY &&
@@ -272,9 +274,9 @@
FixedSlotIndexField::kShift);
}
- // [fixed_register_index]: Only for FIXED_REGISTER or FIXED_DOUBLE_REGISTER.
+ // [fixed_register_index]: Only for FIXED_REGISTER or FIXED_FP_REGISTER.
int fixed_register_index() const {
- DCHECK(HasFixedRegisterPolicy() || HasFixedDoubleRegisterPolicy());
+ DCHECK(HasFixedRegisterPolicy() || HasFixedFPRegisterPolicy());
return FixedRegisterField::decode(value_);
}
@@ -421,30 +423,32 @@
return static_cast<int64_t>(value_) >> IndexField::kShift;
}
+ int register_code() const {
+ DCHECK(IsRegister() || IsFPRegister());
+ return static_cast<int64_t>(value_) >> IndexField::kShift;
+ }
+
Register GetRegister() const {
DCHECK(IsRegister());
- return Register::from_code(static_cast<int64_t>(value_) >>
- IndexField::kShift);
+ return Register::from_code(register_code());
}
FloatRegister GetFloatRegister() const {
DCHECK(IsFloatRegister());
- return FloatRegister::from_code(static_cast<int64_t>(value_) >>
- IndexField::kShift);
+ return FloatRegister::from_code(register_code());
}
DoubleRegister GetDoubleRegister() const {
- // TODO(bbudge) Tighten this test to IsDoubleRegister when all code
- // generators are changed to use the correct Get*Register method.
+ // On platforms where FloatRegister, DoubleRegister, and Simd128Register
+ // are all the same type, it's convenient to treat everything as a
+ // DoubleRegister, so be lax about type checking here.
DCHECK(IsFPRegister());
- return DoubleRegister::from_code(static_cast<int64_t>(value_) >>
- IndexField::kShift);
+ return DoubleRegister::from_code(register_code());
}
Simd128Register GetSimd128Register() const {
DCHECK(IsSimd128Register());
- return Simd128Register::from_code(static_cast<int64_t>(value_) >>
- IndexField::kShift);
+ return Simd128Register::from_code(register_code());
}
LocationKind location_kind() const {
@@ -601,20 +605,25 @@
uint64_t InstructionOperand::GetCanonicalizedValue() const {
if (IsAllocated() || IsExplicit()) {
- // TODO(dcarney): put machine type last and mask.
- MachineRepresentation canonicalized_representation =
- IsFloatingPoint(LocationOperand::cast(this)->representation())
- ? MachineRepresentation::kFloat64
- : MachineRepresentation::kNone;
+ MachineRepresentation rep = LocationOperand::cast(this)->representation();
+ MachineRepresentation canonical = MachineRepresentation::kNone;
+ if (IsFloatingPoint(rep)) {
+ if (kSimpleFPAliasing) {
+ // Archs with simple aliasing can treat all FP operands the same.
+ canonical = MachineRepresentation::kFloat64;
+ } else {
+ // We need to distinguish FP operands of different reps when FP
+ // aliasing is not simple (e.g. ARM).
+ canonical = rep;
+ }
+ }
return InstructionOperand::KindField::update(
- LocationOperand::RepresentationField::update(
- this->value_, canonicalized_representation),
+ LocationOperand::RepresentationField::update(this->value_, canonical),
LocationOperand::EXPLICIT);
}
return this->value_;
}
-
// Required for maps that don't care about machine type.
struct CompareOperandModuloType {
bool operator()(const InstructionOperand& a,
@@ -649,9 +658,9 @@
}
void SetPending() { destination_ = InstructionOperand(); }
- // True if this move a move into the given destination operand.
- bool Blocks(const InstructionOperand& operand) const {
- return !IsEliminated() && source().EqualsCanonicalized(operand);
+ // True if this move is a move into the given destination operand.
+ bool Blocks(const InstructionOperand& destination) const {
+ return !IsEliminated() && source().InterferesWith(destination);
}
// A move is redundant if it's been eliminated or if its source and
@@ -1326,9 +1335,17 @@
return GetRepresentation(virtual_register) ==
MachineRepresentation::kTagged;
}
- bool IsFloat(int virtual_register) const {
+ bool IsFP(int virtual_register) const {
return IsFloatingPoint(GetRepresentation(virtual_register));
}
+ bool IsFloat(int virtual_register) const {
+ return GetRepresentation(virtual_register) ==
+ MachineRepresentation::kFloat32;
+ }
+ bool IsDouble(int virtual_register) const {
+ return GetRepresentation(virtual_register) ==
+ MachineRepresentation::kFloat64;
+ }
Instruction* GetBlockStart(RpoNumber rpo) const;