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 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4088 | 4088 |
4089 virtual bool MayThrow() const { return false; } | 4089 virtual bool MayThrow() const { return false; } |
4090 | 4090 |
4091 private: | 4091 private: |
4092 const ConstructorCallNode& ast_node_; | 4092 const ConstructorCallNode& ast_node_; |
4093 | 4093 |
4094 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr); | 4094 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckInstr); |
4095 }; | 4095 }; |
4096 | 4096 |
4097 | 4097 |
4098 class CreateArrayInstr : public TemplateDefinition<1> { | 4098 class CreateArrayInstr : public TemplateDefinition<2> { |
4099 public: | 4099 public: |
4100 CreateArrayInstr(intptr_t token_pos, | 4100 CreateArrayInstr(intptr_t token_pos, |
4101 intptr_t num_elements, | 4101 Value* element_type, |
4102 const AbstractType& type, | 4102 Value* num_elements) |
4103 Value* element_type) | 4103 : token_pos_(token_pos) { |
4104 : token_pos_(token_pos), | 4104 SetInputAt(kElementTypePos, element_type); |
4105 num_elements_(num_elements), | 4105 SetInputAt(kLengthPos, num_elements); |
4106 type_(type) { | |
4107 ASSERT(type_.IsZoneHandle()); | |
4108 ASSERT(!type_.IsNull()); | |
4109 ASSERT(type_.IsFinalized()); | |
4110 SetInputAt(0, element_type); | |
4111 } | 4106 } |
4112 | 4107 |
| 4108 enum { |
| 4109 kElementTypePos = 0, |
| 4110 kLengthPos = 1 |
| 4111 }; |
| 4112 |
4113 DECLARE_INSTRUCTION(CreateArray) | 4113 DECLARE_INSTRUCTION(CreateArray) |
4114 virtual CompileType ComputeType() const; | 4114 virtual CompileType ComputeType() const; |
4115 | 4115 |
4116 intptr_t num_elements() const { return num_elements_; } | |
4117 | 4116 |
4118 intptr_t token_pos() const { return token_pos_; } | 4117 intptr_t token_pos() const { return token_pos_; } |
4119 const AbstractType& type() const { return type_; } | 4118 Value* element_type() const { return inputs_[kElementTypePos]; } |
4120 Value* element_type() const { return inputs_[0]; } | 4119 Value* num_elements() const { return inputs_[kLengthPos]; } |
4121 | 4120 |
4122 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4121 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4123 | 4122 |
4124 virtual bool CanDeoptimize() const { return false; } | 4123 virtual bool CanDeoptimize() const { return false; } |
4125 | 4124 |
4126 virtual EffectSet Effects() const { return EffectSet::None(); } | 4125 virtual EffectSet Effects() const { return EffectSet::None(); } |
4127 | 4126 |
4128 virtual bool MayThrow() const { return false; } | 4127 virtual bool MayThrow() const { return false; } |
4129 | 4128 |
4130 private: | 4129 private: |
4131 const intptr_t token_pos_; | 4130 const intptr_t token_pos_; |
4132 const intptr_t num_elements_; | |
4133 const AbstractType& type_; | |
4134 | 4131 |
4135 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); | 4132 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); |
4136 }; | 4133 }; |
4137 | 4134 |
4138 | 4135 |
4139 class CreateClosureInstr : public TemplateDefinition<0> { | 4136 class CreateClosureInstr : public TemplateDefinition<0> { |
4140 public: | 4137 public: |
4141 CreateClosureInstr(const Function& function, | 4138 CreateClosureInstr(const Function& function, |
4142 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 4139 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
4143 intptr_t token_pos) | 4140 intptr_t token_pos) |
(...skipping 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7129 ForwardInstructionIterator* current_iterator_; | 7126 ForwardInstructionIterator* current_iterator_; |
7130 | 7127 |
7131 private: | 7128 private: |
7132 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7129 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
7133 }; | 7130 }; |
7134 | 7131 |
7135 | 7132 |
7136 } // namespace dart | 7133 } // namespace dart |
7137 | 7134 |
7138 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7135 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |