From 1cfab090fae6dc30b391bb91ca505aeb95985fcb Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Fri, 26 Apr 2013 14:05:08 +0200 Subject: [PATCH] Bug 863018 part 1 - Fix regalloc issue with useFixed/tempFixed and safepoints. r=bhackett --- js/src/ion/LiveRangeAllocator.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/js/src/ion/LiveRangeAllocator.cpp b/js/src/ion/LiveRangeAllocator.cpp index 154c2767204b..91cbb6dca633 100644 --- a/js/src/ion/LiveRangeAllocator.cpp +++ b/js/src/ion/LiveRangeAllocator.cpp @@ -462,6 +462,19 @@ LiveRangeAllocator::init() return true; } +static void +AddRegisterToSafepoint(LSafepoint *safepoint, AnyRegister reg, const LDefinition &def) +{ + safepoint->addLiveRegister(reg); + + JS_ASSERT(def.type() == LDefinition::GENERAL || + def.type() == LDefinition::DOUBLE || + def.type() == LDefinition::OBJECT); + + if (def.type() == LDefinition::OBJECT) + safepoint->addGcRegister(reg.gpr()); +} + /* * This function builds up liveness intervals for all virtual registers * defined in the function. Additionally, it populates the liveIn array with @@ -618,6 +631,11 @@ LiveRangeAllocator::buildLivenessInfo() AnyRegister reg = temp->output()->toRegister(); if (!addFixedRangeAtHead(reg, inputOf(*ins), outputOf(*ins))) return false; + + // Fixed intervals are not added to safepoints, so do it + // here. + if (LSafepoint *safepoint = ins->safepoint()) + AddRegisterToSafepoint(safepoint, reg, *temp); } else { JS_ASSERT(!ins->isCall()); if (!vregs[temp].getInterval(0)->addRangeAtHead(inputOf(*ins), outputOf(*ins))) @@ -680,6 +698,12 @@ LiveRangeAllocator::buildLivenessInfo() if (!addFixedRangeAtHead(reg, inputOf(*ins), outputOf(*ins))) return false; to = inputOf(*ins); + + // Fixed intervals are not added to safepoints, so do it + // here. + LSafepoint *safepoint = ins->safepoint(); + if (!ins->isCall() && safepoint) + AddRegisterToSafepoint(safepoint, reg, *vregs[use].def()); } else { to = use->usedAtStart() ? inputOf(*ins) : outputOf(*ins); }