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 2832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2843 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2844 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2844 virtual bool AttributesEqual(Instruction* other) const { return true; } |
2845 | 2845 |
2846 virtual bool MayThrow() const { return false; } | 2846 virtual bool MayThrow() const { return false; } |
2847 | 2847 |
2848 private: | 2848 private: |
2849 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); | 2849 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); |
2850 }; | 2850 }; |
2851 | 2851 |
2852 | 2852 |
2853 class ClosureCallInstr : public TemplateDefinition<0> { | 2853 class ClosureCallInstr : public TemplateDefinition<1> { |
2854 public: | 2854 public: |
2855 ClosureCallInstr(ClosureCallNode* node, | 2855 ClosureCallInstr(Value* function, |
| 2856 ClosureCallNode* node, |
2856 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 2857 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
2857 : ast_node_(*node), | 2858 : ast_node_(*node), |
2858 arguments_(arguments) { } | 2859 arguments_(arguments) { |
| 2860 SetInputAt(0, function); |
| 2861 } |
2859 | 2862 |
2860 DECLARE_INSTRUCTION(ClosureCall) | 2863 DECLARE_INSTRUCTION(ClosureCall) |
2861 | 2864 |
2862 const Array& argument_names() const { return ast_node_.arguments()->names(); } | 2865 const Array& argument_names() const { return ast_node_.arguments()->names(); } |
2863 intptr_t token_pos() const { return ast_node_.token_pos(); } | 2866 intptr_t token_pos() const { return ast_node_.token_pos(); } |
2864 | 2867 |
2865 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2868 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
2866 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2869 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
2867 return (*arguments_)[index]; | 2870 return (*arguments_)[index]; |
2868 } | 2871 } |
(...skipping 4924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7793 const Code& code() const { return code_; } | 7796 const Code& code() const { return code_; } |
7794 | 7797 |
7795 Environment* DeepCopy() const { return DeepCopy(Length()); } | 7798 Environment* DeepCopy() const { return DeepCopy(Length()); } |
7796 | 7799 |
7797 void DeepCopyTo(Instruction* instr) const; | 7800 void DeepCopyTo(Instruction* instr) const; |
7798 void DeepCopyToOuter(Instruction* instr) const; | 7801 void DeepCopyToOuter(Instruction* instr) const; |
7799 | 7802 |
7800 void PrintTo(BufferFormatter* f) const; | 7803 void PrintTo(BufferFormatter* f) const; |
7801 const char* ToCString() const; | 7804 const char* ToCString() const; |
7802 | 7805 |
| 7806 // Deep copy an environment. The 'length' parameter may be less than the |
| 7807 // environment's length in order to drop values (e.g., passed arguments) |
| 7808 // from the copy. |
| 7809 Environment* DeepCopy(intptr_t length) const; |
| 7810 |
7803 private: | 7811 private: |
7804 friend class ShallowIterator; | 7812 friend class ShallowIterator; |
7805 | 7813 |
7806 Environment(intptr_t length, | 7814 Environment(intptr_t length, |
7807 intptr_t fixed_parameter_count, | 7815 intptr_t fixed_parameter_count, |
7808 intptr_t deopt_id, | 7816 intptr_t deopt_id, |
7809 const Code& code, | 7817 const Code& code, |
7810 Environment* outer) | 7818 Environment* outer) |
7811 : values_(length), | 7819 : values_(length), |
7812 locations_(NULL), | 7820 locations_(NULL), |
7813 fixed_parameter_count_(fixed_parameter_count), | 7821 fixed_parameter_count_(fixed_parameter_count), |
7814 deopt_id_(deopt_id), | 7822 deopt_id_(deopt_id), |
7815 code_(code), | 7823 code_(code), |
7816 outer_(outer) { } | 7824 outer_(outer) { } |
7817 | 7825 |
7818 // Deep copy an environment. The 'length' parameter may be less than the | |
7819 // environment's length in order to drop values (e.g., passed arguments) | |
7820 // from the copy. | |
7821 Environment* DeepCopy(intptr_t length) const; | |
7822 | 7826 |
7823 GrowableArray<Value*> values_; | 7827 GrowableArray<Value*> values_; |
7824 Location* locations_; | 7828 Location* locations_; |
7825 const intptr_t fixed_parameter_count_; | 7829 const intptr_t fixed_parameter_count_; |
7826 intptr_t deopt_id_; | 7830 intptr_t deopt_id_; |
7827 const Code& code_; | 7831 const Code& code_; |
7828 Environment* outer_; | 7832 Environment* outer_; |
7829 | 7833 |
7830 DISALLOW_COPY_AND_ASSIGN(Environment); | 7834 DISALLOW_COPY_AND_ASSIGN(Environment); |
7831 }; | 7835 }; |
(...skipping 29 matching lines...) Expand all Loading... |
7861 ForwardInstructionIterator* current_iterator_; | 7865 ForwardInstructionIterator* current_iterator_; |
7862 | 7866 |
7863 private: | 7867 private: |
7864 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7868 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
7865 }; | 7869 }; |
7866 | 7870 |
7867 | 7871 |
7868 } // namespace dart | 7872 } // namespace dart |
7869 | 7873 |
7870 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7874 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |