Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index 425683c4fb4d2626736f6cd81bce88385163003a..c5858c0534d7b2448341096bdc4557a060adcc96 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -2321,12 +2321,13 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| public: |
| static HCallWithDescriptor* New(Zone* zone, HValue* context, |
| HValue* target, |
| + HValue* call_context, |
| int argument_count, |
| - const CallInterfaceDescriptor* descriptor, |
| + const InterfaceDescriptor* descriptor, |
| const Vector<HValue*>& operands) { |
| ASSERT(operands.length() == descriptor->environment_length()); |
| HCallWithDescriptor* res = |
| - new(zone) HCallWithDescriptor(target, argument_count, |
| + new(zone) HCallWithDescriptor(target, call_context, argument_count, |
| descriptor, operands, zone); |
| return res; |
| } |
| @@ -2338,12 +2339,18 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| return values_[index]; |
| } |
| + int FirstDescriptorOperandIndex() const { |
| + // Our Operand array contains target and possibly context before the |
| + // descriptor parameters. |
| + return descriptor_->needs_context_register() ? 2 : 1; |
|
danno
2014/07/15 07:48:31
Is it possible to roll this into the descriptor, t
|
| + } |
| + |
| virtual Representation RequiredInputRepresentation( |
| int index) V8_FINAL V8_OVERRIDE { |
| - if (index == 0) { |
| + if (index < FirstDescriptorOperandIndex()) { |
| return Representation::Tagged(); |
| } else { |
| - int par_index = index - 1; |
| + int par_index = index - FirstDescriptorOperandIndex(); |
| ASSERT(par_index < descriptor_->environment_length()); |
| return descriptor_->GetParameterRepresentation(par_index); |
| } |
| @@ -2363,7 +2370,7 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| return -argument_count_; |
| } |
| - const CallInterfaceDescriptor* descriptor() const { |
| + const InterfaceDescriptor* descriptor() const { |
| return descriptor_; |
| } |
| @@ -2371,19 +2378,29 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| return OperandAt(0); |
| } |
| + HValue* context() { |
| + ASSERT(descriptor_->needs_context_register()); |
| + return OperandAt(1); |
| + } |
| + |
| virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT |
| private: |
| // The argument count includes the receiver. |
| HCallWithDescriptor(HValue* target, |
| + HValue* context, |
| int argument_count, |
| - const CallInterfaceDescriptor* descriptor, |
| + const InterfaceDescriptor* descriptor, |
| const Vector<HValue*>& operands, |
| Zone* zone) |
| : descriptor_(descriptor), |
| - values_(descriptor->environment_length() + 1, zone) { |
| + values_(value_array_length(descriptor), zone) { |
| argument_count_ = argument_count; |
| AddOperand(target, zone); |
| + if (descriptor->needs_context_register()) { |
| + ASSERT(context != NULL); |
| + AddOperand(context, zone); |
| + } |
| for (int i = 0; i < operands.length(); i++) { |
| AddOperand(operands[i], zone); |
| } |
| @@ -2391,6 +2408,11 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| this->SetAllSideEffects(); |
| } |
| + static int value_array_length(const InterfaceDescriptor* descriptor) { |
| + int extra_operands = descriptor->needs_context_register() ? 2 : 1; |
| + return descriptor->environment_length() + extra_operands; |
|
danno
2014/07/15 07:48:31
Similar to GetParameterRepresentation, you will ne
|
| + } |
| + |
| void AddOperand(HValue* v, Zone* zone) { |
| values_.Add(NULL, zone); |
| SetOperandAt(values_.length() - 1, v); |
| @@ -2401,7 +2423,7 @@ class HCallWithDescriptor V8_FINAL : public HInstruction { |
| values_[index] = value; |
| } |
| - const CallInterfaceDescriptor* descriptor_; |
| + const InterfaceDescriptor* descriptor_; |
| ZoneList<HValue*> values_; |
| int argument_count_; |
| }; |