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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // is guaranteed to be sub type of this type. | 111 // is guaranteed to be sub type of this type. |
112 // | 112 // |
113 // Values of CompileType form a lattice with a None type as a bottom and a | 113 // Values of CompileType form a lattice with a None type as a bottom and a |
114 // nullable Dynamic type as a top element. Method Union provides a join | 114 // nullable Dynamic type as a top element. Method Union provides a join |
115 // operation for the lattice. | 115 // operation for the lattice. |
116 class CompileType : public ValueObject { | 116 class CompileType : public ValueObject { |
117 public: | 117 public: |
118 static const bool kNullable = true; | 118 static const bool kNullable = true; |
119 static const bool kNonNullable = false; | 119 static const bool kNonNullable = false; |
120 | 120 |
| 121 CompileType(bool is_nullable, intptr_t cid, const AbstractType* type) |
| 122 : is_nullable_(is_nullable), cid_(cid), type_(type) { } |
| 123 |
121 CompileType(const CompileType& other) | 124 CompileType(const CompileType& other) |
122 : ValueObject(), | 125 : ValueObject(), |
123 is_nullable_(other.is_nullable_), | 126 is_nullable_(other.is_nullable_), |
124 cid_(other.cid_), | 127 cid_(other.cid_), |
125 type_(other.type_) { } | 128 type_(other.type_) { } |
126 | 129 |
127 CompileType& operator=(const CompileType& other) { | 130 CompileType& operator=(const CompileType& other) { |
128 is_nullable_ = other.is_nullable_; | 131 is_nullable_ = other.is_nullable_; |
129 cid_ = other.cid_; | 132 cid_ = other.cid_; |
130 type_ = other.type_; | 133 type_ = other.type_; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } | 206 } |
204 | 207 |
205 bool IsNone() const { | 208 bool IsNone() const { |
206 return (cid_ == kIllegalCid) && (type_ == NULL); | 209 return (cid_ == kIllegalCid) && (type_ == NULL); |
207 } | 210 } |
208 | 211 |
209 void PrintTo(BufferFormatter* f) const; | 212 void PrintTo(BufferFormatter* f) const; |
210 const char* ToCString() const; | 213 const char* ToCString() const; |
211 | 214 |
212 private: | 215 private: |
213 CompileType(bool is_nullable, intptr_t cid, const AbstractType* type) | |
214 : is_nullable_(is_nullable), cid_(cid), type_(type) { } | |
215 | |
216 bool CanComputeIsInstanceOf(const AbstractType& type, | 216 bool CanComputeIsInstanceOf(const AbstractType& type, |
217 bool is_nullable, | 217 bool is_nullable, |
218 bool* is_instance); | 218 bool* is_instance); |
219 | 219 |
220 bool is_nullable_; | 220 bool is_nullable_; |
221 intptr_t cid_; | 221 intptr_t cid_; |
222 const AbstractType* type_; | 222 const AbstractType* type_; |
223 }; | 223 }; |
224 | 224 |
225 | 225 |
(...skipping 4271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4497 ForwardInstructionIterator* current_iterator_; | 4497 ForwardInstructionIterator* current_iterator_; |
4498 | 4498 |
4499 private: | 4499 private: |
4500 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4500 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4501 }; | 4501 }; |
4502 | 4502 |
4503 | 4503 |
4504 } // namespace dart | 4504 } // namespace dart |
4505 | 4505 |
4506 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4506 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |