Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index 19d2d4852a2b813b19586684408cb963a99d66e4..2422f9f05dbdea3c1e932c1c21fc05f762918758 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -1118,7 +1118,7 @@ class HLeaveInlined: public HInstruction { |
| class HPushArgument: public HUnaryOperation { |
| public: |
| explicit HPushArgument(HValue* value) |
| - : HUnaryOperation(value), argument_index_(-1) { |
| + : HUnaryOperation(value) { |
| set_representation(Representation::Tagged()); |
| } |
| @@ -1126,18 +1126,9 @@ class HPushArgument: public HUnaryOperation { |
| return Representation::Tagged(); |
| } |
| - virtual void PrintDataTo(StringStream* stream) const; |
| HValue* argument() const { return OperandAt(0); } |
| - int argument_index() const { return argument_index_; } |
| - void set_argument_index(int index) { |
| - ASSERT(argument_index_ == -1 || index == argument_index_); |
| - argument_index_ = index; |
| - } |
| DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") |
| - |
| - private: |
| - int argument_index_; |
| }; |
| @@ -1167,36 +1158,19 @@ class HGlobalReceiver: public HInstruction { |
| class HCall: public HInstruction { |
| public: |
| - // Construct a call with uninitialized arguments. The argument count |
| - // includes the receiver. |
| - explicit HCall(int count); |
| + // The argument count includes the receiver. |
| + explicit HCall(int argument_count); |
| virtual HType CalculateInferredType() const { return HType::Tagged(); } |
| - // TODO(3190496): This needs a cleanup. We don't want the arguments |
| - // be operands of the call instruction. This results in bad code quality. |
| - virtual int argument_count() const { return arguments_.length(); } |
| - virtual int OperandCount() const { return argument_count(); } |
| - virtual HValue* OperandAt(int index) const { return arguments_[index]; } |
| - virtual HPushArgument* PushArgumentAt(int index) const { |
| - return HPushArgument::cast(OperandAt(index)); |
| - } |
| - virtual HValue* ArgumentAt(int index) const { |
| - return PushArgumentAt(index)->argument(); |
| - } |
| - virtual void SetArgumentAt(int index, HPushArgument* push_argument); |
| + int argument_count() const { return argument_count_; } |
| virtual void PrintDataTo(StringStream* stream) const; |
| DECLARE_INSTRUCTION(Call) |
| protected: |
| - virtual void InternalSetOperandAt(int index, HValue* value) { |
| - arguments_[index] = value; |
| - } |
| - |
| int argument_count_; |
| - Vector<HValue*> arguments_; |
| }; |
| @@ -1221,8 +1195,7 @@ class HCallConstantFunction: public HCall { |
| class HCallKeyed: public HCall { |
| public: |
| - HCallKeyed(HValue* key, int argument_count) |
| - : HCall(argument_count + 1) { |
| + HCallKeyed(HValue* key, int argument_count) : HCall(argument_count) { |
| SetOperandAt(0, key); |
| } |
| @@ -1230,22 +1203,20 @@ class HCallKeyed: public HCall { |
| return Representation::Tagged(); |
| } |
| - // TODO(3190496): This is a hack to get an additional operand that |
| - // is not an argument to work with the current setup. This _needs_ a cleanup. |
| - // (see HCall) |
| virtual void PrintDataTo(StringStream* stream) const; |
| - HValue* key() const { return OperandAt(0); } |
| - virtual int argument_count() const { return arguments_.length() - 1; } |
| - virtual int OperandCount() const { return arguments_.length(); } |
| - virtual HValue* OperandAt(int index) const { return arguments_[index]; } |
| - virtual HPushArgument* PushArgumentAt(int index) const { |
| - return HPushArgument::cast(OperandAt(index + 1)); |
| - } |
| - virtual void SetArgumentAt(int index, HPushArgument* push_argument) { |
| - HCall::SetArgumentAt(index + 1, push_argument); |
| - } |
| + HValue* key() const { return operands_[0]; } |
| + virtual int OperandCount() const { return 1; } |
| + virtual HValue* OperandAt(int index) const { return operands_[index]; } |
| DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed") |
| + |
| + protected: |
| + virtual void InternalSetOperandAt(int index, HValue* value) { |
| + operands_[index] = value; |
| + } |
| + |
| + private: |
| + HOperandVector<1> operands_; |
|
fschneider
2010/12/20 16:13:02
There are now 3 types of calls that take an extra
|
| }; |
| @@ -1290,30 +1261,58 @@ class HCallGlobal: public HCall { |
| class HCallKnownGlobal: public HCall { |
| public: |
| - HCallKnownGlobal(Handle<JSFunction> target, |
| + HCallKnownGlobal(HValue* receiver, |
| + Handle<JSFunction> target, |
| int argument_count) |
| - : HCall(argument_count), target_(target) { } |
| + : HCall(argument_count), target_(target) { |
| + SetOperandAt(0, receiver); |
| + } |
| + |
| + virtual void PrintDataTo(StringStream* stream) const; |
| + |
| + virtual int OperandCount() const { return 1; } |
| + virtual HValue* OperandAt(int index) const { return operands_[index]; } |
| + HValue* receiver() const { return operands_[0]; } |
| Handle<JSFunction> target() const { return target_; } |
| DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global") |
| + protected: |
| + virtual void InternalSetOperandAt(int index, HValue* value) { |
| + operands_[index] = value; |
| + } |
| + |
| private: |
| + HOperandVector<1> operands_; |
| Handle<JSFunction> target_; |
| }; |
| class HCallNew: public HCall { |
| public: |
| - explicit HCallNew(int argument_count) : HCall(argument_count) { } |
| + HCallNew(HValue* constructor, int argument_count) : HCall(argument_count) { |
| + SetOperandAt(0, constructor); |
| + } |
| virtual Representation RequiredInputRepresentation(int index) const { |
| return Representation::Tagged(); |
| } |
| - HValue* constructor() const { return ArgumentAt(0); } |
| + virtual void PrintDataTo(StringStream* stream) const; |
| + HValue* constructor() const { return operands_[0]; } |
| + virtual int OperandCount() const { return 1; } |
| + virtual HValue* OperandAt(int index) const { return operands_[index]; } |
| DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") |
| + |
| + protected: |
| + virtual void InternalSetOperandAt(int index, HValue* value) { |
| + operands_[index] = value; |
| + } |
| + |
| + private: |
| + HOperandVector<1> operands_; |
| }; |
| @@ -1323,6 +1322,7 @@ class HCallRuntime: public HCall { |
| Runtime::Function* c_function, |
| int argument_count) |
| : HCall(argument_count), c_function_(c_function), name_(name) { } |
| + |
| virtual void PrintDataTo(StringStream* stream) const; |
| Runtime::Function* function() const { return c_function_; } |