Port lithium template classes to ARM.

This is a port of the IA32 version and is needed to allow 
changing the register allocator interface in a later change.



Review URL: http://codereview.chromium.org/6250027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6436 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b5151d11
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -93,7 +93,9 @@ class LCodeGen BASE_EMBEDDED {
void FinishCode(Handle<Code> code);
// Deferred code support.
void DoDeferredGenericBinaryStub(LBinaryOperation* instr, Token::Value op);
template<int T>
void DoDeferredGenericBinaryStub(LTemplateInstruction<1, 2, T>* instr,
Token::Value op);
void DoDeferredNumberTagD(LNumberTagD* instr);
void DoDeferredNumberTagI(LNumberTagI* instr);
void DoDeferredTaggedToI(LTaggedToI* instr);
......
......@@ -921,9 +921,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
instr = AssignEnvironment(instr);
}
if (current->IsTest() && !instr->IsGoto()) {
// TODO(fschneider): Handle test instructions uniformly like
// other instructions. This requires us to generate the right
// branch instruction already at the HIR level.
ASSERT(instr->IsControl());
HTest* test = HTest::cast(current);
instr->set_hydrogen_value(test->value());
......
......@@ -339,32 +339,35 @@ class LInstruction: public ZoneObject {
};
template<typename T, int N>
template<typename ElementType, int NumElements>
class OperandContainer {
public:
OperandContainer() {
for (int i = 0; i < N; i++) elems_[i] = NULL;
for (int i = 0; i < NumElements; i++) elems_[i] = NULL;
}
int length() { return N; }
T& operator[](int i) {
int length() { return NumElements; }
ElementType& operator[](int i) {
ASSERT(i < length());
return elems_[i];
}
void PrintOperandsTo(StringStream* stream);
private:
T elems_[N];
ElementType elems_[NumElements];
};
template<typename T>
class OperandContainer<T, 0> {
template<typename ElementType>
class OperandContainer<ElementType, 0> {
public:
int length() { return 0; }
void PrintOperandsTo(StringStream* stream) { }
};
// R = number of result operands (0 or 1).
// I = number of input operands.
// T = number of temporary operands.
template<int R, int I, int T>
class LTemplateInstruction: public LInstruction {
public:
......@@ -1436,7 +1439,7 @@ class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
class LNumberTagD: public LTemplateInstruction<1, 1, 1> {
public:
explicit LNumberTagD(LOperand* value, LOperand* temp) {
LNumberTagD(LOperand* value, LOperand* temp) {
inputs_[0] = value;
temps_[0] = temp;
}
......
......@@ -848,9 +848,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
instr = AssignEnvironment(instr);
}
if (current->IsTest() && !instr->IsGoto()) {
// TODO(fschneider): Handle test instructions uniformly like
// other instructions. This requires us to generate the right
// branch instruction already at the HIR level.
ASSERT(instr->IsControl());
HTest* test = HTest::cast(current);
instr->set_hydrogen_value(test->value());
......
......@@ -335,32 +335,35 @@ class LInstruction: public ZoneObject {
};
template<typename T, int N>
template<typename ElementType, int NumElements>
class OperandContainer {
public:
OperandContainer() {
for (int i = 0; i < N; i++) elems_[i] = NULL;
for (int i = 0; i < NumElements; i++) elems_[i] = NULL;
}
int length() { return N; }
T& operator[](int i) {
int length() { return NumElements; }
ElementType& operator[](int i) {
ASSERT(i < length());
return elems_[i];
}
void PrintOperandsTo(StringStream* stream);
private:
T elems_[N];
ElementType elems_[NumElements];
};
template<typename T>
class OperandContainer<T, 0> {
template<typename ElementType>
class OperandContainer<ElementType, 0> {
public:
int length() { return 0; }
void PrintOperandsTo(StringStream* stream) { }
};
// R = number of result operands (0 or 1).
// I = number of input operands.
// T = number of temporary operands.
template<int R, int I, int T>
class LTemplateInstruction: public LInstruction {
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment