| 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" |
| 11 #include "vm/handles_impl.h" | 11 #include "vm/handles_impl.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 class BitVector; | 16 class BitVector; |
| 17 class FlowGraphCompiler; | 17 class FlowGraphCompiler; |
| 18 class FlowGraphVisitor; | 18 class FlowGraphVisitor; |
| 19 class Function; |
| 19 class LocalVariable; | 20 class LocalVariable; |
| 20 class LocationSummary; | 21 class LocationSummary; |
| 21 | 22 |
| 22 // M is a two argument macro. It is applied to each concrete value's | 23 // M is a two argument macro. It is applied to each concrete value's |
| 23 // typename and classname. | 24 // typename and classname. |
| 24 #define FOR_EACH_VALUE(M) \ | 25 #define FOR_EACH_VALUE(M) \ |
| 25 M(Use, UseVal) \ | 26 M(Use, UseVal) \ |
| 26 M(Constant, ConstantVal) \ | 27 M(Constant, ConstantVal) \ |
| 27 | 28 |
| 28 | 29 |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 606 |
| 606 class EqualityCompareComp : public ComparisonComp { | 607 class EqualityCompareComp : public ComparisonComp { |
| 607 public: | 608 public: |
| 608 EqualityCompareComp(intptr_t token_index, | 609 EqualityCompareComp(intptr_t token_index, |
| 609 intptr_t try_index, | 610 intptr_t try_index, |
| 610 Value* left, | 611 Value* left, |
| 611 Value* right) | 612 Value* right) |
| 612 : ComparisonComp(left, right), | 613 : ComparisonComp(left, right), |
| 613 token_index_(token_index), | 614 token_index_(token_index), |
| 614 try_index_(try_index), | 615 try_index_(try_index), |
| 615 operands_class_id_(kObject) { | 616 class_ids_(NULL), |
| 617 targets_(NULL) { |
| 616 } | 618 } |
| 617 | 619 |
| 618 DECLARE_COMPUTATION(EqualityCompare) | 620 DECLARE_COMPUTATION(EqualityCompare) |
| 619 | 621 |
| 620 intptr_t token_index() const { return token_index_; } | 622 intptr_t token_index() const { return token_index_; } |
| 621 intptr_t try_index() const { return try_index_; } | 623 intptr_t try_index() const { return try_index_; } |
| 622 void set_operands_class_id(intptr_t value) { | 624 void SetPolymorphicTargets(ZoneGrowableArray<intptr_t>* class_ids, |
| 623 operands_class_id_ = value; | 625 ZoneGrowableArray<Function*>* targets) { |
| 626 class_ids_ = class_ids; |
| 627 targets_ = targets; |
| 628 ASSERT(targets_ != NULL); |
| 629 ASSERT(class_ids_ != NULL); |
| 624 } | 630 } |
| 625 intptr_t operands_class_id() const { return operands_class_id_; } | 631 intptr_t NumTargets() const { |
| 632 return class_ids_ == NULL ? 0 : class_ids_->length(); |
| 633 } |
| 634 Function* TargetAt(intptr_t ix) const { |
| 635 ASSERT(targets_ != NULL); |
| 636 return (*targets_)[ix]; |
| 637 } |
| 638 intptr_t ClassIdAt(intptr_t ix) const { |
| 639 ASSERT(class_ids_ != NULL); |
| 640 return (*class_ids_)[ix]; |
| 641 } |
| 626 | 642 |
| 627 virtual void PrintOperandsTo(BufferFormatter* f) const; | 643 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 628 | 644 |
| 629 private: | 645 private: |
| 630 const intptr_t token_index_; | 646 const intptr_t token_index_; |
| 631 const intptr_t try_index_; | 647 const intptr_t try_index_; |
| 632 intptr_t operands_class_id_; // class id of both operands. | 648 ZoneGrowableArray<intptr_t>* class_ids_; |
| 649 ZoneGrowableArray<Function*>* targets_; |
| 633 | 650 |
| 634 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); | 651 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); |
| 635 }; | 652 }; |
| 636 | 653 |
| 637 | 654 |
| 638 class RelationalOpComp : public ComparisonComp { | 655 class RelationalOpComp : public ComparisonComp { |
| 639 public: | 656 public: |
| 640 RelationalOpComp(intptr_t token_index, | 657 RelationalOpComp(intptr_t token_index, |
| 641 intptr_t try_index, | 658 intptr_t try_index, |
| 642 Token::Kind kind, | 659 Token::Kind kind, |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 const GrowableArray<BlockEntryInstr*>& block_order_; | 2387 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2371 | 2388 |
| 2372 private: | 2389 private: |
| 2373 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2390 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2374 }; | 2391 }; |
| 2375 | 2392 |
| 2376 | 2393 |
| 2377 } // namespace dart | 2394 } // namespace dart |
| 2378 | 2395 |
| 2379 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2396 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |