| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 6871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6882 iterator_ = ShallowIterator(iterator_.environment()->outer()); | 6882 iterator_ = ShallowIterator(iterator_.environment()->outer()); |
| 6883 } | 6883 } |
| 6884 } | 6884 } |
| 6885 | 6885 |
| 6886 ShallowIterator iterator_; | 6886 ShallowIterator iterator_; |
| 6887 }; | 6887 }; |
| 6888 | 6888 |
| 6889 // Construct an environment by constructing uses from an array of definitions. | 6889 // Construct an environment by constructing uses from an array of definitions. |
| 6890 static Environment* From(const GrowableArray<Definition*>& definitions, | 6890 static Environment* From(const GrowableArray<Definition*>& definitions, |
| 6891 intptr_t fixed_parameter_count, | 6891 intptr_t fixed_parameter_count, |
| 6892 const Function& function); | 6892 const Code& code); |
| 6893 | 6893 |
| 6894 void set_locations(Location* locations) { | 6894 void set_locations(Location* locations) { |
| 6895 ASSERT(locations_ == NULL); | 6895 ASSERT(locations_ == NULL); |
| 6896 locations_ = locations; | 6896 locations_ = locations; |
| 6897 } | 6897 } |
| 6898 | 6898 |
| 6899 void set_deopt_id(intptr_t deopt_id) { deopt_id_ = deopt_id; } | 6899 void set_deopt_id(intptr_t deopt_id) { deopt_id_ = deopt_id; } |
| 6900 intptr_t deopt_id() const { return deopt_id_; } | 6900 intptr_t deopt_id() const { return deopt_id_; } |
| 6901 | 6901 |
| 6902 Environment* outer() const { return outer_; } | 6902 Environment* outer() const { return outer_; } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6922 index -= env->Length(); | 6922 index -= env->Length(); |
| 6923 env = env->outer_; | 6923 env = env->outer_; |
| 6924 } | 6924 } |
| 6925 return env->ValueAt(index); | 6925 return env->ValueAt(index); |
| 6926 } | 6926 } |
| 6927 | 6927 |
| 6928 intptr_t fixed_parameter_count() const { | 6928 intptr_t fixed_parameter_count() const { |
| 6929 return fixed_parameter_count_; | 6929 return fixed_parameter_count_; |
| 6930 } | 6930 } |
| 6931 | 6931 |
| 6932 const Function& function() const { return function_; } | 6932 const Code& code() const { return code_; } |
| 6933 | 6933 |
| 6934 Environment* DeepCopy() const { return DeepCopy(Length()); } | 6934 Environment* DeepCopy() const { return DeepCopy(Length()); } |
| 6935 | 6935 |
| 6936 void DeepCopyTo(Instruction* instr) const; | 6936 void DeepCopyTo(Instruction* instr) const; |
| 6937 void DeepCopyToOuter(Instruction* instr) const; | 6937 void DeepCopyToOuter(Instruction* instr) const; |
| 6938 | 6938 |
| 6939 void PrintTo(BufferFormatter* f) const; | 6939 void PrintTo(BufferFormatter* f) const; |
| 6940 | 6940 |
| 6941 private: | 6941 private: |
| 6942 friend class ShallowIterator; | 6942 friend class ShallowIterator; |
| 6943 | 6943 |
| 6944 Environment(intptr_t length, | 6944 Environment(intptr_t length, |
| 6945 intptr_t fixed_parameter_count, | 6945 intptr_t fixed_parameter_count, |
| 6946 intptr_t deopt_id, | 6946 intptr_t deopt_id, |
| 6947 const Function& function, | 6947 const Code& code, |
| 6948 Environment* outer) | 6948 Environment* outer) |
| 6949 : values_(length), | 6949 : values_(length), |
| 6950 locations_(NULL), | 6950 locations_(NULL), |
| 6951 fixed_parameter_count_(fixed_parameter_count), | 6951 fixed_parameter_count_(fixed_parameter_count), |
| 6952 deopt_id_(deopt_id), | 6952 deopt_id_(deopt_id), |
| 6953 function_(function), | 6953 code_(code), |
| 6954 outer_(outer) { } | 6954 outer_(outer) { } |
| 6955 | 6955 |
| 6956 // Deep copy an environment. The 'length' parameter may be less than the | 6956 // Deep copy an environment. The 'length' parameter may be less than the |
| 6957 // environment's length in order to drop values (e.g., passed arguments) | 6957 // environment's length in order to drop values (e.g., passed arguments) |
| 6958 // from the copy. | 6958 // from the copy. |
| 6959 Environment* DeepCopy(intptr_t length) const; | 6959 Environment* DeepCopy(intptr_t length) const; |
| 6960 | 6960 |
| 6961 GrowableArray<Value*> values_; | 6961 GrowableArray<Value*> values_; |
| 6962 Location* locations_; | 6962 Location* locations_; |
| 6963 const intptr_t fixed_parameter_count_; | 6963 const intptr_t fixed_parameter_count_; |
| 6964 intptr_t deopt_id_; | 6964 intptr_t deopt_id_; |
| 6965 const Function& function_; | 6965 const Code& code_; |
| 6966 Environment* outer_; | 6966 Environment* outer_; |
| 6967 | 6967 |
| 6968 DISALLOW_COPY_AND_ASSIGN(Environment); | 6968 DISALLOW_COPY_AND_ASSIGN(Environment); |
| 6969 }; | 6969 }; |
| 6970 | 6970 |
| 6971 | 6971 |
| 6972 // Visitor base class to visit each instruction and computation in a flow | 6972 // Visitor base class to visit each instruction and computation in a flow |
| 6973 // graph as defined by a reversed list of basic blocks. | 6973 // graph as defined by a reversed list of basic blocks. |
| 6974 class FlowGraphVisitor : public ValueObject { | 6974 class FlowGraphVisitor : public ValueObject { |
| 6975 public: | 6975 public: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6999 ForwardInstructionIterator* current_iterator_; | 6999 ForwardInstructionIterator* current_iterator_; |
| 7000 | 7000 |
| 7001 private: | 7001 private: |
| 7002 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7002 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 7003 }; | 7003 }; |
| 7004 | 7004 |
| 7005 | 7005 |
| 7006 } // namespace dart | 7006 } // namespace dart |
| 7007 | 7007 |
| 7008 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7008 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |