Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
| index 1d70a291fb7b5f59b0aa6dd7475c2d8e15a2a291..5be9f08650879ec40631a16d73970d32b47fefc4 100644 |
| --- a/runtime/vm/intermediate_language.h |
| +++ b/runtime/vm/intermediate_language.h |
| @@ -366,10 +366,11 @@ class Instruction : public ZoneAllocated { |
| // Call instructions override this function and return the number of |
| // pushed arguments. |
| virtual intptr_t ArgumentCount() const = 0; |
| - virtual PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| UNREACHABLE(); |
| return NULL; |
| - }; |
| + } |
| + inline Definition* ArgumentAt(intptr_t index) const; |
|
Vyacheslav Egorov (Google)
2013/02/08 16:44:49
I like the naming cleanup.
|
| // Returns true, if this instruction can deoptimize. |
| virtual bool CanDeoptimize() const = 0; |
| @@ -1408,6 +1409,11 @@ class PushArgumentInstr : public Definition { |
| }; |
| +inline Definition* Instruction::ArgumentAt(intptr_t index) const { |
| + return PushArgumentAt(index)->value()->definition(); |
| +} |
| + |
| + |
| class ReturnInstr : public TemplateInstruction<1> { |
| public: |
| ReturnInstr(intptr_t token_pos, Value* value) |
| @@ -2075,7 +2081,7 @@ class ClosureCallInstr : public TemplateDefinition<0> { |
| intptr_t token_pos() const { return ast_node_.token_pos(); } |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| - PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| return (*arguments_)[index]; |
| } |
| @@ -2137,7 +2143,7 @@ class InstanceCallInstr : public TemplateDefinition<0> { |
| const String& function_name() const { return function_name_; } |
| Token::Kind token_kind() const { return token_kind_; } |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| - PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| return (*arguments_)[index]; |
| } |
| const Array& argument_names() const { return argument_names_; } |
| @@ -2185,8 +2191,8 @@ class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { |
| virtual intptr_t ArgumentCount() const { |
| return instance_call()->ArgumentCount(); |
| } |
| - PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| - return instance_call()->ArgumentAt(index); |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| + return instance_call()->PushArgumentAt(index); |
| } |
| DECLARE_INSTRUCTION(PolymorphicInstanceCall) |
| @@ -2490,7 +2496,7 @@ class StaticCallInstr : public TemplateDefinition<0> { |
| intptr_t token_pos() const { return token_pos_; } |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| - PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| return (*arguments_)[index]; |
| } |
| @@ -2950,7 +2956,7 @@ class AllocateObjectInstr : public TemplateDefinition<0> { |
| virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| - PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| return (*arguments_)[index]; |
| } |
| @@ -3018,7 +3024,7 @@ class CreateArrayInstr : public TemplateDefinition<1> { |
| type_(type) { |
| #if defined(DEBUG) |
| for (int i = 0; i < ArgumentCount(); ++i) { |
| - ASSERT(ArgumentAt(i) != NULL); |
| + ASSERT(PushArgumentAt(i) != NULL); |
| } |
| ASSERT(element_type != NULL); |
| ASSERT(type_.IsZoneHandle()); |
| @@ -3032,9 +3038,11 @@ class CreateArrayInstr : public TemplateDefinition<1> { |
| virtual RawAbstractType* CompileType() const; |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t i) const { |
| + return (*arguments_)[i]; |
| + } |
| intptr_t token_pos() const { return token_pos_; } |
| - PushArgumentInstr* ArgumentAt(intptr_t i) const { return (*arguments_)[i]; } |
| const AbstractType& type() const { return type_; } |
| Value* element_type() const { return inputs_[0]; } |
| @@ -3071,7 +3079,7 @@ class CreateClosureInstr : public TemplateDefinition<0> { |
| const Function& function() const { return function_; } |
| virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| - PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| + virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| return (*arguments_)[index]; |
| } |