Revision: 6910
Author: [email protected]
Date: Wed Feb 23 03:19:50 2011
Log: HIR refactoring.
Review URL: http://codereview.chromium.org/6538080
http://code.google.com/p/v8/source/detail?r=6910
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/hydrogen-instructions.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.h
/branches/bleeding_edge/src/x64/lithium-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Wed Feb 23 02:41:13 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Wed Feb 23 03:19:50 2011
@@ -346,7 +346,7 @@
}
-void LStoreNamed::PrintDataTo(StringStream* stream) {
+void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add(".");
stream->Add(*String::cast(*name())->ToCString());
@@ -355,7 +355,25 @@
}
-void LStoreKeyed::PrintDataTo(StringStream* stream) {
+void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
+ object()->PrintTo(stream);
+ stream->Add(".");
+ stream->Add(*String::cast(*name())->ToCString());
+ stream->Add(" <- ");
+ value()->PrintTo(stream);
+}
+
+
+void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
+ object()->PrintTo(stream);
+ stream->Add("[");
+ key()->PrintTo(stream);
+ stream->Add("] <- ");
+ value()->PrintTo(stream);
+}
+
+
+void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add("[");
key()->PrintTo(stream);
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Wed Feb 23 02:41:13 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Wed Feb 23 03:19:50 2011
@@ -42,8 +42,6 @@
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
V(ControlInstruction) \
V(Call) \
- V(StoreKeyed) \
- V(StoreNamed) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
@@ -1523,32 +1521,22 @@
};
-class LStoreNamed: public LTemplateInstruction<0, 2, 0> {
+class LStoreNamedField: public LTemplateInstruction<0, 2, 0> {
public:
- LStoreNamed(LOperand* obj, LOperand* val) {
+ LStoreNamedField(LOperand* obj, LOperand* val) {
inputs_[0] = obj;
inputs_[1] = val;
}
- DECLARE_INSTRUCTION(StoreNamed)
- DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
+ DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; }
- Handle<Object> name() const { return hydrogen()->name(); }
-};
-
-
-class LStoreNamedField: public LStoreNamed {
- public:
- LStoreNamedField(LOperand* obj, LOperand* val)
- : LStoreNamed(obj, val) { }
-
- DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
- DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
-
+
+ Handle<Object> name() const { return hydrogen()->name(); }
bool is_in_object() { return hydrogen()->is_in_object(); }
int offset() { return hydrogen()->offset(); }
bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
@@ -1556,25 +1544,35 @@
};
-class LStoreNamedGeneric: public LStoreNamed {
+class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
public:
- LStoreNamedGeneric(LOperand* obj, LOperand* val)
- : LStoreNamed(obj, val) { }
+ LStoreNamedGeneric(LOperand* obj, LOperand* val) {
+ inputs_[0] = obj;
+ inputs_[1] = val;
+ }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
+
+ virtual void PrintDataTo(StringStream* stream);
+
+ LOperand* object() { return inputs_[0]; }
+ LOperand* value() { return inputs_[1]; }
+ Handle<Object> name() const { return hydrogen()->name(); }
};
-class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
+class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
public:
- LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) {
+ LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
inputs_[0] = obj;
inputs_[1] = key;
inputs_[2] = val;
}
- DECLARE_INSTRUCTION(StoreKeyed)
+ DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
+ "store-keyed-fast-element")
+ DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
virtual void PrintDataTo(StringStream* stream);
@@ -1584,23 +1582,21 @@
};
-class LStoreKeyedFastElement: public LStoreKeyed {
+class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
public:
- LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
- : LStoreKeyed(obj, key, val) {}
-
- DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
- "store-keyed-fast-element")
- DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
-};
-
-
-class LStoreKeyedGeneric: public LStoreKeyed {
- public:
- LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val)
- : LStoreKeyed(obj, key, val) { }
-
- DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
+ LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) {
+ inputs_[0] = obj;
+ inputs_[1] = key;
+ inputs_[2] = val;
+ }
+
+ DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
+
+ virtual void PrintDataTo(StringStream* stream);
+
+ LOperand* object() { return inputs_[0]; }
+ LOperand* key() { return inputs_[1]; }
+ LOperand* value() { return inputs_[2]; }
};
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Feb 21
05:27:36 2011
+++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Feb 23
03:19:50 2011
@@ -282,33 +282,6 @@
RegisterUse(index, value);
InternalSetOperandAt(index, value);
}
-
-
-void HLoadKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
- if (index < 2) {
- operands_[index] = value;
- } else {
- context_ = value;
- }
-}
-
-
-void HStoreKeyedGeneric::InternalSetOperandAt(int index, HValue* value) {
- if (index < 3) {
- operands_[index] = value;
- } else {
- context_ = value;
- }
-}
-
-
-void HStoreNamedGeneric::InternalSetOperandAt(int index, HValue* value) {
- if (index < 2) {
- operands_[index] = value;
- } else {
- context_ = value;
- }
-}
void HValue::ReplaceAndDelete(HValue* other) {
@@ -564,15 +537,10 @@
#endif
-void HCall::PrintDataTo(StringStream* stream) {
- stream->Add("#%d", argument_count());
-}
-
-
void HUnaryCall::PrintDataTo(StringStream* stream) {
value()->PrintNameTo(stream);
stream->Add(" ");
- HCall::PrintDataTo(stream);
+ stream->Add("#%d", argument_count());
}
@@ -581,7 +549,7 @@
stream->Add(" ");
second()->PrintNameTo(stream);
stream->Add(" ");
- HCall::PrintDataTo(stream);
+ stream->Add("#%d", argument_count());
}
@@ -591,7 +559,7 @@
} else {
stream->Add("%o ", function()->shared()->DebugName());
}
- HCall::PrintDataTo(stream);
+ stream->Add("#%d", argument_count());
}
@@ -609,13 +577,13 @@
void HCallKnownGlobal::PrintDataTo(StringStream* stream) {
stream->Add("o ", target()->shared()->DebugName());
- HCall::PrintDataTo(stream);
+ stream->Add("#%d", argument_count());
}
void HCallRuntime::PrintDataTo(StringStream* stream) {
stream->Add("%o ", *name());
- HCall::PrintDataTo(stream);
+ stream->Add("#%d", argument_count());
}
@@ -1162,12 +1130,20 @@
}
-void HLoadKeyed::PrintDataTo(StringStream* stream) {
+void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream);
stream->Add("[");
key()->PrintNameTo(stream);
stream->Add("]");
}
+
+
+void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) {
+ object()->PrintNameTo(stream);
+ stream->Add("[");
+ key()->PrintNameTo(stream);
+ stream->Add("]");
+}
void HLoadPixelArrayElement::PrintDataTo(StringStream* stream) {
@@ -1178,7 +1154,7 @@
}
-void HStoreNamed::PrintDataTo(StringStream* stream) {
+void HStoreNamedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream);
stream->Add(".");
ASSERT(name()->IsString());
@@ -1189,14 +1165,28 @@
void HStoreNamedField::PrintDataTo(StringStream* stream) {
- HStoreNamed::PrintDataTo(stream);
+ object()->PrintNameTo(stream);
+ stream->Add(".");
+ ASSERT(name()->IsString());
+ stream->Add(*String::cast(*name())->ToCString());
+ stream->Add(" = ");
+ value()->PrintNameTo(stream);
if (!transition().is_null()) {
stream->Add(" (transition map %p)", *transition());
}
}
-void HStoreKeyed::PrintDataTo(StringStream* stream) {
+void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
+ object()->PrintNameTo(stream);
+ stream->Add("[");
+ key()->PrintNameTo(stream);
+ stream->Add("] = ");
+ value()->PrintNameTo(stream);
+}
+
+
+void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream);
stream->Add("[");
key()->PrintNameTo(stream);
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Tue Feb 22 04:14:53
2011
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Feb 23 03:19:50
2011
@@ -51,14 +51,9 @@
V(BinaryCall) \
V(BinaryOperation) \
V(BitwiseBinaryOperation) \
- V(Call) \
V(ControlInstruction) \
V(Instruction) \
- V(LoadKeyed) \
- V(MaterializedLiteral) \
V(Phi) \
- V(StoreKeyed) \
- V(StoreNamed) \
V(UnaryCall) \
V(UnaryControlInstruction) \
V(UnaryOperation) \
@@ -193,14 +188,6 @@
DECLARE_INSTRUCTION(type)
-
-template<int kSize>
-class HOperandVector : public EmbeddedVector<HValue*, kSize> {
- public:
- HOperandVector() : EmbeddedVector<HValue*, kSize>(NULL) { }
-};
-
-
class Range: public ZoneObject {
public:
Range() : lower_(kMinInt),
@@ -544,11 +531,8 @@
bool IsDefinedAfter(HBasicBlock* other) const;
// Operands.
- virtual int OperandCount() { return 0; }
- virtual HValue* OperandAt(int index) {
- UNREACHABLE();
- return NULL;
- }
+ virtual int OperandCount() = 0;
+ virtual HValue* OperandAt(int index) = 0;
void SetOperandAt(int index, HValue* value);
int LookupOperandIndex(int occurrence_index, HValue* op);
@@ -626,7 +610,7 @@
virtual void RepresentationChanged(Representation to) { }
virtual Range* InferRange();
virtual void DeleteFromGraph() = 0;
- virtual void InternalSetOperandAt(int index, HValue* value) {
UNREACHABLE(); }
+ virtual void InternalSetOperandAt(int index, HValue* value) = 0;
void clear_block() {
ASSERT(block_ != NULL);
block_ = NULL;
@@ -689,6 +673,8 @@
// Returns whether this is some kind of deoptimizing check
// instruction.
virtual bool IsCheckInstruction() const { return false; }
+
+ virtual bool IsCall() { return false; }
DECLARE_INSTRUCTION(Instruction)
@@ -716,17 +702,6 @@
};
-class HBlockEntry: public HInstruction {
- public:
-
- virtual Representation RequiredInputRepresentation(int index) const {
- return Representation::None();
- }
-
- DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry")
-};
-
-
class HControlInstruction: public HInstruction {
public:
HControlInstruction(HBasicBlock* first, HBasicBlock* second)
@@ -746,23 +721,91 @@
};
-class HDeoptimize: public HControlInstruction {
+template<int NumElements>
+class HOperandContainer {
public:
- HDeoptimize() : HControlInstruction(NULL, NULL) { }
-
+ HOperandContainer() : elems_() { }
+
+ int length() { return NumElements; }
+ HValue*& operator[](int i) {
+ ASSERT(i < length());
+ return elems_[i];
+ }
+
+ private:
+ HValue* elems_[NumElements];
+};
+
+
+template<>
+class HOperandContainer<0> {
+ public:
+ int length() { return 0; }
+ HValue*& operator[](int i) {
+ UNREACHABLE();
+ static HValue* t = 0;
+ return t;
+ }
+};
+
+
+template<int V>
+class HTemplateInstruction : public HInstruction {
+ public:
+ int OperandCount() { return V; }
+ HValue* OperandAt(int i) { return inputs_[i]; }
+
+ protected:
+ void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; }
+
+ private:
+ HOperandContainer<V> inputs_;
+};
+
+
+template<int V>
+class HTemplateControlInstruction : public HControlInstruction {
+ public:
+ HTemplateControlInstruction<V>(HBasicBlock* first, HBasicBlock* second)
+ : HControlInstruction(first, second) { }
+ int OperandCount() { return V; }
+ HValue* OperandAt(int i) { return inputs_[i]; }
+
+ protected:
+ void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; }
+
+ private:
+ HOperandContainer<V> inputs_;
+};
+
+
+class HBlockEntry: public HTemplateInstruction<0> {
+ public:
virtual Representation RequiredInputRepresentation(int index) const {
return Representation::None();
}
+
+ DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry")
+};
+
+
+class HDeoptimize: public HTemplateControlInstruction<0> {
+ public:
+ HDeoptimize() : HTemplateControlInstruction<0>(NULL, NULL) { }
+
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::None();
+ }
DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
};
-class HGoto: public HControlInstruction {
+class HGoto: public HTemplateControlInstruction<0> {
public:
explicit HGoto(HBasicBlock* target)
- : HControlInstruction(target, NULL), include_stack_check_(false) {
- }
+ : HTemplateControlInstruction<0>(target, NULL),
+ include_stack_check_(false) { }
void set_include_stack_check(bool include_stack_check) {
include_stack_check_ = include_stack_check;
@@ -780,30 +823,20 @@
};
-class HUnaryControlInstruction: public HControlInstruction {
+class HUnaryControlInstruction: public HTemplateControlInstruction<1> {
public:
explicit HUnaryControlInstruction(HValue* value,
HBasicBlock* true_target,
HBasicBlock* false_target)
- : HControlInstruction(true_target, false_target) {
+ : HTemplateControlInstruction<1>(true_target, false_target) {
SetOperandAt(0, value);
}
virtual void PrintDataTo(StringStream* stream);
HValue* value() { return OperandAt(0); }
- virtual int OperandCount() { return 1; }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
DECLARE_INSTRUCTION(UnaryControlInstruction)
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- private:
- HOperandVector<1> operands_;
};
@@ -864,9 +897,9 @@
};
-class HAbnormalExit: public HControlInstruction {
+class HAbnormalExit: public HTemplateControlInstruction<0> {
public:
- HAbnormalExit() : HControlInstruction(NULL, NULL) { }
+ HAbnormalExit() : HTemplateControlInstruction<0>(NULL, NULL) { }
virtual Representation RequiredInputRepresentation(int index) const {
return Representation::None();
@@ -876,7 +909,7 @@
};
-class HUnaryOperation: public HInstruction {
+class HUnaryOperation: public HTemplateInstruction<1> {
public:
explicit HUnaryOperation(HValue* value) {
SetOperandAt(0, value);
@@ -884,18 +917,8 @@
HValue* value() { return OperandAt(0); }
virtual void PrintDataTo(StringStream* stream);
- virtual int OperandCount() { return 1; }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
DECLARE_INSTRUCTION(UnaryOperation)
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- private:
- HOperandVector<1> operands_;
};
@@ -1036,7 +1059,7 @@
};
-class HStackCheck: public HInstruction {
+class HStackCheck: public HTemplateInstruction<0> {
public:
HStackCheck() { }
@@ -1048,7 +1071,7 @@
};
-class HEnterInlined: public HInstruction {
+class HEnterInlined: public HTemplateInstruction<0> {
public:
HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function)
: closure_(closure), function_(function) {
@@ -1071,7 +1094,7 @@
};
-class HLeaveInlined: public HInstruction {
+class HLeaveInlined: public HTemplateInstruction<0> {
public:
HLeaveInlined() {}
@@ -1099,7 +1122,7 @@
};
-class HContext: public HInstruction {
+class HContext: public HTemplateInstruction<0> {
public:
HContext() {
set_representation(Representation::Tagged());
@@ -1172,89 +1195,70 @@
};
-class HCall: public HInstruction {
+template <int V>
+class HCall: public HTemplateInstruction<V> {
public:
// The argument count includes the receiver.
- explicit HCall(int argument_count) : argument_count_(argument_count) {
- set_representation(Representation::Tagged());
- SetAllSideEffects();
+ explicit HCall<V>(int argument_count) : argument_count_(argument_count) {
+ this->set_representation(Representation::Tagged());
+ this->SetAllSideEffects();
}
virtual HType CalculateInferredType() { return HType::Tagged(); }
virtual int argument_count() const { return argument_count_; }
- virtual void PrintDataTo(StringStream* stream);
-
- DECLARE_INSTRUCTION(Call)
+ virtual bool IsCall() { return true; }
private:
int argument_count_;
};
-class HUnaryCall: public HCall {
+class HUnaryCall: public HCall<1> {
public:
HUnaryCall(HValue* value, int argument_count)
- : HCall(argument_count), value_(NULL) {
+ : HCall<1>(argument_count) {
SetOperandAt(0, value);
}
- virtual void PrintDataTo(StringStream* stream);
-
- HValue* value() { return value_; }
-
- virtual int OperandCount() { return 1; }
- virtual HValue* OperandAt(int index) {
- ASSERT(index == 0);
- return value_;
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
}
- DECLARE_INSTRUCTION(UnaryCall)
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- ASSERT(index == 0);
- value_ = value;
- }
-
- private:
- HValue* value_;
+ virtual void PrintDataTo(StringStream* stream);
+
+ HValue* value() { return OperandAt(0); }
+
+ DECLARE_INSTRUCTION(UnaryCall)
};
-class HBinaryCall: public HCall {
+class HBinaryCall: public HCall<2> {
public:
HBinaryCall(HValue* first, HValue* second, int argument_count)
- : HCall(argument_count) {
+ : HCall<2>(argument_count) {
SetOperandAt(0, first);
SetOperandAt(1, second);
}
virtual void PrintDataTo(StringStream* stream);
- HValue* first() const { return operands_[0]; }
- HValue* second() const { return operands_[1]; }
-
- virtual int OperandCount() { return 2; }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
+ }
+
+ HValue* first() { return OperandAt(0); }
+ HValue* second() { return OperandAt(1); }
DECLARE_INSTRUCTION(BinaryCall)
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- private:
- HOperandVector<2> operands_;
};
-class HCallConstantFunction: public HCall {
+class HCallConstantFunction: public HCall<0> {
public:
HCallConstantFunction(Handle<JSFunction> function, int argument_count)
- : HCall(argument_count), function_(function) { }
+ : HCall<0>(argument_count), function_(function) { }
Handle<JSFunction> function() const { return function_; }
@@ -1285,8 +1289,8 @@
return Representation::Tagged();
}
- HValue* context() const { return first(); }
- HValue* key() const { return second(); }
+ HValue* context() { return first(); }
+ HValue* key() { return second(); }
DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed")
};
@@ -1352,10 +1356,10 @@
};
-class HCallKnownGlobal: public HCall {
+class HCallKnownGlobal: public HCall<0> {
public:
HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
- : HCall(argument_count), target_(target) { }
+ : HCall<0>(argument_count), target_(target) { }
virtual void PrintDataTo(StringStream* stream);
@@ -1382,19 +1386,19 @@
return Representation::Tagged();
}
- HValue* context() const { return first(); }
- HValue* constructor() const { return second(); }
+ HValue* context() { return first(); }
+ HValue* constructor() { return second(); }
DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new")
};
-class HCallRuntime: public HCall {
+class HCallRuntime: public HCall<0> {
public:
HCallRuntime(Handle<String> name,
Runtime::Function* c_function,
int argument_count)
- : HCall(argument_count), c_function_(c_function), name_(name) { }
+ : HCall<0>(argument_count), c_function_(c_function), name_(name) { }
virtual void PrintDataTo(StringStream* stream);
Runtime::Function* function() const { return c_function_; }
@@ -1761,7 +1765,7 @@
};
-class HCheckPrototypeMaps: public HInstruction {
+class HCheckPrototypeMaps: public HTemplateInstruction<0> {
public:
HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder)
: prototype_(prototype), holder_(holder) {
@@ -1923,7 +1927,7 @@
};
-class HArgumentsObject: public HInstruction {
+class HArgumentsObject: public HTemplateInstruction<0> {
public:
HArgumentsObject() {
set_representation(Representation::Tagged());
@@ -1938,7 +1942,7 @@
};
-class HConstant: public HInstruction {
+class HConstant: public HTemplateInstruction<0> {
public:
HConstant(Handle<Object> handle, Representation r);
@@ -2001,7 +2005,7 @@
};
-class HBinaryOperation: public HInstruction {
+class HBinaryOperation: public HTemplateInstruction<2> {
public:
HBinaryOperation(HValue* left, HValue* right) {
ASSERT(left != NULL && right != NULL);
@@ -2026,21 +2030,12 @@
virtual bool IsCommutative() const { return false; }
virtual void PrintDataTo(StringStream* stream);
- virtual int OperandCount() { return operands_.length(); }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
DECLARE_INSTRUCTION(BinaryOperation)
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- HOperandVector<2> operands_;
};
-class HApplyArguments: public HInstruction {
+class HApplyArguments: public HTemplateInstruction<4> {
public:
HApplyArguments(HValue* function,
HValue* receiver,
@@ -2065,23 +2060,12 @@
HValue* receiver() { return OperandAt(1); }
HValue* length() { return OperandAt(2); }
HValue* elements() { return OperandAt(3); }
-
- virtual int OperandCount() { return operands_.length(); }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply_arguments")
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- private:
- HOperandVector<4> operands_;
};
-class HArgumentsElements: public HInstruction {
+class HArgumentsElements: public HTemplateInstruction<0> {
public:
HArgumentsElements() {
// The value produced by this instruction is a pointer into the stack
@@ -2107,19 +2091,19 @@
set_representation(Representation::Integer32());
SetFlag(kUseGVN);
}
-
- DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length")
virtual Representation RequiredInputRepresentation(int index) const {
return Representation::Tagged();
}
+
+ DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length")
protected:
virtual bool DataEquals(HValue* other) { return true; }
};
-class HAccessArgumentsAt: public HInstruction {
+class HAccessArgumentsAt: public HTemplateInstruction<3> {
public:
HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
set_representation(Representation::Tagged());
@@ -2138,24 +2122,13 @@
: Representation::Integer32();
}
- HValue* arguments() { return operands_[0]; }
- HValue* length() { return operands_[1]; }
- HValue* index() { return operands_[2]; }
-
- virtual int OperandCount() { return operands_.length(); }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
+ HValue* arguments() { return OperandAt(0); }
+ HValue* length() { return OperandAt(1); }
+ HValue* index() { return OperandAt(2); }
DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at")
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
virtual bool DataEquals(HValue* other) { return true; }
-
- private:
- HOperandVector<3> operands_;
};
@@ -2373,7 +2346,7 @@
};
-class HIsConstructCall: public HInstruction {
+class HIsConstructCall: public HTemplateInstruction<0> {
public:
HIsConstructCall() {
set_representation(Representation::Tagged());
@@ -2488,7 +2461,7 @@
};
-class HInstanceOf: public HInstruction {
+class HInstanceOf: public HTemplateInstruction<3> {
public:
HInstanceOf(HValue* context, HValue* left, HValue* right) {
SetOperandAt(0, context);
@@ -2498,9 +2471,9 @@
SetAllSideEffects();
}
- HValue* context() { return operands_[0]; }
- HValue* left() { return operands_[1]; }
- HValue* right() { return operands_[2]; }
+ HValue* context() { return OperandAt(0); }
+ HValue* left() { return OperandAt(1); }
+ HValue* right() { return OperandAt(2); }
virtual bool EmitAtUses() const {
return !HasSideEffects() && (uses()->length() <= 1);
@@ -2511,19 +2484,8 @@
}
virtual void PrintDataTo(StringStream* stream);
-
- virtual int OperandCount() { return 3; }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of")
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- private:
- HOperandVector<3> operands_;
};
@@ -2760,7 +2722,7 @@
};
-class HOsrEntry: public HInstruction {
+class HOsrEntry: public HTemplateInstruction<0> {
public:
explicit HOsrEntry(int ast_id) : ast_id_(ast_id) {
SetFlag(kChangesOsrEntries);
@@ -2779,7 +2741,7 @@
};
-class HParameter: public HInstruction {
+class HParameter: public HTemplateInstruction<0> {
public:
explicit HParameter(unsigned index) : index_(index) {
set_representation(Representation::Tagged());
@@ -2833,7 +2795,7 @@
};
-class HUnknownOSRValue: public HInstruction {
+class HUnknownOSRValue: public HTemplateInstruction<0> {
public:
HUnknownOSRValue() { set_representation(Representation::Tagged()); }
@@ -2845,7 +2807,7 @@
};
-class HLoadGlobal: public HInstruction {
+class HLoadGlobal: public HTemplateInstruction<0> {
public:
HLoadGlobal(Handle<JSGlobalPropertyCell> cell, bool check_hole_value)
: cell_(cell), check_hole_value_(check_hole_value) {
@@ -3056,36 +3018,24 @@
};
-class HLoadKeyed: public HBinaryOperation {
+class HLoadKeyedFastElement: public HBinaryOperation {
public:
- HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) {
+ HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj,
key) {
set_representation(Representation::Tagged());
+ SetFlag(kDependsOnArrayElements);
+ SetFlag(kUseGVN);
}
- virtual void PrintDataTo(StringStream* stream);
-
- virtual Representation RequiredInputRepresentation(int index) const {
- return Representation::Tagged();
- }
HValue* object() { return OperandAt(0); }
HValue* key() { return OperandAt(1); }
-
- DECLARE_INSTRUCTION(LoadKeyed)
-};
-
-
-class HLoadKeyedFastElement: public HLoadKeyed {
- public:
- HLoadKeyedFastElement(HValue* obj, HValue* key) : HLoadKeyed(obj, key) {
- SetFlag(kDependsOnArrayElements);
- SetFlag(kUseGVN);
- }
virtual Representation RequiredInputRepresentation(int index) const {
// The key is supposed to be Integer32.
return (index == 1) ? Representation::Integer32()
: Representation::Tagged();
}
+
+ virtual void PrintDataTo(StringStream* stream);
DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement,
"load_keyed_fast_element")
@@ -3126,65 +3076,39 @@
};
-class HLoadKeyedGeneric: public HLoadKeyed {
+class HLoadKeyedGeneric: public HTemplateInstruction<3> {
public:
- HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key)
- : HLoadKeyed(obj, key), context_(NULL) {
+ HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) {
+ set_representation(Representation::Tagged());
+ SetOperandAt(0, obj);
+ SetOperandAt(1, key);
SetOperandAt(2, context);
SetAllSideEffects();
}
- HValue* context() const { return context_; }
- HValue* object() { return operands_[0]; }
- HValue* key() { return operands_[1]; }
-
- virtual int OperandCount() { return 3; }
- virtual HValue* OperandAt(int index) {
- return (index < 2) ? operands_[index] : context_;
- }
-
- DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value);
-
- private:
- HValue* context_;
-};
-
-
-class HStoreNamed: public HBinaryOperation {
- public:
- HStoreNamed(HValue* obj, Handle<String> name, HValue* val)
- : HBinaryOperation(obj, val), name_(name) {
- }
+ HValue* object() { return OperandAt(0); }
+ HValue* key() { return OperandAt(1); }
+ HValue* context() { return OperandAt(2); }
+
+ virtual void PrintDataTo(StringStream* stream);
virtual Representation RequiredInputRepresentation(int index) const {
return Representation::Tagged();
}
- virtual void PrintDataTo(StringStream* stream);
-
- HValue* object() { return OperandAt(0); }
- Handle<String> name() const { return name_; }
- HValue* value() { return OperandAt(1); }
- void set_value(HValue* value) { SetOperandAt(1, value); }
-
- DECLARE_INSTRUCTION(StoreNamed)
-
- private:
- Handle<String> name_;
+ DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
};
-class HStoreNamedField: public HStoreNamed {
+class HStoreNamedField: public HBinaryOperation {
public:
HStoreNamedField(HValue* obj,
Handle<String> name,
HValue* val,
bool in_object,
int offset)
- : HStoreNamed(obj, name, val),
+ : HBinaryOperation(obj, val),
+ name_(name),
is_in_object_(in_object),
offset_(offset) {
if (is_in_object_) {
@@ -3201,6 +3125,10 @@
}
virtual void PrintDataTo(StringStream* stream);
+ HValue* object() { return OperandAt(0); }
+ HValue* value() { return OperandAt(1); }
+
+ Handle<String> name() const { return name_; }
bool is_in_object() const { return is_in_object_; }
int offset() const { return offset_; }
Handle<Map> transition() const { return transition_; }
@@ -3211,57 +3139,57 @@
}
private:
+ Handle<String> name_;
bool is_in_object_;
int offset_;
Handle<Map> transition_;
};
-class HStoreNamedGeneric: public HStoreNamed {
+class HStoreNamedGeneric: public HTemplateInstruction<3> {
public:
HStoreNamedGeneric(HValue* context,
HValue* object,
Handle<String> name,
HValue* value)
- : HStoreNamed(object, name, value), context_(NULL) {
+ : name_(name) {
+ SetOperandAt(0, object);
+ SetOperandAt(1, value);
SetOperandAt(2, context);
SetAllSideEffects();
}
- HValue* context() const { return context_; }
- HValue* object() const { return operands_[0]; }
- HValue* value() const { return operands_[1]; }
-
- virtual int OperandCount() { return 3; }
-
- virtual HValue* OperandAt(int index) {
- return (index < 2) ? operands_[index] : context_;
+ HValue* object() { return OperandAt(0); }
+ HValue* value() { return OperandAt(1); }
+ HValue* context() { return OperandAt(2); }
+ Handle<String> name() { return name_; }
+
+ virtual void PrintDataTo(StringStream* stream);
+
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
}
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic")
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value);
-
private:
- HValue* context_;
+ Handle<String> name_;
};
-class HStoreKeyed: public HInstruction {
+class HStoreKeyedFastElement: public HTemplateInstruction<3> {
public:
- HStoreKeyed(HValue* obj, HValue* key, HValue* val) {
+ HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) {
SetOperandAt(0, obj);
SetOperandAt(1, key);
SetOperandAt(2, val);
- }
-
- virtual void PrintDataTo(StringStream* stream);
- virtual int OperandCount() { return operands_.length(); }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
+ SetFlag(kChangesArrayElements);
+ }
virtual Representation RequiredInputRepresentation(int index) const {
- return Representation::Tagged();
+ // The key is supposed to be Integer32.
+ return (index == 1) ? Representation::Integer32()
+ : Representation::Tagged();
}
HValue* object() { return OperandAt(0); }
@@ -3272,36 +3200,14 @@
return StoringValueNeedsWriteBarrier(value());
}
- DECLARE_INSTRUCTION(StoreKeyed)
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- HOperandVector<3> operands_;
-};
-
-
-class HStoreKeyedFastElement: public HStoreKeyed {
- public:
- HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val)
- : HStoreKeyed(obj, key, val) {
- SetFlag(kChangesArrayElements);
- }
-
- virtual Representation RequiredInputRepresentation(int index) const {
- // The key is supposed to be Integer32.
- return (index == 1) ? Representation::Integer32()
- : Representation::Tagged();
- }
+ virtual void PrintDataTo(StringStream* stream);
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
"store_keyed_fast_element")
};
-class HStorePixelArrayElement: public HInstruction {
+class HStorePixelArrayElement: public HTemplateInstruction<3> {
public:
HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue*
val) {
SetFlag(kChangesPixelArrayElements);
@@ -3311,8 +3217,6 @@
}
virtual void PrintDataTo(StringStream* stream);
- virtual int OperandCount() { return operands_.length(); }
- virtual HValue* OperandAt(int index) { return operands_[index]; }
virtual Representation RequiredInputRepresentation(int index) const {
if (index == 0) {
@@ -3322,51 +3226,40 @@
}
}
- HValue* external_pointer() { return operands_[0]; }
- HValue* key() { return operands_[1]; }
- HValue* value() { return operands_[2]; }
+ HValue* external_pointer() { return OperandAt(0); }
+ HValue* key() { return OperandAt(1); }
+ HValue* value() { return OperandAt(2); }
DECLARE_CONCRETE_INSTRUCTION(StorePixelArrayElement,
"store_pixel_array_element")
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value) {
- operands_[index] = value;
- }
-
- HOperandVector<3> operands_;
};
-class HStoreKeyedGeneric: public HStoreKeyed {
+class HStoreKeyedGeneric: public HTemplateInstruction<4> {
public:
HStoreKeyedGeneric(HValue* context,
HValue* object,
HValue* key,
- HValue* value)
- : HStoreKeyed(object, key, value), context_(NULL) {
+ HValue* value) {
+ SetOperandAt(0, object);
+ SetOperandAt(1, key);
+ SetOperandAt(2, value);
SetOperandAt(3, context);
SetAllSideEffects();
}
- HValue* context() { return context_; }
- HValue* object() { return operands_[0]; }
- HValue* key() { return operands_[1]; }
- HValue* value() { return operands_[2]; }
-
- virtual int OperandCount() { return 4; }
-
- virtual HValue* OperandAt(int index) {
- return (index < 3) ? operands_[index] : context_;
+ HValue* object() { return OperandAt(0); }
+ HValue* key() { return OperandAt(1); }
+ HValue* value() { return OperandAt(2); }
+ HValue* context() { return OperandAt(3); }
+
+ virtual Representation RequiredInputRepresentation(int index) const {
+ return Representation::Tagged();
}
- DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic")
-
- protected:
- virtual void InternalSetOperandAt(int index, HValue* value);
-
- private:
- HValue* context_;
+ virtual void PrintDataTo(StringStream* stream);
***The diff for this file has been truncated for email.***
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Tue Feb 22 08:56:57 2011
+++ /branches/bleeding_edge/src/hydrogen.cc Wed Feb 23 03:19:50 2011
@@ -2258,7 +2258,8 @@
}
-void HGraphBuilder::PreProcessCall(HCall* call) {
+template <int V>
+HInstruction* HGraphBuilder::PreProcessCall(HCall<V>* call) {
int count = call->argument_count();
ZoneList<HValue*> arguments(count);
for (int i = 0; i < count; ++i) {
@@ -2268,6 +2269,7 @@
while (!arguments.is_empty()) {
AddInstruction(new HPushArgument(arguments.RemoveLast()));
}
+ return call;
}
@@ -3951,7 +3953,8 @@
// Check for bailout, as trying to inline might fail due to bailout
// during hydrogen processing.
CHECK_BAILOUT;
- HCall* call = new HCallConstantFunction(expr->target(),
argument_count);
+ HCallConstantFunction* call =
+ new HCallConstantFunction(expr->target(), argument_count);
call->set_position(expr->position());
PreProcessCall(call);
PushAndAdd(call);
@@ -3968,7 +3971,7 @@
if (maps.length() == 0) {
HContext* context = new HContext;
AddInstruction(context);
- HCall* call = new HCallNamed(context, name, argument_count);
+ HCallNamed* call = new HCallNamed(context, name, argument_count);
call->set_position(expr->position());
PreProcessCall(call);
ast_context()->ReturnInstruction(call, expr->id());
@@ -3981,7 +3984,7 @@
} else {
HContext* context = new HContext;
AddInstruction(context);
- HCall* call = new HCallNamed(context, name, argument_count);
+ HCallNamed* call = new HCallNamed(context, name, argument_count);
call->set_position(expr->position());
PreProcessCall(call);
PushAndAdd(call);
@@ -4382,7 +4385,7 @@
void HGraphBuilder::VisitCall(Call* expr) {
Expression* callee = expr->expression();
int argument_count = expr->arguments()->length() + 1; // Plus receiver.
- HCall* call = NULL;
+ HInstruction* call = NULL;
Property* prop = callee->AsProperty();
if (prop != NULL) {
@@ -4402,9 +4405,8 @@
HContext* context = new HContext;
AddInstruction(context);
- call = new HCallKeyed(context, key, argument_count);
+ call = PreProcessCall(new HCallKeyed(context, key, argument_count));
call->set_position(expr->position());
- PreProcessCall(call);
Drop(1); // Key.
ast_context()->ReturnInstruction(call, expr->id());
return;
@@ -4444,7 +4446,7 @@
// IC when a primitive receiver check is required.
HContext* context = new HContext;
AddInstruction(context);
- call = new HCallNamed(context, name, argument_count);
+ call = PreProcessCall(new HCallNamed(context, name,
argument_count));
} else {
AddCheckConstantFunction(expr, receiver, receiver_map, true);
@@ -4464,7 +4466,8 @@
// Check for bailout, as the TryInline call in the if condition
above
// might return false due to bailout during hydrogen processing.
CHECK_BAILOUT;
- call = new HCallConstantFunction(expr->target(), argument_count);
+ call = PreProcessCall(new HCallConstantFunction(expr->target(),
+ argument_count));
}
}
} else if (types != NULL && types->length() > 1) {
@@ -4475,7 +4478,7 @@
} else {
HContext* context = new HContext;
AddInstruction(context);
- call = new HCallNamed(context, name, argument_count);
+ call = PreProcessCall(new HCallNamed(context, name, argument_count));
}
} else {
@@ -4536,7 +4539,8 @@
// during hydrogen processing.
CHECK_BAILOUT;
- call = new HCallKnownGlobal(expr->target(), argument_count);
+ call = PreProcessCall(new HCallKnownGlobal(expr->target(),
+ argument_count));
} else {
HContext* context = new HContext;
AddInstruction(context);
@@ -4544,7 +4548,9 @@
VisitExpressions(expr->arguments());
CHECK_BAILOUT;
- call = new HCallGlobal(context, var->name(), argument_count);
+ call = PreProcessCall(new HCallGlobal(context,
+ var->name(),
+ argument_count));
}
} else {
@@ -4556,12 +4562,11 @@
VisitExpressions(expr->arguments());
CHECK_BAILOUT;
- call = new HCallFunction(context, argument_count);
+ call = PreProcessCall(new HCallFunction(context, argument_count));
}
}
call->set_position(expr->position());
- PreProcessCall(call);
ast_context()->ReturnInstruction(call, expr->id());
}
@@ -4580,7 +4585,7 @@
// to the construct call.
int arg_count = expr->arguments()->length() + 1; // Plus constructor.
HValue* constructor = environment()->ExpressionStackAt(arg_count - 1);
- HCall* call = new HCallNew(context, constructor, arg_count);
+ HCallNew* call = new HCallNew(context, constructor, arg_count);
call->set_position(expr->position());
PreProcessCall(call);
ast_context()->ReturnInstruction(call, expr->id());
@@ -4629,7 +4634,7 @@
Handle<String> name = expr->name();
int argument_count = expr->arguments()->length();
- HCall* call = new HCallRuntime(name, function, argument_count);
+ HCallRuntime* call = new HCallRuntime(name, function, argument_count);
call->set_position(RelocInfo::kNoPosition);
Drop(argument_count);
ast_context()->ReturnInstruction(call, expr->id());
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Tue Feb 22 02:32:16 2011
+++ /branches/bleeding_edge/src/hydrogen.h Wed Feb 23 03:19:50 2011
@@ -729,7 +729,7 @@
// Remove the arguments from the bailout environment and emit
instructions
// to push them as outgoing parameters.
- void PreProcessCall(HCall* call);
+ template <int V> HInstruction* PreProcessCall(HCall<V>* call);
void AssumeRepresentation(HValue* value, Representation r);
static Representation ToRepresentation(TypeInfo info);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Feb 23 02:10:47
2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Feb 23 03:19:50
2011
@@ -404,7 +404,7 @@
}
-void LStoreNamed::PrintDataTo(StringStream* stream) {
+void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add(".");
stream->Add(*String::cast(*name())->ToCString());
@@ -413,7 +413,25 @@
}
-void LStoreKeyed::PrintDataTo(StringStream* stream) {
+void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
+ object()->PrintTo(stream);
+ stream->Add(".");
+ stream->Add(*String::cast(*name())->ToCString());
+ stream->Add(" <- ");
+ value()->PrintTo(stream);
+}
+
+
+void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
+ object()->PrintTo(stream);
+ stream->Add("[");
+ key()->PrintTo(stream);
+ stream->Add("] <- ");
+ value()->PrintTo(stream);
+}
+
+
+void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add("[");
key()->PrintTo(stream);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Wed Feb 16 05:31:12 2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Wed Feb 23 03:19:50 2011
@@ -42,8 +42,6 @@
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
V(ControlInstruction) \
V(Call) \
- V(StoreKeyed) \
- V(StoreNamed) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
@@ -1581,34 +1579,23 @@
};
-class LStoreNamed: public LTemplateInstruction<0, 2, 1> {
+class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
public:
- LStoreNamed(LOperand* obj, LOperand* val) {
+ LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) {
inputs_[0] = obj;
inputs_[1] = val;
+ temps_[0] = temp;
}
- DECLARE_INSTRUCTION(StoreNamed)
- DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
+ DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; }
- Handle<Object> name() const { return hydrogen()->name(); }
-};
-
-
-class LStoreNamedField: public LStoreNamed {
- public:
- LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp)
- : LStoreNamed(obj, val) {
- temps_[0] = temp;
- }
-
- DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
- DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
-
+
+ Handle<Object> name() const { return hydrogen()->name(); }
bool is_in_object() { return hydrogen()->is_in_object(); }
int offset() { return hydrogen()->offset(); }
bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
@@ -1627,6 +1614,8 @@
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
+ virtual void PrintDataTo(StringStream* stream);
+
LOperand* context() { return inputs_[0]; }
LOperand* object() { return inputs_[1]; }
LOperand* value() { return inputs_[2]; }
@@ -1634,15 +1623,17 @@
};
-class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
+class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
public:
- LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) {
+ LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
inputs_[0] = obj;
inputs_[1] = key;
inputs_[2] = val;
}
- DECLARE_INSTRUCTION(StoreKeyed)
+ DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
+ "store-keyed-fast-element")
+ DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
virtual void PrintDataTo(StringStream* stream);
@@ -1652,17 +1643,6 @@
};
-class LStoreKeyedFastElement: public LStoreKeyed {
- public:
- LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
- : LStoreKeyed(obj, key, val) {}
-
- DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
- "store-keyed-fast-element")
- DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
-};
-
-
class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 1> {
public:
LStorePixelArrayElement(LOperand* external_pointer,
@@ -1699,6 +1679,8 @@
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
+ virtual void PrintDataTo(StringStream* stream);
+
LOperand* context() { return inputs_[0]; }
LOperand* object() { return inputs_[1]; }
LOperand* key() { return inputs_[2]; }
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Wed Feb 23 02:10:47 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Wed Feb 23 03:19:50 2011
@@ -405,7 +405,7 @@
}
-void LStoreNamed::PrintDataTo(StringStream* stream) {
+void LStoreNamedField::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add(".");
stream->Add(*String::cast(*name())->ToCString());
@@ -414,7 +414,25 @@
}
-void LStoreKeyed::PrintDataTo(StringStream* stream) {
+void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
+ object()->PrintTo(stream);
+ stream->Add(".");
+ stream->Add(*String::cast(*name())->ToCString());
+ stream->Add(" <- ");
+ value()->PrintTo(stream);
+}
+
+
+void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
+ object()->PrintTo(stream);
+ stream->Add("[");
+ key()->PrintTo(stream);
+ stream->Add("] <- ");
+ value()->PrintTo(stream);
+}
+
+
+void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add("[");
key()->PrintTo(stream);
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Wed Feb 23 01:51:53 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.h Wed Feb 23 03:19:50 2011
@@ -42,8 +42,6 @@
#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
V(ControlInstruction) \
V(Call) \
- V(StoreKeyed) \
- V(StoreNamed) \
LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
@@ -1491,34 +1489,23 @@
};
-class LStoreNamed: public LTemplateInstruction<0, 2, 1> {
+class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
public:
- LStoreNamed(LOperand* object, LOperand* value) {
+ LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
inputs_[0] = object;
inputs_[1] = value;
+ temps_[0] = temp;
}
- DECLARE_INSTRUCTION(StoreNamed)
- DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
+ DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
+ DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
virtual void PrintDataTo(StringStream* stream);
LOperand* object() { return inputs_[0]; }
LOperand* value() { return inputs_[1]; }
- Handle<Object> name() const { return hydrogen()->name(); }
-};
-
-
-class LStoreNamedField: public LStoreNamed {
- public:
- LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp)
- : LStoreNamed(object, value) {
- temps_[0] = temp;
- }
-
- DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
- DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
-
+
+ Handle<Object> name() const { return hydrogen()->name(); }
bool is_in_object() { return hydrogen()->is_in_object(); }
int offset() { return hydrogen()->offset(); }
bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
@@ -1526,25 +1513,35 @@
};
-class LStoreNamedGeneric: public LStoreNamed {
+class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
public:
- LStoreNamedGeneric(LOperand* object, LOperand* value)
- : LStoreNamed(object, value) { }
+ LStoreNamedGeneric(LOperand* object, LOperand* value) {
+ inputs_[0] = object;
+ inputs_[1] = value;
+ }
DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
+
+ virtual void PrintDataTo(StringStream* stream);
+
+ LOperand* object() { return inputs_[0]; }
+ LOperand* value() { return inputs_[1]; }
+ Handle<Object> name() const { return hydrogen()->name(); }
};
-class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
+class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
public:
- LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) {
+ LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
inputs_[0] = obj;
inputs_[1] = key;
inputs_[2] = val;
}
- DECLARE_INSTRUCTION(StoreKeyed)
+ DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
+ "store-keyed-fast-element")
+ DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
virtual void PrintDataTo(StringStream* stream);
@@ -1554,17 +1551,6 @@
};
-class LStoreKeyedFastElement: public LStoreKeyed {
- public:
- LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
- : LStoreKeyed(obj, key, val) {}
-
- DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
- "store-keyed-fast-element")
- DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
-};
-
-
class LStorePixelArrayElement: public LTemplateInstruction<0, 3, 0> {
public:
LStorePixelArrayElement(LOperand* external_pointer,
@@ -1585,12 +1571,21 @@
};
-class LStoreKeyedGeneric: public LStoreKeyed {
+class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
public:
- LStoreKeyedGeneric(LOperand* object, LOperand* key, LOperand* value)
- : LStoreKeyed(object, key, value) { }
+ LStoreKeyedGeneric(LOperand* object, LOperand* key, LOperand* value) {
+ inputs_[0] = object;
+ inputs_[1] = key;
+ inputs_[2] = value;
+ }
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
+
+ virtual void PrintDataTo(StringStream* stream);
+
+ LOperand* object() { return inputs_[0]; }
+ LOperand* key() { return inputs_[1]; }
+ LOperand* value() { return inputs_[2]; }
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev