Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: src/ia32/lithium-ia32.h

Issue 6237002: Remove the remaining LOperand-members from concrete LIR instructions.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/lithium-ia32.h
===================================================================
--- src/ia32/lithium-ia32.h (revision 6288)
+++ src/ia32/lithium-ia32.h (working copy)
@@ -149,12 +149,14 @@
// LUnknownOSRValue
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
+ V(BinaryControlInstruction) \
V(BinaryOperation) \
V(Constant) \
V(Call) \
V(MaterializedLiteral) \
V(StoreKeyed) \
V(StoreNamed) \
+ V(UnaryControlInstruction) \
V(UnaryOperation) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
@@ -300,7 +302,9 @@
#define DECLARE_DO(type) virtual bool Is##type() const { return false; }
LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
#undef DECLARE_DO
+
virtual bool IsControl() const { return false; }
+ virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
Kevin Millikin (Chromium) 2011/01/13 08:45:59 Does this need to be on LInstruction? I would exp
fschneider 2011/01/13 13:03:25 The problem is that I can't cast to a LControlInst
void set_environment(LEnvironment* env) { environment_.set(env); }
LEnvironment* environment() const { return environment_.get(); }
@@ -342,6 +346,7 @@
int length() const { return N; }
T at(int i) const { return elems_[i]; }
Kevin Millikin (Chromium) 2011/01/13 08:45:59 This seems like a place that you could legitimatel
fschneider 2011/01/13 13:03:25 Done.
void set_at(int i, T value) { elems_[i] = value; }
+ void PrintOperandsTo(StringStream* stream);
private:
T elems_[N];
};
@@ -351,13 +356,7 @@
class OperandContainer<T, 0> {
public:
int length() const { return 0; }
- T at(int i) const {
- UNREACHABLE();
- return NULL;
- }
- void set_at(int i, T value) {
- UNREACHABLE();
- }
+ void PrintOperandsTo(StringStream* stream) { }
};
@@ -376,6 +375,7 @@
int TempCount() const { return temps_.length(); }
Kevin Millikin (Chromium) 2011/01/13 08:45:59 "return T"?
fschneider 2011/01/13 13:03:25 Done.
LOperand* TempAt(int i) const { return temps_.at(i); }
+ void SetTempAt(int i, LOperand* operand) { temps_.set_at(i, operand); }
virtual void PrintDataTo(StringStream* stream);
virtual void PrintOutputOperandTo(StringStream* stream);
@@ -513,10 +513,10 @@
};
-template<int R>
-class LUnaryOperation: public LTemplateInstruction<R, 1, 0> {
+template<int R, int T = 0>
+class LUnaryOperation: public LTemplateInstruction<R, 1, T> {
public:
- explicit LUnaryOperation<R>(LOperand* input) {
+ explicit LUnaryOperation(LOperand* input) {
this->SetInputAt(0, input);
}
@@ -526,8 +526,8 @@
};
-template<int R>
-class LBinaryOperation: public LTemplateInstruction<R, 2, 0> {
+template<int R, int T = 0>
Kevin Millikin (Chromium) 2011/01/13 08:45:59 We should strongly consider getting rid of classes
fschneider 2011/01/13 13:03:25 Done.
+class LBinaryOperation: public LTemplateInstruction<R, 2, T> {
public:
LBinaryOperation(LOperand* left, LOperand* right) {
this->SetInputAt(0, left);
Vitaly Repeshko 2011/01/13 11:44:07 We could have a convenience function SetInputs(inp
fschneider 2011/01/13 13:03:25 For this change I'd like to leave it more verbose
Vitaly Repeshko 2011/01/13 13:06:51 To implement this you define the function N times
@@ -541,6 +541,54 @@
};
+template<int T = 0>
+class LUnaryControlInstruction: public LUnaryOperation<0, T> {
+ public:
+ explicit LUnaryControlInstruction(LOperand* input)
+ : LUnaryOperation<0, T>(input),
+ true_block_id_(-1),
+ false_block_id_(-1) { }
+
+ DECLARE_INSTRUCTION(UnaryControlInstruction)
+ virtual bool IsControl() const { return true; }
+
+ int true_block_id() const { return true_block_id_; }
+ int false_block_id() const { return false_block_id_; }
+ void SetBranchTargets(int true_block_id, int false_block_id) {
+ true_block_id_ = true_block_id;
+ false_block_id_ = false_block_id;
+ }
+
+ private:
+ int true_block_id_;
+ int false_block_id_;
+};
+
+
+template<int T = 0>
+class LBinaryControlInstruction: public LBinaryOperation<0, T> {
+ public:
+ LBinaryControlInstruction(LOperand* left, LOperand* right)
+ : LBinaryOperation<0, T>(left, right),
+ true_block_id_(-1),
+ false_block_id_(-1) { }
+
+ DECLARE_INSTRUCTION(BinaryControlInstruction)
+ virtual bool IsControl() const { return true; }
+
+ int true_block_id() const { return true_block_id_; }
+ int false_block_id() const { return false_block_id_; }
+ void SetBranchTargets(int true_block_id, int false_block_id) {
+ true_block_id_ = true_block_id;
+ false_block_id_ = false_block_id;
+ }
+
+ private:
+ int true_block_id_;
+ int false_block_id_;
+};
+
+
class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
public:
LApplyArguments(LOperand* function,
@@ -597,37 +645,39 @@
};
-class LModI: public LBinaryOperation<1> {
+class LModI: public LBinaryOperation<1, 1> {
public:
- LModI(LOperand* left, LOperand* right) : LBinaryOperation<1>(left, right) { }
+ LModI(LOperand* left, LOperand* right, LOperand* temp)
+ : LBinaryOperation<1, 1>(left, right) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
DECLARE_HYDROGEN_ACCESSOR(Mod)
};
-class LDivI: public LBinaryOperation<1> {
+class LDivI: public LBinaryOperation<1, 1> {
public:
- LDivI(LOperand* left, LOperand* right)
- : LBinaryOperation<1>(left, right) { }
+ LDivI(LOperand* left, LOperand* right, LOperand* temp)
+ : LBinaryOperation<1, 1>(left, right) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
DECLARE_HYDROGEN_ACCESSOR(Div)
};
-class LMulI: public LBinaryOperation<1> {
+class LMulI: public LBinaryOperation<1, 1> {
public:
LMulI(LOperand* left, LOperand* right, LOperand* temp)
- : LBinaryOperation<1>(left, right), temp_(temp) { }
+ : LBinaryOperation<1, 1>(left, right) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
DECLARE_HYDROGEN_ACCESSOR(Mul)
-
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
};
@@ -636,36 +686,30 @@
LCmpID(LOperand* left, LOperand* right)
: LBinaryOperation<1>(left, right) { }
+ DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id")
+ DECLARE_HYDROGEN_ACCESSOR(Compare)
+
Token::Value op() const { return hydrogen()->token(); }
bool is_double() const {
return hydrogen()->GetInputRepresentation().IsDouble();
}
-
- DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id")
- DECLARE_HYDROGEN_ACCESSOR(Compare)
};
-class LCmpIDAndBranch: public LCmpID {
+class LCmpIDAndBranch: public LBinaryControlInstruction<> {
public:
- LCmpIDAndBranch(LOperand* left,
- LOperand* right,
- int true_block_id,
- int false_block_id)
- : LCmpID(left, right),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LCmpIDAndBranch(LOperand* left, LOperand* right)
+ : LBinaryControlInstruction<>(left, right) { }
DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
- virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
+ DECLARE_HYDROGEN_ACCESSOR(Compare)
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
+ Token::Value op() const { return hydrogen()->token(); }
+ bool is_double() const {
+ return hydrogen()->GetInputRepresentation().IsDouble();
+ }
- private:
- int true_block_id_;
- int false_block_id_;
+ virtual void PrintDataTo(StringStream* stream);
};
@@ -691,25 +735,13 @@
};
-class LCmpJSObjectEqAndBranch: public LCmpJSObjectEq {
+class LCmpJSObjectEqAndBranch: public LBinaryControlInstruction<> {
public:
- LCmpJSObjectEqAndBranch(LOperand* left,
- LOperand* right,
- int true_block_id,
- int false_block_id)
- : LCmpJSObjectEq(left, right),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LCmpJSObjectEqAndBranch(LOperand* left, LOperand* right)
+ : LBinaryControlInstruction<>(left, right) { }
DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch,
"cmp-jsobject-eq-and-branch")
-
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- private:
- int true_block_id_;
- int false_block_id_;
};
@@ -724,72 +756,44 @@
};
-class LIsNullAndBranch: public LIsNull {
+class LIsNullAndBranch: public LUnaryControlInstruction<1> {
public:
- LIsNullAndBranch(LOperand* value,
- LOperand* temp,
- int true_block_id,
- int false_block_id)
- : LIsNull(value),
- temp_(temp),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LIsNullAndBranch(LOperand* value, LOperand* temp)
+ : LUnaryControlInstruction<1>(value) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch, "is-null-and-branch")
- virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
+ DECLARE_HYDROGEN_ACCESSOR(IsNull)
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
+ bool is_strict() const { return hydrogen()->is_strict(); }
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
- int true_block_id_;
- int false_block_id_;
+ virtual void PrintDataTo(StringStream* stream);
};
-class LIsObject: public LUnaryOperation<1> {
+class LIsObject: public LUnaryOperation<1, 1> {
public:
LIsObject(LOperand* value, LOperand* temp)
- : LUnaryOperation<1>(value), temp_(temp) {}
+ : LUnaryOperation<1, 1>(value) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(IsObject, "is-object")
-
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
};
-class LIsObjectAndBranch: public LIsObject {
+class LIsObjectAndBranch: public LUnaryControlInstruction<2> {
public:
- LIsObjectAndBranch(LOperand* value,
- LOperand* temp,
- LOperand* temp2,
- int true_block_id,
- int false_block_id)
- : LIsObject(value, temp),
- temp2_(temp2),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LIsObjectAndBranch(LOperand* value, LOperand* temp, LOperand* temp2)
+ : LUnaryControlInstruction<2>(value) {
+ SetTempAt(0, temp);
+ SetTempAt(1, temp2);
+ }
DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
- virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- LOperand* temp2() const { return temp2_; }
-
- private:
- LOperand* temp2_;
- int true_block_id_;
- int false_block_id_;
+ virtual void PrintDataTo(StringStream* stream);
};
@@ -802,25 +806,14 @@
};
-class LIsSmiAndBranch: public LIsSmi {
+class LIsSmiAndBranch: public LUnaryControlInstruction<> {
public:
- LIsSmiAndBranch(LOperand* value,
- int true_block_id,
- int false_block_id)
- : LIsSmi(value),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ explicit LIsSmiAndBranch(LOperand* value)
+ : LUnaryControlInstruction<>(value) { }
DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
- virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- private:
- int true_block_id_;
- int false_block_id_;
+ virtual void PrintDataTo(StringStream* stream);
};
@@ -831,37 +824,21 @@
DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has-instance-type")
DECLARE_HYDROGEN_ACCESSOR(HasInstanceType)
-
- InstanceType TestType(); // The type to test against when generating code.
- Condition BranchCondition(); // The branch condition for 'true'.
};
-class LHasInstanceTypeAndBranch: public LHasInstanceType {
+class LHasInstanceTypeAndBranch: public LUnaryControlInstruction<1> {
public:
- LHasInstanceTypeAndBranch(LOperand* value,
- LOperand* temporary,
- int true_block_id,
- int false_block_id)
- : LHasInstanceType(value),
- temp_(temporary),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LHasInstanceTypeAndBranch(LOperand* value, LOperand* temp)
+ : LUnaryControlInstruction<1>(value) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
"has-instance-type-and-branch")
- virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
+ DECLARE_HYDROGEN_ACCESSOR(HasInstanceType)
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- LOperand* temp() { return temp_; }
-
- private:
- LOperand* temp_;
- int true_block_id_;
- int false_block_id_;
+ virtual void PrintDataTo(StringStream* stream);
};
@@ -874,71 +851,43 @@
};
-class LHasCachedArrayIndexAndBranch: public LHasCachedArrayIndex {
+class LHasCachedArrayIndexAndBranch: public LUnaryControlInstruction<> {
public:
- LHasCachedArrayIndexAndBranch(LOperand* value,
- int true_block_id,
- int false_block_id)
- : LHasCachedArrayIndex(value),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ explicit LHasCachedArrayIndexAndBranch(LOperand* value)
+ : LUnaryControlInstruction<>(value) { }
DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
"has-cached-array-index-and-branch")
virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
-
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- private:
- int true_block_id_;
- int false_block_id_;
};
-class LClassOfTest: public LUnaryOperation<1> {
+class LClassOfTest: public LUnaryOperation<1, 1> {
public:
- LClassOfTest(LOperand* value, LOperand* temp)
- : LUnaryOperation<1>(value), temporary_(temp) {}
+ LClassOfTest(LOperand* value, LOperand* temp) : LUnaryOperation<1, 1>(value) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class-of-test")
DECLARE_HYDROGEN_ACCESSOR(ClassOfTest)
virtual void PrintDataTo(StringStream* stream);
-
- LOperand* temporary() { return temporary_; }
-
- private:
- LOperand* temporary_;
};
-class LClassOfTestAndBranch: public LClassOfTest {
+class LClassOfTestAndBranch: public LUnaryControlInstruction<2> {
public:
- LClassOfTestAndBranch(LOperand* value,
- LOperand* temporary,
- LOperand* temporary2,
- int true_block_id,
- int false_block_id)
- : LClassOfTest(value, temporary),
- temporary2_(temporary2),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LClassOfTestAndBranch(LOperand* value, LOperand* temp, LOperand* temp2)
+ : LUnaryControlInstruction<2>(value) {
+ SetTempAt(0, temp);
+ SetTempAt(1, temp2);
+ }
DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
"class-of-test-and-branch")
- virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
+ DECLARE_HYDROGEN_ACCESSOR(ClassOfTest)
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
- LOperand* temporary2() { return temporary2_; }
-
- private:
- LOperand* temporary2_;
- int true_block_id_;
- int false_block_id_;
+ virtual void PrintDataTo(StringStream* stream);
};
@@ -953,24 +902,15 @@
};
-class LCmpTAndBranch: public LCmpT {
+class LCmpTAndBranch: public LBinaryControlInstruction<> {
public:
- LCmpTAndBranch(LOperand* left,
- LOperand* right,
- int true_block_id,
- int false_block_id)
- : LCmpT(left, right),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LCmpTAndBranch(LOperand* left, LOperand* right)
+ : LBinaryControlInstruction<>(left, right) { }
DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch")
+ DECLARE_HYDROGEN_ACCESSOR(Compare)
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- private:
- int true_block_id_;
- int false_block_id_;
+ Token::Value op() const { return hydrogen()->token(); }
};
@@ -983,41 +923,27 @@
};
-class LInstanceOfAndBranch: public LInstanceOf {
+class LInstanceOfAndBranch: public LBinaryControlInstruction<> {
public:
- LInstanceOfAndBranch(LOperand* left,
- LOperand* right,
- int true_block_id,
- int false_block_id)
- : LInstanceOf(left, right),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ LInstanceOfAndBranch(LOperand* left, LOperand* right)
+ : LBinaryControlInstruction<>(left, right) { }
DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch")
-
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- private:
- int true_block_id_;
- int false_block_id_;
};
-class LInstanceOfKnownGlobal: public LUnaryOperation<1> {
+class LInstanceOfKnownGlobal: public LUnaryOperation<1, 1> {
public:
LInstanceOfKnownGlobal(LOperand* left, LOperand* temp)
- : LUnaryOperation<1>(left), temp_(temp) { }
+ : LUnaryOperation<1, 1>(left) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
"instance-of-known-global")
DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
Handle<JSFunction> function() const { return hydrogen()->function(); }
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
};
@@ -1115,25 +1041,14 @@
};
-class LBranch: public LUnaryOperation<0> {
+class LBranch: public LUnaryControlInstruction<> {
public:
- LBranch(LOperand* input, int true_block_id, int false_block_id)
- : LUnaryOperation<0>(input),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ explicit LBranch(LOperand* input) : LUnaryControlInstruction<>(input) { }
DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
DECLARE_HYDROGEN_ACCESSOR(Value)
virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
-
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- private:
- int true_block_id_;
- int false_block_id_;
};
@@ -1174,18 +1089,15 @@
};
-class LValueOf: public LUnaryOperation<1> {
+class LValueOf: public LUnaryOperation<1, 1> {
public:
- LValueOf(LOperand* input, LOperand* temporary)
- : LUnaryOperation<1>(input), temporary_(temporary) { }
+ LValueOf(LOperand* input, LOperand* temp)
+ : LUnaryOperation<1, 1>(input) {
+ SetTempAt(0, temp);
+ }
- LOperand* temporary() const { return temporary_; }
-
DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
DECLARE_HYDROGEN_ACCESSOR(ValueOf)
-
- private:
- LOperand* temporary_;
};
@@ -1284,19 +1196,17 @@
};
-class LLoadFunctionPrototype: public LUnaryOperation<1> {
+class LLoadFunctionPrototype: public LUnaryOperation<1, 1> {
public:
- LLoadFunctionPrototype(LOperand* function, LOperand* temporary)
- : LUnaryOperation<1>(function), temporary_(temporary) { }
+ LLoadFunctionPrototype(LOperand* function, LOperand* temp)
+ : LUnaryOperation<1, 1>(function) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
LOperand* function() const { return input(); }
- LOperand* temporary() const { return temporary_; }
-
- private:
- LOperand* temporary_;
};
@@ -1381,8 +1291,12 @@
};
-class LCallKeyed: public LTemplateInstruction<1, 0, 0> {
+class LCallKeyed: public LTemplateInstruction<1, 0, 1> {
public:
+ explicit LCallKeyed(LOperand* temp) {
+ SetTempAt(0, temp);
+ }
+
DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
@@ -1476,51 +1390,43 @@
};
-class LNumberTagD: public LUnaryOperation<1> {
+class LNumberTagD: public LUnaryOperation<1, 1> {
public:
explicit LNumberTagD(LOperand* value, LOperand* temp)
- : LUnaryOperation<1>(value), temp_(temp) { }
+ : LUnaryOperation<1, 1>(value) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
-
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
};
// Sometimes truncating conversion from a tagged value to an int32.
-class LDoubleToI: public LUnaryOperation<1> {
+class LDoubleToI: public LUnaryOperation<1, 1> {
public:
- LDoubleToI(LOperand* value, LOperand* temporary)
- : LUnaryOperation<1>(value), temporary_(temporary) { }
+ LDoubleToI(LOperand* value, LOperand* temp) : LUnaryOperation<1, 1>(value) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
DECLARE_HYDROGEN_ACCESSOR(Change)
bool truncating() { return hydrogen()->CanTruncateToInt32(); }
- LOperand* temporary() const { return temporary_; }
-
- private:
- LOperand* temporary_;
};
// Truncating conversion from a tagged value to an int32.
-class LTaggedToI: public LUnaryOperation<1> {
+class LTaggedToI: public LUnaryOperation<1, 1> {
public:
LTaggedToI(LOperand* value, LOperand* temp)
- : LUnaryOperation<1>(value), temp_(temp) { }
+ : LUnaryOperation<1, 1>(value) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
DECLARE_HYDROGEN_ACCESSOR(Change)
bool truncating() { return hydrogen()->CanTruncateToInt32(); }
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
};
@@ -1554,7 +1460,7 @@
};
-class LStoreNamed: public LTemplateInstruction<0, 2, 0> {
+class LStoreNamed: public LTemplateInstruction<0, 2, 1> {
public:
LStoreNamed(LOperand* obj, LOperand* val) {
this->SetInputAt(0, obj);
@@ -1575,7 +1481,9 @@
class LStoreNamedField: public LStoreNamed {
public:
LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp)
- : LStoreNamed(obj, val), temp_(temp) { }
+ : LStoreNamed(obj, val) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
@@ -1584,11 +1492,6 @@
int offset() { return hydrogen()->offset(); }
bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
Handle<Map> transition() const { return hydrogen()->transition(); }
-
- LOperand* temp() { return temp_; }
-
- private:
- LOperand* temp_;
};
@@ -1649,18 +1552,15 @@
};
-class LCheckInstanceType: public LUnaryOperation<0> {
+class LCheckInstanceType: public LUnaryOperation<0, 1> {
public:
LCheckInstanceType(LOperand* use, LOperand* temp)
- : LUnaryOperation<0>(use), temp_(temp) { }
+ : LUnaryOperation<0, 1>(use) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
-
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
};
@@ -1673,20 +1573,17 @@
};
-class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 0> {
+class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> {
public:
- explicit LCheckPrototypeMaps(LOperand* temp) : temp_(temp) { }
+ explicit LCheckPrototypeMaps(LOperand* temp) {
+ SetTempAt(0, temp);
+ }
DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
Handle<JSObject> holder() const { return hydrogen()->holder(); }
Handle<Map> receiver_map() const { return hydrogen()->receiver_map(); }
-
- LOperand* temp() const { return temp_; }
-
- private:
- LOperand* temp_;
};
@@ -1754,35 +1651,27 @@
class LTypeofIs: public LUnaryOperation<1> {
public:
explicit LTypeofIs(LOperand* input) : LUnaryOperation<1>(input) { }
- virtual void PrintDataTo(StringStream* stream);
DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof-is")
DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
Handle<String> type_literal() { return hydrogen()->type_literal(); }
+
+ virtual void PrintDataTo(StringStream* stream);
};
-class LTypeofIsAndBranch: public LTypeofIs {
+class LTypeofIsAndBranch: public LUnaryControlInstruction<> {
public:
- LTypeofIsAndBranch(LOperand* value,
- int true_block_id,
- int false_block_id)
- : LTypeofIs(value),
- true_block_id_(true_block_id),
- false_block_id_(false_block_id) { }
+ explicit LTypeofIsAndBranch(LOperand* value)
+ : LUnaryControlInstruction<>(value) { }
DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
+ DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
- virtual void PrintDataTo(StringStream* stream);
- virtual bool IsControl() const { return true; }
+ Handle<String> type_literal() { return hydrogen()->type_literal(); }
- int true_block_id() const { return true_block_id_; }
- int false_block_id() const { return false_block_id_; }
-
- private:
- int true_block_id_;
- int false_block_id_;
+ virtual void PrintDataTo(StringStream* stream);
};
@@ -1938,9 +1827,10 @@
LUnallocated* ToUnallocated(XMMRegister reg);
// Methods for setting up define-use relationships.
- LOperand* Use(HValue* value, LUnallocated* operand);
- LOperand* UseFixed(HValue* value, Register fixed_register);
- LOperand* UseFixedDouble(HValue* value, XMMRegister fixed_register);
+ MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
+ MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
+ MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
+ XMMRegister fixed_register);
// A value that is guaranteed to be allocated to a register.
// Operand created by UseRegister is guaranteed to be live until the end of
@@ -1950,18 +1840,23 @@
// instruction start. Register allocator is free to assign the same register
// to some other operand used inside instruction (i.e. temporary or
// output).
- LOperand* UseRegister(HValue* value);
- LOperand* UseRegisterAtStart(HValue* value);
+ MUST_USE_RESULT LOperand* UseRegister(HValue* value);
+ MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
// A value in a register that may be trashed.
- LOperand* UseTempRegister(HValue* value);
- LOperand* Use(HValue* value);
- LOperand* UseAtStart(HValue* value);
- LOperand* UseOrConstant(HValue* value);
- LOperand* UseOrConstantAtStart(HValue* value);
- LOperand* UseRegisterOrConstant(HValue* value);
- LOperand* UseRegisterOrConstantAtStart(HValue* value);
+ MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
+ MUST_USE_RESULT LOperand* Use(HValue* value);
+ MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
+ MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
+ MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
+ MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
+ MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
+ // Temporary operand that must be in a register.
+ MUST_USE_RESULT LUnallocated* TempRegister();
+ MUST_USE_RESULT LOperand* FixedTemp(Register reg);
+ MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg);
+
// Methods for setting up define-use relationships.
// Return the same instruction that they are passed.
template<int I, int T>
@@ -2002,11 +1897,6 @@
LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env);
- // Temporary operand that must be in a register.
- LUnallocated* TempRegister();
- LOperand* FixedTemp(Register reg);
- LOperand* FixedTemp(XMMRegister reg);
-
void VisitInstruction(HInstruction* current);
void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);

Powered by Google App Engine
This is Rietveld 408576698