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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define RUNTIME_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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 #endif // !PRODUCT | 550 #endif // !PRODUCT |
551 | 551 |
552 | 552 |
553 // Represents a range of class-ids for use in class checks and polymorphic | 553 // Represents a range of class-ids for use in class checks and polymorphic |
554 // dispatches. | 554 // dispatches. |
555 struct CidRange : public ZoneAllocated { | 555 struct CidRange : public ZoneAllocated { |
556 CidRange(const CidRange& o) | 556 CidRange(const CidRange& o) |
557 : ZoneAllocated(), cid_start(o.cid_start), cid_end(o.cid_end) {} | 557 : ZoneAllocated(), cid_start(o.cid_start), cid_end(o.cid_end) {} |
558 CidRange(intptr_t cid_start_arg, intptr_t cid_end_arg) | 558 CidRange(intptr_t cid_start_arg, intptr_t cid_end_arg) |
559 : cid_start(cid_start_arg), cid_end(cid_end_arg) {} | 559 : cid_start(cid_start_arg), cid_end(cid_end_arg) {} |
| 560 |
| 561 bool IsSingleCid() const { return cid_start == cid_end; } |
| 562 bool Contains(intptr_t cid) { return cid_start <= cid && cid <= cid_end; } |
| 563 int32_t Extent() const { return cid_end - cid_start; } |
| 564 |
560 intptr_t cid_start; | 565 intptr_t cid_start; |
561 intptr_t cid_end; | 566 intptr_t cid_end; |
562 }; | 567 }; |
563 | 568 |
564 | 569 |
565 // Together with CidRange, this represents a mapping from a range of class-ids | 570 // Together with CidRange, this represents a mapping from a range of class-ids |
566 // to a method for a given selector (method name). Also can contain an | 571 // to a method for a given selector (method name). Also can contain an |
567 // indication of how frequently a given method has been called at a call site. | 572 // indication of how frequently a given method has been called at a call site. |
568 // This information can be harvested from the inline caches (ICs). | 573 // This information can be harvested from the inline caches (ICs). |
569 struct TargetInfo : public CidRange { | 574 struct TargetInfo : public CidRange { |
(...skipping 7151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7721 private: | 7726 private: |
7722 const TokenPosition token_pos_; | 7727 const TokenPosition token_pos_; |
7723 bool licm_hoisted_; | 7728 bool licm_hoisted_; |
7724 | 7729 |
7725 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 7730 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
7726 }; | 7731 }; |
7727 | 7732 |
7728 | 7733 |
7729 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { | 7734 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { |
7730 public: | 7735 public: |
7731 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) | 7736 CheckClassIdInstr(Value* value, CidRange cids, intptr_t deopt_id) |
7732 : TemplateInstruction(deopt_id), cid_(cid) { | 7737 : TemplateInstruction(deopt_id), cids_(cids) { |
7733 SetInputAt(0, value); | 7738 SetInputAt(0, value); |
7734 } | 7739 } |
7735 | 7740 |
7736 Value* value() const { return inputs_[0]; } | 7741 Value* value() const { return inputs_[0]; } |
7737 intptr_t cid() const { return cid_; } | 7742 const CidRange& cids() const { return cids_; } |
7738 | 7743 |
7739 DECLARE_INSTRUCTION(CheckClassId) | 7744 DECLARE_INSTRUCTION(CheckClassId) |
7740 | 7745 |
7741 virtual bool ComputeCanDeoptimize() const { return true; } | 7746 virtual bool ComputeCanDeoptimize() const { return true; } |
7742 | 7747 |
7743 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7748 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
7744 | 7749 |
7745 virtual bool AllowsCSE() const { return true; } | 7750 virtual bool AllowsCSE() const { return true; } |
7746 virtual EffectSet Dependencies() const; | 7751 virtual EffectSet Dependencies() const; |
7747 virtual EffectSet Effects() const { return EffectSet::None(); } | 7752 virtual EffectSet Effects() const { return EffectSet::None(); } |
7748 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7753 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7749 | 7754 |
7750 PRINT_OPERANDS_TO_SUPPORT | 7755 PRINT_OPERANDS_TO_SUPPORT |
7751 | 7756 |
7752 private: | 7757 private: |
7753 intptr_t cid_; | 7758 bool Contains(intptr_t cid) const; |
| 7759 |
| 7760 CidRange cids_; |
7754 | 7761 |
7755 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); | 7762 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); |
7756 }; | 7763 }; |
7757 | 7764 |
7758 | 7765 |
7759 class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { | 7766 class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { |
7760 public: | 7767 public: |
7761 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) | 7768 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) |
7762 : TemplateInstruction(deopt_id), | 7769 : TemplateInstruction(deopt_id), |
7763 generalized_(false), | 7770 generalized_(false), |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8170 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8177 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8171 UNIMPLEMENTED(); \ | 8178 UNIMPLEMENTED(); \ |
8172 return NULL; \ | 8179 return NULL; \ |
8173 } \ | 8180 } \ |
8174 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8181 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8175 | 8182 |
8176 | 8183 |
8177 } // namespace dart | 8184 } // namespace dart |
8178 | 8185 |
8179 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8186 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |