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 { ...@@ -93,7 +93,9 @@ class LCodeGen BASE_EMBEDDED {
void FinishCode(Handle<Code> code); void FinishCode(Handle<Code> code);
// Deferred code support. // 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 DoDeferredNumberTagD(LNumberTagD* instr);
void DoDeferredNumberTagI(LNumberTagI* instr); void DoDeferredNumberTagI(LNumberTagI* instr);
void DoDeferredTaggedToI(LTaggedToI* instr); void DoDeferredTaggedToI(LTaggedToI* instr);
......
...@@ -921,9 +921,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) { ...@@ -921,9 +921,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
instr = AssignEnvironment(instr); instr = AssignEnvironment(instr);
} }
if (current->IsTest() && !instr->IsGoto()) { 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()); ASSERT(instr->IsControl());
HTest* test = HTest::cast(current); HTest* test = HTest::cast(current);
instr->set_hydrogen_value(test->value()); instr->set_hydrogen_value(test->value());
......
...@@ -339,32 +339,35 @@ class LInstruction: public ZoneObject { ...@@ -339,32 +339,35 @@ class LInstruction: public ZoneObject {
}; };
template<typename T, int N> template<typename ElementType, int NumElements>
class OperandContainer { class OperandContainer {
public: public:
OperandContainer() { 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; } int length() { return NumElements; }
T& operator[](int i) { ElementType& operator[](int i) {
ASSERT(i < length()); ASSERT(i < length());
return elems_[i]; return elems_[i];
} }
void PrintOperandsTo(StringStream* stream); void PrintOperandsTo(StringStream* stream);
private: private:
T elems_[N]; ElementType elems_[NumElements];
}; };
template<typename T> template<typename ElementType>
class OperandContainer<T, 0> { class OperandContainer<ElementType, 0> {
public: public:
int length() { return 0; } int length() { return 0; }
void PrintOperandsTo(StringStream* stream) { } 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> template<int R, int I, int T>
class LTemplateInstruction: public LInstruction { class LTemplateInstruction: public LInstruction {
public: public:
...@@ -1436,7 +1439,7 @@ class LNumberTagI: public LTemplateInstruction<1, 1, 0> { ...@@ -1436,7 +1439,7 @@ class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
class LNumberTagD: public LTemplateInstruction<1, 1, 1> { class LNumberTagD: public LTemplateInstruction<1, 1, 1> {
public: public:
explicit LNumberTagD(LOperand* value, LOperand* temp) { LNumberTagD(LOperand* value, LOperand* temp) {
inputs_[0] = value; inputs_[0] = value;
temps_[0] = temp; temps_[0] = temp;
} }
......
...@@ -848,9 +848,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) { ...@@ -848,9 +848,6 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {
instr = AssignEnvironment(instr); instr = AssignEnvironment(instr);
} }
if (current->IsTest() && !instr->IsGoto()) { 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()); ASSERT(instr->IsControl());
HTest* test = HTest::cast(current); HTest* test = HTest::cast(current);
instr->set_hydrogen_value(test->value()); instr->set_hydrogen_value(test->value());
......
...@@ -335,32 +335,35 @@ class LInstruction: public ZoneObject { ...@@ -335,32 +335,35 @@ class LInstruction: public ZoneObject {
}; };
template<typename T, int N> template<typename ElementType, int NumElements>
class OperandContainer { class OperandContainer {
public: public:
OperandContainer() { 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; } int length() { return NumElements; }
T& operator[](int i) { ElementType& operator[](int i) {
ASSERT(i < length()); ASSERT(i < length());
return elems_[i]; return elems_[i];
} }
void PrintOperandsTo(StringStream* stream); void PrintOperandsTo(StringStream* stream);
private: private:
T elems_[N]; ElementType elems_[NumElements];
}; };
template<typename T> template<typename ElementType>
class OperandContainer<T, 0> { class OperandContainer<ElementType, 0> {
public: public:
int length() { return 0; } int length() { return 0; }
void PrintOperandsTo(StringStream* stream) { } 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> template<int R, int I, int T>
class LTemplateInstruction: public LInstruction { class LTemplateInstruction: public LInstruction {
public: 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