Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 2737303003: Allow dispatch to use a range of Class-ids in tests (Closed)
Patch Set: Feedback from Slava Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 const ICData& ic_data, 2770 const ICData& ic_data,
2771 bool with_checks, 2771 bool with_checks,
2772 bool complete) 2772 bool complete)
2773 : TemplateDefinition(instance_call->deopt_id()), 2773 : TemplateDefinition(instance_call->deopt_id()),
2774 instance_call_(instance_call), 2774 instance_call_(instance_call),
2775 ic_data_(ic_data), 2775 ic_data_(ic_data),
2776 with_checks_(with_checks), 2776 with_checks_(with_checks),
2777 complete_(complete) { 2777 complete_(complete) {
2778 ASSERT(instance_call_ != NULL); 2778 ASSERT(instance_call_ != NULL);
2779 ASSERT(!ic_data.NumberOfChecksIs(0)); 2779 ASSERT(!ic_data.NumberOfChecksIs(0));
2780 total_call_count_ = CallCount();
2780 } 2781 }
2781 2782
2782 InstanceCallInstr* instance_call() const { return instance_call_; } 2783 InstanceCallInstr* instance_call() const { return instance_call_; }
2783 bool with_checks() const { return with_checks_; } 2784 bool with_checks() const { return with_checks_; }
2784 void set_with_checks(bool b) { with_checks_ = b; } 2785 void set_with_checks(bool b) { with_checks_ = b; }
2785 bool complete() const { return complete_; } 2786 bool complete() const { return complete_; }
2786 virtual TokenPosition token_pos() const { 2787 virtual TokenPosition token_pos() const {
2787 return instance_call_->token_pos(); 2788 return instance_call_->token_pos();
2788 } 2789 }
2789 2790
2790 virtual CompileType ComputeType() const; 2791 virtual CompileType ComputeType() const;
2791 2792
2792 virtual intptr_t ArgumentCount() const { 2793 virtual intptr_t ArgumentCount() const {
2793 return instance_call()->ArgumentCount(); 2794 return instance_call()->ArgumentCount();
2794 } 2795 }
2795 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 2796 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
2796 return instance_call()->PushArgumentAt(index); 2797 return instance_call()->PushArgumentAt(index);
2797 } 2798 }
2798 2799
2799 bool HasSingleRecognizedTarget() const; 2800 bool HasSingleRecognizedTarget() const;
2800 2801
2801 virtual intptr_t CallCount() const { return ic_data().AggregateCount(); } 2802 virtual intptr_t CallCount() const { return ic_data().AggregateCount(); }
2802 2803
2804 // If this polymophic call site was created to cover the remaining cids after
2805 // inlinng then we need to keep track of the total number of calls including
2806 // the ones that wer inlined. This is different from the CallCount above: Eg
2807 // if there were 100 calls originally, distributed across three class-ids in
2808 // the ratio 50, 40, 7, 3. The first two were inlined, so now we have only
2809 // 10 calls in the CallCount above, but the heuristics need to know that the
2810 // last two cids cover 7% and 3% of the calls, not 70% and 30%.
2811 intptr_t total_call_count() { return total_call_count_; }
2812
2813 void set_total_call_count(intptr_t count) { total_call_count_ = count; }
2814
2803 DECLARE_INSTRUCTION(PolymorphicInstanceCall) 2815 DECLARE_INSTRUCTION(PolymorphicInstanceCall)
2804 2816
2805 const ICData& ic_data() const { return ic_data_; } 2817 const ICData& ic_data() const { return ic_data_; }
2806 2818
2807 virtual bool CanDeoptimize() const { return true; } 2819 virtual bool CanDeoptimize() const { return true; }
2808 2820
2809 virtual EffectSet Effects() const { return EffectSet::All(); } 2821 virtual EffectSet Effects() const { return EffectSet::All(); }
2810 2822
2811 virtual Definition* Canonicalize(FlowGraph* graph); 2823 virtual Definition* Canonicalize(FlowGraph* graph);
2812 2824
2813 static RawType* ComputeRuntimeType(const ICData& ic_data); 2825 static RawType* ComputeRuntimeType(const ICData& ic_data);
2814 2826
2815 PRINT_OPERANDS_TO_SUPPORT 2827 PRINT_OPERANDS_TO_SUPPORT
2816 2828
2817 private: 2829 private:
2818 InstanceCallInstr* instance_call_; 2830 InstanceCallInstr* instance_call_;
2819 const ICData& ic_data_; 2831 const ICData& ic_data_;
2820 bool with_checks_; 2832 bool with_checks_;
2821 const bool complete_; 2833 const bool complete_;
2834 intptr_t total_call_count_;
2822 2835
2823 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 2836 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
2824 }; 2837 };
2825 2838
2826 2839
2827 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { 2840 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
2828 public: 2841 public:
2829 StrictCompareInstr(TokenPosition token_pos, 2842 StrictCompareInstr(TokenPosition token_pos,
2830 Token::Kind kind, 2843 Token::Kind kind,
2831 Value* left, 2844 Value* left,
(...skipping 5194 matching lines...) Expand 10 before | Expand all | Expand 10 after
8026 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8039 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8027 UNIMPLEMENTED(); \ 8040 UNIMPLEMENTED(); \
8028 return NULL; \ 8041 return NULL; \
8029 } \ 8042 } \
8030 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8043 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8031 8044
8032 8045
8033 } // namespace dart 8046 } // namespace dart
8034 8047
8035 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8048 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698