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 | |
560 intptr_t cid_start; | 564 intptr_t cid_start; |
561 intptr_t cid_end; | 565 intptr_t cid_end; |
kustermann
2017/05/18 09:59:45
Maybe consider removing the "cid_" prefixes, it's
erikcorry
2017/05/18 14:25:30
I took a look at this, and the word "CidRange" is
| |
562 }; | 566 }; |
563 | 567 |
564 | 568 |
565 // Together with CidRange, this represents a mapping from a range of class-ids | 569 // 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 | 570 // 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. | 571 // 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). | 572 // This information can be harvested from the inline caches (ICs). |
569 struct TargetInfo : public CidRange { | 573 struct TargetInfo : public CidRange { |
570 TargetInfo(intptr_t cid_start_arg, | 574 TargetInfo(intptr_t cid_start_arg, |
571 intptr_t cid_end_arg, | 575 intptr_t cid_end_arg, |
(...skipping 7149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7721 private: | 7725 private: |
7722 const TokenPosition token_pos_; | 7726 const TokenPosition token_pos_; |
7723 bool licm_hoisted_; | 7727 bool licm_hoisted_; |
7724 | 7728 |
7725 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 7729 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
7726 }; | 7730 }; |
7727 | 7731 |
7728 | 7732 |
7729 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { | 7733 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { |
7730 public: | 7734 public: |
7731 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) | 7735 CheckClassIdInstr(Value* value, CidRange cids, intptr_t deopt_id) |
7732 : TemplateInstruction(deopt_id), cid_(cid) { | 7736 : TemplateInstruction(deopt_id), cids_(cids) { |
7733 SetInputAt(0, value); | 7737 SetInputAt(0, value); |
7734 } | 7738 } |
7735 | 7739 |
7736 Value* value() const { return inputs_[0]; } | 7740 Value* value() const { return inputs_[0]; } |
7737 intptr_t cid() const { return cid_; } | 7741 const CidRange& cids() const { return cids_; } |
7738 | 7742 |
7739 DECLARE_INSTRUCTION(CheckClassId) | 7743 DECLARE_INSTRUCTION(CheckClassId) |
7740 | 7744 |
7741 virtual bool ComputeCanDeoptimize() const { return true; } | 7745 virtual bool ComputeCanDeoptimize() const { return true; } |
7742 | 7746 |
7743 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7747 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
7744 | 7748 |
7745 virtual bool AllowsCSE() const { return true; } | 7749 virtual bool AllowsCSE() const { return true; } |
7746 virtual EffectSet Dependencies() const; | 7750 virtual EffectSet Dependencies() const; |
7747 virtual EffectSet Effects() const { return EffectSet::None(); } | 7751 virtual EffectSet Effects() const { return EffectSet::None(); } |
7748 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7752 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7749 | 7753 |
7750 PRINT_OPERANDS_TO_SUPPORT | 7754 PRINT_OPERANDS_TO_SUPPORT |
7751 | 7755 |
7752 private: | 7756 private: |
7753 intptr_t cid_; | 7757 bool Contains(intptr_t cid) const; |
7758 | |
7759 CidRange cids_; | |
7754 | 7760 |
7755 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); | 7761 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); |
7756 }; | 7762 }; |
7757 | 7763 |
7758 | 7764 |
7759 class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { | 7765 class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { |
7760 public: | 7766 public: |
7761 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) | 7767 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) |
7762 : TemplateInstruction(deopt_id), | 7768 : TemplateInstruction(deopt_id), |
7763 generalized_(false), | 7769 generalized_(false), |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8170 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8176 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8171 UNIMPLEMENTED(); \ | 8177 UNIMPLEMENTED(); \ |
8172 return NULL; \ | 8178 return NULL; \ |
8173 } \ | 8179 } \ |
8174 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8180 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8175 | 8181 |
8176 | 8182 |
8177 } // namespace dart | 8183 } // namespace dart |
8178 | 8184 |
8179 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8185 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |