Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index adff7a2529da942ae5ea128148ff3204c5e2d7b4..a0fd88a60ce713e58c1fc01a817d2485e7f52f71 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -2307,6 +2307,19 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| return res; |
| } |
| + static HCallWithDescriptor* New(Zone* zone, HValue* context, |
| + HValue* target, |
| + int argument_count, |
| + const CodeStubInterfaceDescriptor* descriptor, |
| + const Vector<HValue*>& operands) { |
| + ASSERT(operands.length() == descriptor->environment_length()); |
| + HCallWithDescriptor* res = |
| + new(zone) HCallWithDescriptor(target, argument_count, |
| + descriptor, operands, context, |
| + zone); |
| + return res; |
| + } |
| + |
| virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } |
| virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { |
| return values_[index]; |
| @@ -2314,12 +2327,23 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| virtual Representation RequiredInputRepresentation( |
| int index) V8_FINAL V8_OVERRIDE { |
| + if (is_stub_) { |
| + if (index < 2) { |
|
danno
2014/07/11 12:30:30
I think a little more comments/constants are neede
mvstanton
2014/07/21 09:41:17
Happily, we've now repaired this whole area so thi
|
| + return Representation::Tagged(); |
| + } else { |
| + int par_index = index - 2; |
| + ASSERT(par_index < stub_descriptor_->environment_length()); |
| + return stub_descriptor_->GetParameterRepresentation(par_index); |
| + } |
| + } |
| + |
| + ASSERT(!is_stub_); |
| if (index == 0) { |
| return Representation::Tagged(); |
| } else { |
| int par_index = index - 1; |
| - ASSERT(par_index < descriptor_->environment_length()); |
| - return descriptor_->GetParameterRepresentation(par_index); |
| + ASSERT(par_index < call_descriptor_->environment_length()); |
| + return call_descriptor_->GetParameterRepresentation(par_index); |
| } |
| } |
| @@ -2337,14 +2361,27 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| return -argument_count_; |
| } |
| - const CallInterfaceDescriptor* descriptor() const { |
| - return descriptor_; |
| + bool is_stub() const { return is_stub_; } |
| + |
| + const CallInterfaceDescriptor* call_descriptor() const { |
| + ASSERT(!is_stub_); |
| + return call_descriptor_; |
| + } |
| + |
| + const CodeStubInterfaceDescriptor* stub_descriptor() const { |
| + ASSERT(is_stub_); |
| + return stub_descriptor_; |
| } |
| HValue* target() { |
| return OperandAt(0); |
| } |
| + HValue* context() { |
| + ASSERT(is_stub_); |
| + return OperandAt(1); |
| + } |
| + |
| virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| private: |
| @@ -2354,7 +2391,8 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| const CallInterfaceDescriptor* descriptor, |
| const Vector<HValue*>& operands, |
| Zone* zone) |
| - : descriptor_(descriptor), |
| + : is_stub_(false), |
| + call_descriptor_(descriptor), |
| values_(descriptor->environment_length() + 1, zone) { |
| argument_count_ = argument_count; |
| AddOperand(target, zone); |
| @@ -2365,6 +2403,26 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| this->SetAllSideEffects(); |
| } |
| + // The argument count includes the receiver. |
| + HCallWithDescriptor(HValue* target, |
| + int argument_count, |
| + const CodeStubInterfaceDescriptor* descriptor, |
| + const Vector<HValue*>& operands, |
| + HValue* context, |
| + Zone* zone) |
| + : is_stub_(true), |
| + stub_descriptor_(descriptor), |
| + values_(descriptor->environment_length() + 2, zone) { |
| + argument_count_ = argument_count; |
| + AddOperand(target, zone); |
| + AddOperand(context, zone); |
| + for (int i = 0; i < operands.length(); i++) { |
| + AddOperand(operands[i], zone); |
| + } |
| + this->set_representation(Representation::Tagged()); |
| + this->SetAllSideEffects(); |
| + } |
| + |
| void AddOperand(HValue* v, Zone* zone) { |
| values_.Add(NULL, zone); |
| SetOperandAt(values_.length() - 1, v); |
| @@ -2375,7 +2433,11 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| values_[index] = value; |
| } |
| - const CallInterfaceDescriptor* descriptor_; |
| + const bool is_stub_; |
| + union { |
| + const CodeStubInterfaceDescriptor* stub_descriptor_; |
| + const CallInterfaceDescriptor* call_descriptor_; |
| + }; |
| ZoneList<HValue*> values_; |
| int argument_count_; |
| }; |