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 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3020 const intptr_t token_pos_; | 3020 const intptr_t token_pos_; |
3021 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 3021 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
3022 const AbstractType& type_; | 3022 const AbstractType& type_; |
3023 | 3023 |
3024 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); | 3024 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); |
3025 }; | 3025 }; |
3026 | 3026 |
3027 | 3027 |
3028 class CreateClosureInstr : public TemplateDefinition<0> { | 3028 class CreateClosureInstr : public TemplateDefinition<0> { |
3029 public: | 3029 public: |
3030 CreateClosureInstr(ClosureNode* node, | 3030 CreateClosureInstr(const Function& function, |
3031 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 3031 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3032 : ast_node_(*node), | 3032 intptr_t token_pos) |
3033 arguments_(arguments) { } | 3033 : function_(function), |
| 3034 arguments_(arguments), |
| 3035 token_pos_(token_pos) { } |
3034 | 3036 |
3035 DECLARE_INSTRUCTION(CreateClosure) | 3037 DECLARE_INSTRUCTION(CreateClosure) |
3036 virtual RawAbstractType* CompileType() const; | 3038 virtual RawAbstractType* CompileType() const; |
3037 | 3039 |
3038 intptr_t token_pos() const { return ast_node_.token_pos(); } | 3040 intptr_t token_pos() const { return token_pos_; } |
3039 const Function& function() const { return ast_node_.function(); } | 3041 const Function& function() const { return function_; } |
3040 | 3042 |
3041 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 3043 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
3042 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 3044 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
3043 return (*arguments_)[index]; | 3045 return (*arguments_)[index]; |
3044 } | 3046 } |
3045 | 3047 |
3046 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3048 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3047 | 3049 |
3048 virtual bool CanDeoptimize() const { return false; } | 3050 virtual bool CanDeoptimize() const { return false; } |
3049 | 3051 |
3050 virtual bool HasSideEffect() const { return true; } | 3052 virtual bool HasSideEffect() const { return true; } |
3051 | 3053 |
3052 virtual intptr_t ResultCid() const { return kDynamicCid; } | 3054 virtual intptr_t ResultCid() const { return kDynamicCid; } |
3053 | 3055 |
3054 private: | 3056 private: |
3055 const ClosureNode& ast_node_; | 3057 const Function& function_; |
3056 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 3058 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 3059 intptr_t token_pos_; |
3057 | 3060 |
3058 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr); | 3061 DISALLOW_COPY_AND_ASSIGN(CreateClosureInstr); |
3059 }; | 3062 }; |
3060 | 3063 |
3061 | 3064 |
3062 class LoadFieldInstr : public TemplateDefinition<1> { | 3065 class LoadFieldInstr : public TemplateDefinition<1> { |
3063 public: | 3066 public: |
3064 LoadFieldInstr(Value* value, | 3067 LoadFieldInstr(Value* value, |
3065 intptr_t offset_in_bytes, | 3068 intptr_t offset_in_bytes, |
3066 const AbstractType& type, | 3069 const AbstractType& type, |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4386 ForwardInstructionIterator* current_iterator_; | 4389 ForwardInstructionIterator* current_iterator_; |
4387 | 4390 |
4388 private: | 4391 private: |
4389 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4392 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4390 }; | 4393 }; |
4391 | 4394 |
4392 | 4395 |
4393 } // namespace dart | 4396 } // namespace dart |
4394 | 4397 |
4395 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4398 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |