[turbofan]: Fix bug in register hinting
authordanno <danno@chromium.org>
Mon, 17 Aug 2015 12:43:59 +0000 (05:43 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 17 Aug 2015 12:44:05 +0000 (12:44 +0000)
Previously, UsePositions for Phis that are constant LiveRanges which are also used
as hints for other USePositions would always force-allocate the first register in
the allocatable register file to that range.

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

Cr-Commit-Position: refs/heads/master@{#30193}

src/compiler/register-allocator.cc

index 4a222a43bef66c2c22008e2a5ddbb8d2113f6a11..28c99b95544ba4e7c3839730f5e4ab117f0e3087 100644 (file)
@@ -196,8 +196,11 @@ void UsePosition::ResolveHint(UsePosition* use_pos) {
 
 void UsePosition::set_type(UsePositionType type, bool register_beneficial) {
   DCHECK_IMPLIES(type == UsePositionType::kRequiresSlot, !register_beneficial);
+  DCHECK_EQ(kUnassignedRegister, AssignedRegisterField::decode(flags_));
   flags_ = TypeField::encode(type) |
-           RegisterBeneficialField::encode(register_beneficial);
+           RegisterBeneficialField::encode(register_beneficial) |
+           HintTypeField::encode(HintTypeField::decode(flags_)) |
+           AssignedRegisterField::encode(kUnassignedRegister);
 }