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
This commit is contained in:
svenpanne@chromium.org 2012-08-27 09:39:05 +00:00
parent a30eab48cf
commit 27c9ef9f79
8 changed files with 54 additions and 20 deletions

View File

@ -260,8 +260,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0;
virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0;
@ -273,6 +271,11 @@ class LInstruction: public ZoneObject {
#endif
private:
// Iterator support.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_;
@ -292,7 +295,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; }
@ -302,6 +304,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
};

View File

@ -4310,7 +4310,9 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
: LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32);
codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
SIGNED_INT32);
}
virtual LInstruction* instr() { return instr_; }
private:
@ -4333,7 +4335,9 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
: LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32);
codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
UNSIGNED_INT32);
}
virtual LInstruction* instr() { return instr_; }
private:
@ -4353,9 +4357,10 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
LOperand* value,
IntegerSignedness signedness) {
Label slow;
Register src = ToRegister(instr->InputAt(0));
Register src = ToRegister(value);
Register dst = ToRegister(instr->result());
DoubleRegister dbl_scratch = double_scratch0();
SwVfpRegister flt_scratch = dbl_scratch.low();

View File

@ -116,7 +116,9 @@ class LCodeGen BASE_EMBEDDED {
void DoDeferredNumberTagD(LNumberTagD* instr);
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 DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);

View File

@ -4107,7 +4107,9 @@ void LCodeGen::DoNumberTagI(LNumberTagI* instr) {
DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
: LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32);
codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
SIGNED_INT32);
}
virtual LInstruction* instr() { return instr_; }
private:
@ -4131,7 +4133,9 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
: LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() {
codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32);
codegen()->DoDeferredNumberTagI(instr_,
instr_->InputAt(0),
UNSIGNED_INT32);
}
virtual LInstruction* instr() { return instr_; }
private:
@ -4151,9 +4155,10 @@ void LCodeGen::DoNumberTagU(LNumberTagU* instr) {
void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
LOperand* value,
IntegerSignedness signedness) {
Label slow;
Register reg = ToRegister(instr->InputAt(0));
Register reg = ToRegister(value);
Register tmp = reg.is(eax) ? ecx : eax;
// Preserve the value of all registers.

View File

@ -107,7 +107,9 @@ class LCodeGen BASE_EMBEDDED {
void DoDeferredNumberTagD(LNumberTagD* instr);
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 DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);

View File

@ -256,8 +256,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0;
virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0;
@ -269,6 +267,11 @@ class LInstruction: public ZoneObject {
#endif
private:
// Iterator support.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_;
@ -288,7 +291,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; }
@ -298,6 +300,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
};

View File

@ -256,8 +256,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0;
virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0;
@ -269,6 +267,11 @@ class LInstruction: public ZoneObject {
#endif
private:
// Iterator interface.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_;
@ -289,7 +292,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; }
@ -299,6 +301,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
};

View File

@ -261,8 +261,6 @@ class LInstruction: public ZoneObject {
virtual bool HasResult() const = 0;
virtual LOperand* result() = 0;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
virtual int TempCount() = 0;
virtual LOperand* TempAt(int i) = 0;
@ -274,6 +272,11 @@ class LInstruction: public ZoneObject {
#endif
private:
// Iterator support.
friend class InputIterator;
virtual int InputCount() = 0;
virtual LOperand* InputAt(int i) = 0;
LEnvironment* environment_;
SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_;
@ -293,7 +296,6 @@ class LTemplateInstruction: public LInstruction {
void set_result(LOperand* operand) { results_[0] = operand; }
LOperand* result() { return results_[0]; }
int InputCount() { return I; }
LOperand* InputAt(int i) { return inputs_[i]; }
int TempCount() { return T; }
@ -303,6 +305,9 @@ class LTemplateInstruction: public LInstruction {
EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_;
EmbeddedContainer<LOperand*, T> temps_;
private:
virtual int InputCount() { return I; }
};