| 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 6134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6145 }; | 6145 }; |
| 6146 | 6146 |
| 6147 | 6147 |
| 6148 class CheckArrayBoundInstr : public TemplateInstruction<2> { | 6148 class CheckArrayBoundInstr : public TemplateInstruction<2> { |
| 6149 public: | 6149 public: |
| 6150 CheckArrayBoundInstr(Value* length, | 6150 CheckArrayBoundInstr(Value* length, |
| 6151 Value* index, | 6151 Value* index, |
| 6152 intptr_t array_type, | 6152 intptr_t array_type, |
| 6153 InstanceCallInstr* instance_call) | 6153 InstanceCallInstr* instance_call) |
| 6154 : array_type_(array_type) { | 6154 : array_type_(array_type) { |
| 6155 SetInputAt(0, length); | 6155 SetInputAt(kLengthPos, length); |
| 6156 SetInputAt(1, index); | 6156 SetInputAt(kIndexPos, index); |
| 6157 deopt_id_ = instance_call->deopt_id(); | 6157 deopt_id_ = instance_call->deopt_id(); |
| 6158 } | 6158 } |
| 6159 | 6159 |
| 6160 Value* length() const { return inputs_[0]; } | 6160 Value* length() const { return inputs_[kLengthPos]; } |
| 6161 Value* index() const { return inputs_[1]; } | 6161 Value* index() const { return inputs_[kIndexPos]; } |
| 6162 | 6162 |
| 6163 intptr_t array_type() const { return array_type_; } | 6163 intptr_t array_type() const { return array_type_; } |
| 6164 | 6164 |
| 6165 DECLARE_INSTRUCTION(CheckArrayBound) | 6165 DECLARE_INSTRUCTION(CheckArrayBound) |
| 6166 | 6166 |
| 6167 virtual intptr_t ArgumentCount() const { return 0; } | 6167 virtual intptr_t ArgumentCount() const { return 0; } |
| 6168 | 6168 |
| 6169 virtual bool CanDeoptimize() const { return true; } | 6169 virtual bool CanDeoptimize() const { return true; } |
| 6170 | 6170 |
| 6171 bool IsRedundant(RangeBoundary length); | 6171 bool IsRedundant(RangeBoundary length); |
| 6172 | 6172 |
| 6173 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 6174 |
| 6173 // Returns the length offset for array and string types. | 6175 // Returns the length offset for array and string types. |
| 6174 static intptr_t LengthOffsetFor(intptr_t class_id); | 6176 static intptr_t LengthOffsetFor(intptr_t class_id); |
| 6175 | 6177 |
| 6176 static bool IsFixedLengthArrayType(intptr_t class_id); | 6178 static bool IsFixedLengthArrayType(intptr_t class_id); |
| 6177 | 6179 |
| 6178 virtual bool AllowsCSE() const { return true; } | 6180 virtual bool AllowsCSE() const { return true; } |
| 6179 virtual EffectSet Effects() const { return EffectSet::None(); } | 6181 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 6180 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 6182 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 6181 virtual bool AttributesEqual(Instruction* other) const; | 6183 virtual bool AttributesEqual(Instruction* other) const; |
| 6182 | 6184 |
| 6183 virtual bool MayThrow() const { return false; } | 6185 virtual bool MayThrow() const { return false; } |
| 6184 | 6186 |
| 6185 private: | 6187 private: |
| 6188 // Give a name to the location/input indices. |
| 6189 enum { |
| 6190 kLengthPos = 0, |
| 6191 kIndexPos = 1 |
| 6192 }; |
| 6186 intptr_t array_type_; | 6193 intptr_t array_type_; |
| 6187 | 6194 |
| 6188 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); | 6195 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); |
| 6189 }; | 6196 }; |
| 6190 | 6197 |
| 6191 | 6198 |
| 6192 #undef DECLARE_INSTRUCTION | 6199 #undef DECLARE_INSTRUCTION |
| 6193 | 6200 |
| 6194 class Environment : public ZoneAllocated { | 6201 class Environment : public ZoneAllocated { |
| 6195 public: | 6202 public: |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6406 ForwardInstructionIterator* current_iterator_; | 6413 ForwardInstructionIterator* current_iterator_; |
| 6407 | 6414 |
| 6408 private: | 6415 private: |
| 6409 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6416 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 6410 }; | 6417 }; |
| 6411 | 6418 |
| 6412 | 6419 |
| 6413 } // namespace dart | 6420 } // namespace dart |
| 6414 | 6421 |
| 6415 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6422 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |