OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 3026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3037 const intptr_t token_pos_; | 3037 const intptr_t token_pos_; |
3038 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 3038 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
3039 const AbstractType& type_; | 3039 const AbstractType& type_; |
3040 | 3040 |
3041 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); | 3041 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); |
3042 }; | 3042 }; |
3043 | 3043 |
3044 | 3044 |
3045 class CreateClosureInstr : public TemplateDefinition<0> { | 3045 class CreateClosureInstr : public TemplateDefinition<0> { |
3046 public: | 3046 public: |
3047 CreateClosureInstr(ClosureNode* node, | 3047 CreateClosureInstr(const Function& function, |
3048 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 3048 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3049 : ast_node_(*node), | 3049 intptr_t token_pos) |
3050 arguments_(arguments) { } | 3050 : function_(function), |
| 3051 arguments_(arguments), |
| 3052 token_pos_(token_pos) { } |
3051 | 3053 |
3052 DECLARE_INSTRUCTION(CreateClosure) | 3054 DECLARE_INSTRUCTION(CreateClosure) |
3053 virtual RawAbstractType* CompileType() const; | 3055 virtual RawAbstractType* CompileType() const; |
3054 | 3056 |
3055 intptr_t token_pos() const { return ast_node_.token_pos(); } | 3057 intptr_t token_pos() const { return token_pos_; } |
3056 const Function& function() const { return ast_node_.function(); } | 3058 const Function& function() const { return function_; } |
3057 | 3059 |
3058 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 3060 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
3059 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 3061 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
3060 return (*arguments_)[index]; | 3062 return (*arguments_)[index]; |
3061 } | 3063 } |
3062 | 3064 |
3063 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3065 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3064 | 3066 |
3065 virtual bool CanDeoptimize() const { return false; } | 3067 virtual bool CanDeoptimize() const { return false; } |
3066 | 3068 |
3067 virtual bool HasSideEffect() const { return true; } | 3069 virtual bool HasSideEffect() const { return true; } |
3068 | 3070 |
3069 virtual intptr_t ResultCid() const { return kDynamicCid; } | 3071 virtual intptr_t ResultCid() const { return kDynamicCid; } |
3070 | 3072 |
3071 private: | 3073 private: |
3072 const ClosureNode& ast_node_; | 3074 const Function& function_; |
3073 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 3075 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 3076 intptr_t token_pos_; |
3074 | 3077 |
3075 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr); | 3078 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr); |
3076 }; | 3079 }; |
3077 | 3080 |
3078 | 3081 |
3079 class LoadFieldInstr : public TemplateDefinition<1> { | 3082 class LoadFieldInstr : public TemplateDefinition<1> { |
3080 public: | 3083 public: |
3081 LoadFieldInstr(Value* value, | 3084 LoadFieldInstr(Value* value, |
3082 intptr_t offset_in_bytes, | 3085 intptr_t offset_in_bytes, |
3083 const AbstractType& type, | 3086 const AbstractType& type, |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4319 ForwardInstructionIterator* current_iterator_; | 4322 ForwardInstructionIterator* current_iterator_; |
4320 | 4323 |
4321 private: | 4324 private: |
4322 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4325 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4323 }; | 4326 }; |
4324 | 4327 |
4325 | 4328 |
4326 } // namespace dart | 4329 } // namespace dart |
4327 | 4330 |
4328 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4331 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |