зеркало из https://github.com/mozilla/gecko-dev.git
Bug 885179 - Refactor visitMoveGroup into shared code. r=jandem
This commit is contained in:
Родитель
91be8654dd
Коммит
7e4affa0df
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче