| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 private: | 290 private: |
| 291 const Object& value_; | 291 const Object& value_; |
| 292 | 292 |
| 293 DISALLOW_COPY_AND_ASSIGN(ConstantVal); | 293 DISALLOW_COPY_AND_ASSIGN(ConstantVal); |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 #undef DECLARE_VALUE | 296 #undef DECLARE_VALUE |
| 297 | 297 |
| 298 | 298 |
| 299 class AssertAssignableComp : public Computation { | 299 class AssertAssignableComp : public TemplateComputation<3> { |
| 300 public: | 300 public: |
| 301 AssertAssignableComp(intptr_t token_index, | 301 AssertAssignableComp(intptr_t token_index, |
| 302 intptr_t try_index, | 302 intptr_t try_index, |
| 303 Value* value, | 303 Value* value, |
| 304 Value* instantiator, // Can be NULL. | 304 Value* instantiator, |
| 305 Value* instantiator_type_arguments, // Can be NULL. | 305 Value* instantiator_type_arguments, |
| 306 const AbstractType& dst_type, | 306 const AbstractType& dst_type, |
| 307 const String& dst_name) | 307 const String& dst_name) |
| 308 : token_index_(token_index), | 308 : token_index_(token_index), |
| 309 try_index_(try_index), | 309 try_index_(try_index), |
| 310 value_(value), | |
| 311 instantiator_(instantiator), | |
| 312 instantiator_type_arguments_(instantiator_type_arguments), | |
| 313 dst_type_(dst_type), | 310 dst_type_(dst_type), |
| 314 dst_name_(dst_name) { | 311 dst_name_(dst_name) { |
| 315 ASSERT(value_ != NULL); | 312 ASSERT(value != NULL); |
| 313 ASSERT(instantiator != NULL); |
| 314 ASSERT(instantiator_type_arguments != NULL); |
| 316 ASSERT(!dst_type.IsNull()); | 315 ASSERT(!dst_type.IsNull()); |
| 317 ASSERT(!dst_name.IsNull()); | 316 ASSERT(!dst_name.IsNull()); |
| 317 inputs_[0] = value; |
| 318 inputs_[1] = instantiator; |
| 319 inputs_[2] = instantiator_type_arguments; |
| 318 } | 320 } |
| 319 | 321 |
| 320 DECLARE_COMPUTATION(AssertAssignable) | 322 DECLARE_COMPUTATION(AssertAssignable) |
| 321 | 323 |
| 322 intptr_t token_index() const { return token_index_; } | 324 intptr_t token_index() const { return token_index_; } |
| 323 intptr_t try_index() const { return try_index_; } | 325 intptr_t try_index() const { return try_index_; } |
| 324 Value* value() const { return value_; } | 326 Value* value() const { return inputs_[0]; } |
| 325 Value* instantiator() const { return instantiator_; } | 327 Value* instantiator() const { return inputs_[1]; } |
| 326 Value* instantiator_type_arguments() const { | 328 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 327 return instantiator_type_arguments_; | |
| 328 } | |
| 329 const AbstractType& dst_type() const { return dst_type_; } | 329 const AbstractType& dst_type() const { return dst_type_; } |
| 330 const String& dst_name() const { return dst_name_; } | 330 const String& dst_name() const { return dst_name_; } |
| 331 | 331 |
| 332 virtual intptr_t InputCount() const; | |
| 333 virtual Value* InputAt(intptr_t i) const { | |
| 334 if (i == 0) return value(); | |
| 335 if (i == 1) return instantiator_type_arguments(); | |
| 336 return NULL; | |
| 337 } | |
| 338 | |
| 339 virtual void PrintOperandsTo(BufferFormatter* f) const; | 332 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 340 | 333 |
| 341 private: | 334 private: |
| 342 const intptr_t token_index_; | 335 const intptr_t token_index_; |
| 343 const intptr_t try_index_; | 336 const intptr_t try_index_; |
| 344 Value* value_; | |
| 345 Value* instantiator_; | |
| 346 Value* instantiator_type_arguments_; | |
| 347 const AbstractType& dst_type_; | 337 const AbstractType& dst_type_; |
| 348 const String& dst_name_; | 338 const String& dst_name_; |
| 349 | 339 |
| 350 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); | 340 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); |
| 351 }; | 341 }; |
| 352 | 342 |
| 353 | 343 |
| 354 class AssertBooleanComp : public TemplateComputation<1> { | 344 class AssertBooleanComp : public TemplateComputation<1> { |
| 355 public: | 345 public: |
| 356 AssertBooleanComp(intptr_t token_index, | 346 AssertBooleanComp(intptr_t token_index, |
| (...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 const GrowableArray<BlockEntryInstr*>& block_order_; | 1895 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1906 | 1896 |
| 1907 private: | 1897 private: |
| 1908 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1898 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1909 }; | 1899 }; |
| 1910 | 1900 |
| 1911 | 1901 |
| 1912 } // namespace dart | 1902 } // namespace dart |
| 1913 | 1903 |
| 1914 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1904 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |