First steps towards named Litihium operands.

Accessing Lithium operands via position is fragile and makes it impossible to
statically find all uses of a given operand. This CL is a step towards cleaning
this up, more to come...

Review URL: https://chromiumcodereview.appspot.com/10878073

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12383 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a30eab48
...@@ -260,8 +260,6 @@ class LInstruction: public ZoneObject { ...@@ -260,8 +260,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0; virtual bool HasResult() const = 0;
virtual LOperand* result() = 0; virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0; virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0; virtual LOperand* TempAt(int i) = 0;
...@@ -273,6 +271,11 @@ class LInstruction: public ZoneObject { ...@@ -273,6 +271,11 @@ class LInstruction: public ZoneObject {
#endif #endif
private: private:
// Iterator support.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_; LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_; SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_; HValue* hydrogen_value_;
...@@ -292,7 +295,6 @@ class LTemplateInstruction: public LInstruction { ...@@ -292,7 +295,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; } void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; } LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; } LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; } int TempCount() { return T; }
...@@ -302,6 +304,9 @@ class LTemplateInstruction: public LInstruction { ...@@ -302,6 +304,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_; EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_; EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_; EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
}; };
......
...@@ -4310,7 +4310,9 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) { ...@@ -4310,7 +4310,9 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() { virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32); codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
SIGNED_INT32);
} }
virtual LInstruction* instr() { return instr_; } virtual LInstruction* instr() { return instr_; }
private: private:
...@@ -4333,7 +4335,9 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { ...@@ -4333,7 +4335,9 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() { virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32); codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
UNSIGNED_INT32);
} }
virtual LInstruction* instr() { return instr_; } virtual LInstruction* instr() { return instr_; }
private: private:
...@@ -4353,9 +4357,10 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { ...@@ -4353,9 +4357,10 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
LOperand* value,
IntegerSignedness signedness) { IntegerSignedness signedness) {
Label slow; Label slow;
Register src = ToRegister(instr->InputAt(0)); Register src = ToRegister(value);
Register dst = ToRegister(instr->result()); Register dst = ToRegister(instr->result());
DoubleRegister dbl_scratch = double_scratch0(); DoubleRegister dbl_scratch = double_scratch0();
SwVfpRegister flt_scratch = dbl_scratch.low(); SwVfpRegister flt_scratch = dbl_scratch.low();
......
...@@ -116,7 +116,9 @@ class LCodeGen BASE_EMBEDDED { ...@@ -116,7 +116,9 @@ class LCodeGen BASE_EMBEDDED {
void DoDeferredNumberTagD(LNumberTagD* instr); void DoDeferredNumberTagD(LNumberTagD* instr);
enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 }; enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 };
void DoDeferredNumberTagI(LInstruction* instr, IntegerSignedness signedness); void DoDeferredNumberTagI(LInstruction* instr,
LOperand* value,
IntegerSignedness signedness);
void DoDeferredTaggedToI(LTaggedToI* instr); void DoDeferredTaggedToI(LTaggedToI* instr);
void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
......
...@@ -4107,7 +4107,9 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) { ...@@ -4107,7 +4107,9 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() { virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32); codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
SIGNED_INT32);
} }
virtual LInstruction* instr() { return instr_; } virtual LInstruction* instr() { return instr_; }
private: private:
...@@ -4131,7 +4133,9 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { ...@@ -4131,7 +4133,9 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr) DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
: LDeferredCode(codegen), instr_(instr) { } : LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() { virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32); codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
UNSIGNED_INT32);
} }
virtual LInstruction* instr() { return instr_; } virtual LInstruction* instr() { return instr_; }
private: private:
...@@ -4151,9 +4155,10 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) { ...@@ -4151,9 +4155,10 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
void LCodeGen::DoDeferredNumberTagI(LInstruction* instr, void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
LOperand* value,
IntegerSignedness signedness) { IntegerSignedness signedness) {
Label slow; Label slow;
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(value);
Register tmp = reg.is(eax) ? ecx : eax; Register tmp = reg.is(eax) ? ecx : eax;
// Preserve the value of all registers. // Preserve the value of all registers.
......
...@@ -107,7 +107,9 @@ class LCodeGen BASE_EMBEDDED { ...@@ -107,7 +107,9 @@ class LCodeGen BASE_EMBEDDED {
void DoDeferredNumberTagD(LNumberTagD* instr); void DoDeferredNumberTagD(LNumberTagD* instr);
enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 }; enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 };
void DoDeferredNumberTagI(LInstruction* instr, IntegerSignedness signedness); void DoDeferredNumberTagI(LInstruction* instr,
LOperand* value,
IntegerSignedness signedness);
void DoDeferredTaggedToI(LTaggedToI* instr); void DoDeferredTaggedToI(LTaggedToI* instr);
void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
......
...@@ -256,8 +256,6 @@ class LInstruction: public ZoneObject { ...@@ -256,8 +256,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0; virtual bool HasResult() const = 0;
virtual LOperand* result() = 0; virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0; virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0; virtual LOperand* TempAt(int i) = 0;
...@@ -269,6 +267,11 @@ class LInstruction: public ZoneObject { ...@@ -269,6 +267,11 @@ class LInstruction: public ZoneObject {
#endif #endif
private: private:
// Iterator support.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_; LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_; SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_; HValue* hydrogen_value_;
...@@ -288,7 +291,6 @@ class LTemplateInstruction: public LInstruction { ...@@ -288,7 +291,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; } void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; } LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; } LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; } int TempCount() { return T; }
...@@ -298,6 +300,9 @@ class LTemplateInstruction: public LInstruction { ...@@ -298,6 +300,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_; EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_; EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_; EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
}; };
......
...@@ -256,8 +256,6 @@ class LInstruction: public ZoneObject { ...@@ -256,8 +256,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0; virtual bool HasResult() const = 0;
virtual LOperand* result() = 0; virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0; virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0; virtual LOperand* TempAt(int i) = 0;
...@@ -269,6 +267,11 @@ class LInstruction: public ZoneObject { ...@@ -269,6 +267,11 @@ class LInstruction: public ZoneObject {
#endif #endif
private: private:
// Iterator interface.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_; LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_; SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_; HValue* hydrogen_value_;
...@@ -289,7 +292,6 @@ class LTemplateInstruction: public LInstruction { ...@@ -289,7 +292,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; } void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; } LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; } LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; } int TempCount() { return T; }
...@@ -299,6 +301,9 @@ class LTemplateInstruction: public LInstruction { ...@@ -299,6 +301,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_; EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_; EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_; EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
}; };
......
...@@ -261,8 +261,6 @@ class LInstruction: public ZoneObject { ...@@ -261,8 +261,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0; virtual bool HasResult() const = 0;
virtual LOperand* result() = 0; virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0; virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0; virtual LOperand* TempAt(int i) = 0;
...@@ -274,6 +272,11 @@ class LInstruction: public ZoneObject { ...@@ -274,6 +272,11 @@ class LInstruction: public ZoneObject {
#endif #endif
private: private:
// Iterator support.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_; LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_; SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_; HValue* hydrogen_value_;
...@@ -293,7 +296,6 @@ class LTemplateInstruction: public LInstruction { ...@@ -293,7 +296,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; } void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; } LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; } LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; } int TempCount() { return T; }
...@@ -303,6 +305,9 @@ class LTemplateInstruction: public LInstruction { ...@@ -303,6 +305,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_; EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_; EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_; EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
}; };
......
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