Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
| index a7f3d7f8c4c6f3006486a53c33cf2fe8b52411a3..931de101a191130df7e1f4d9641b4c6102a4f85e 100644 |
| --- a/runtime/vm/intermediate_language.h |
| +++ b/runtime/vm/intermediate_language.h |
| @@ -8188,6 +8188,30 @@ class Environment : public ZoneAllocated { |
| // from the copy. |
| Environment* DeepCopy(Zone* zone, intptr_t length) const; |
| +#if defined(TARGET_ARCH_DBC) |
| + // Return/ReturnTOS instruction drops incoming arguments so |
| + // we have to drop outgoing arguments from the innermost environment. |
| + // On all other architectures caller drops outgoing arguments itself |
| + // hence the difference. |
| + // Note: this method can only be used at the code generation stage because |
| + // it mutates environment in unsafe way (e.g. does not update def-use |
| + // chains). |
| + void DropArguments(intptr_t argc) { |
|
Florian Schneider
2016/05/19 13:21:40
Maybe put only a declaration here, and put the def
Vyacheslav Egorov (Google)
2016/05/19 15:19:40
Done.
|
| +#if defined(DEBUG) |
| + // Check that we are in the backend - register allocation has been run. |
| + ASSERT(locations_ != NULL); |
| + |
| + // Check that we are only dropping PushArgument instructions from the |
| + // environment. |
| + ASSERT(argc <= values_.length()); |
| + for (intptr_t i = 0; i < argc; i++) { |
| + ASSERT(values_[values_.length() - i - 1]->definition()->IsPushArgument()); |
| + } |
| +#endif |
| + values_.TruncateTo(values_.length() - argc); |
| + } |
| +#endif |
| + |
| private: |
| friend class ShallowIterator; |