Bug 885179 - Refactor visitMoveGroup into shared code. r=jandem

This commit is contained in:
Dan Gohman 2013-06-28 11:34:55 -07:00
Родитель 91be8654dd
Коммит 7e4affa0df
6 изменённых файлов: 39 добавлений и 78 удалений

Просмотреть файл

@ -15,6 +15,7 @@
#include "ion/IonSpewer.h"
#include "ion/MIRGenerator.h"
#include "ion/shared/CodeGenerator-shared-inl.h"
#include "ion/MoveEmitter.h"
#include "jsnum.h"
#include "jsmath.h"
#include "ion/ParallelFunctions.h"
@ -947,6 +948,43 @@ CodeGenerator::visitStackArgV(LStackArgV *lir)
return pushedArgumentSlots_.append(StackOffsetToSlot(stack_offset));
}
bool
CodeGenerator::visitMoveGroup(LMoveGroup *group)
{
if (!group->numMoves())
return true;
MoveResolver &resolver = masm.moveResolver();
for (size_t i = 0; i < group->numMoves(); i++) {
const LMove &move = group->getMove(i);
const LAllocation *from = move.from();
const LAllocation *to = move.to();
// No bogus moves.
JS_ASSERT(*from != *to);
JS_ASSERT(!from->isConstant());
JS_ASSERT(from->isDouble() == to->isDouble());
MoveResolver::Move::Kind kind = from->isDouble()
? MoveResolver::Move::DOUBLE
: MoveResolver::Move::GENERAL;
if (!resolver.addMove(toMoveOperand(from), toMoveOperand(to), kind))
return false;
}
if (!resolver.resolve())
return false;
MoveEmitter emitter(masm);
emitter.emit(resolver);
emitter.finish();
return true;
}
bool
CodeGenerator::visitInteger(LInteger *lir)
{

Просмотреть файл

@ -65,6 +65,7 @@ class CodeGenerator : public CodeGeneratorSpecific
bool visitOsrScopeChain(LOsrScopeChain *lir);
bool visitStackArgT(LStackArgT *lir);
bool visitStackArgV(LStackArgV *lir);
bool visitMoveGroup(LMoveGroup *group);
bool visitValueToInt32(LValueToInt32 *lir);
bool visitValueToDouble(LValueToDouble *lir);
bool visitInt32ToDouble(LInt32ToDouble *lir);

Просмотреть файл

@ -16,7 +16,6 @@
#include "ion/IonFrames.h"
#include "ion/MIR.h"
#include "ion/MIRGraph.h"
#include "ion/MoveEmitter.h"
#include "ion/shared/CodeGenerator-shared-inl.h"
#include "vm/Shape.h"
@ -945,43 +944,6 @@ CodeGeneratorARM::toMoveOperand(const LAllocation *a) const
return MoveOperand(StackPointer, offset);
}
bool
CodeGeneratorARM::visitMoveGroup(LMoveGroup *group)
{
if (!group->numMoves())
return true;
MoveResolver &resolver = masm.moveResolver();
for (size_t i = 0; i < group->numMoves(); i++) {
const LMove &move = group->getMove(i);
const LAllocation *from = move.from();
const LAllocation *to = move.to();
// No bogus moves.
JS_ASSERT(*from != *to);
JS_ASSERT(!from->isConstant());
JS_ASSERT(from->isDouble() == to->isDouble());
MoveResolver::Move::Kind kind = from->isDouble()
? MoveResolver::Move::DOUBLE
: MoveResolver::Move::GENERAL;
if (!resolver.addMove(toMoveOperand(from), toMoveOperand(to), kind))
return false;
}
if (!resolver.resolve())
return false;
MoveEmitter emitter(masm);
emitter.emit(resolver);
emitter.finish();
return true;
}
class js::ion::OutOfLineTableSwitch : public OutOfLineCodeBase<CodeGeneratorARM>
{
MTableSwitch *mir_;

Просмотреть файл

@ -81,7 +81,6 @@ class CodeGeneratorARM : public CodeGeneratorShared
virtual bool visitModPowTwoI(LModPowTwoI *ins);
virtual bool visitModMaskI(LModMaskI *ins);
virtual bool visitPowHalfD(LPowHalfD *ins);
virtual bool visitMoveGroup(LMoveGroup *group);
virtual bool visitShiftI(LShiftI *ins);
virtual bool visitUrshD(LUrshD *ins);

Просмотреть файл

@ -12,7 +12,6 @@
#include "ion/shared/CodeGenerator-x86-shared.h"
#include "ion/shared/CodeGenerator-shared-inl.h"
#include "ion/IonFrames.h"
#include "ion/MoveEmitter.h"
#include "ion/IonCompartment.h"
#include "ion/ParallelFunctions.h"
@ -1035,43 +1034,6 @@ CodeGeneratorX86Shared::toMoveOperand(const LAllocation *a) const
return MoveOperand(StackPointer, ToStackOffset(a));
}
bool
CodeGeneratorX86Shared::visitMoveGroup(LMoveGroup *group)
{
if (!group->numMoves())
return true;
MoveResolver &resolver = masm.moveResolver();
for (size_t i = 0; i < group->numMoves(); i++) {
const LMove &move = group->getMove(i);
const LAllocation *from = move.from();
const LAllocation *to = move.to();
// No bogus moves.
JS_ASSERT(*from != *to);
JS_ASSERT(!from->isConstant());
JS_ASSERT(from->isDouble() == to->isDouble());
MoveResolver::Move::Kind kind = from->isDouble()
? MoveResolver::Move::DOUBLE
: MoveResolver::Move::GENERAL;
if (!resolver.addMove(toMoveOperand(from), toMoveOperand(to), kind))
return false;
}
if (!resolver.resolve())
return false;
MoveEmitter emitter(masm);
emitter.emit(resolver);
emitter.finish();
return true;
}
class OutOfLineTableSwitch : public OutOfLineCodeBase<CodeGeneratorX86Shared>
{
MTableSwitch *mir_;

Просмотреть файл

@ -91,7 +91,6 @@ class CodeGeneratorX86Shared : public CodeGeneratorShared
virtual bool visitBitOpI(LBitOpI *ins);
virtual bool visitShiftI(LShiftI *ins);
virtual bool visitUrshD(LUrshD *ins);
virtual bool visitMoveGroup(LMoveGroup *group);
virtual bool visitTestIAndBranch(LTestIAndBranch *test);
virtual bool visitTestDAndBranch(LTestDAndBranch *test);
virtual bool visitCompare(LCompare *comp);