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

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

Issue 472303002: Revert "Switch to a fix-point based range analysis to improve its precision." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_range_analysis_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)". 1943 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)".
1944 virtual void PrintTo(BufferFormatter* f) const; 1944 virtual void PrintTo(BufferFormatter* f) const;
1945 virtual void PrintOperandsTo(BufferFormatter* f) const; 1945 virtual void PrintOperandsTo(BufferFormatter* f) const;
1946 1946
1947 // A value in the constant propagation lattice. 1947 // A value in the constant propagation lattice.
1948 // - non-constant sentinel 1948 // - non-constant sentinel
1949 // - a constant (any non-sentinel value) 1949 // - a constant (any non-sentinel value)
1950 // - unknown sentinel 1950 // - unknown sentinel
1951 Object& constant_value() const { return constant_value_; } 1951 Object& constant_value() const { return constant_value_; }
1952 1952
1953 virtual void InferRange(Range* range); 1953 virtual void InferRange();
1954 1954
1955 Range* range() const { return range_; } 1955 Range* range() const { return range_; }
1956 void set_range(const Range&);
1957 1956
1958 // Definitions can be canonicalized only into definitions to ensure 1957 // Definitions can be canonicalized only into definitions to ensure
1959 // this check statically we override base Canonicalize with a Canonicalize 1958 // this check statically we override base Canonicalize with a Canonicalize
1960 // returning Definition (return type is covariant). 1959 // returning Definition (return type is covariant).
1961 virtual Definition* Canonicalize(FlowGraph* flow_graph); 1960 virtual Definition* Canonicalize(FlowGraph* flow_graph);
1962 1961
1963 static const intptr_t kReplacementMarker = -2; 1962 static const intptr_t kReplacementMarker = -2;
1964 1963
1965 Definition* Replacement() { 1964 Definition* Replacement() {
1966 if (ssa_temp_index_ == kReplacementMarker) { 1965 if (ssa_temp_index_ == kReplacementMarker) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 2096
2098 virtual intptr_t Hashcode() const { 2097 virtual intptr_t Hashcode() const {
2099 UNREACHABLE(); 2098 UNREACHABLE();
2100 return 0; 2099 return 0;
2101 } 2100 }
2102 2101
2103 DECLARE_INSTRUCTION(Phi) 2102 DECLARE_INSTRUCTION(Phi)
2104 2103
2105 virtual void PrintTo(BufferFormatter* f) const; 2104 virtual void PrintTo(BufferFormatter* f) const;
2106 2105
2107 virtual void InferRange(Range* range); 2106 virtual void InferRange();
2108 2107
2109 BitVector* reaching_defs() const { 2108 BitVector* reaching_defs() const {
2110 return reaching_defs_; 2109 return reaching_defs_;
2111 } 2110 }
2112 2111
2113 void set_reaching_defs(BitVector* reaching_defs) { 2112 void set_reaching_defs(BitVector* reaching_defs) {
2114 reaching_defs_ = reaching_defs; 2113 reaching_defs_ = reaching_defs;
2115 } 2114 }
2116 2115
2117 virtual bool MayThrow() const { return false; } 2116 virtual bool MayThrow() const { return false; }
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 return false; 2593 return false;
2595 } 2594 }
2596 2595
2597 virtual bool MayThrow() const { return false; } 2596 virtual bool MayThrow() const { return false; }
2598 2597
2599 virtual void PrintOperandsTo(BufferFormatter* f) const; 2598 virtual void PrintOperandsTo(BufferFormatter* f) const;
2600 2599
2601 Value* value() const { return inputs_[0]; } 2600 Value* value() const { return inputs_[0]; }
2602 Range* constraint() const { return constraint_; } 2601 Range* constraint() const { return constraint_; }
2603 2602
2604 virtual void InferRange(Range* range); 2603 virtual void InferRange();
2605 2604
2606 void AddDependency(Definition* defn) { 2605 void AddDependency(Definition* defn) {
2607 Value* val = new Value(defn); 2606 Value* val = new Value(defn);
2608 defn->AddInputUse(val); 2607 defn->AddInputUse(val);
2609 SetInputAt(1, val); 2608 SetInputAt(1, val);
2610 } 2609 }
2611 2610
2612 // Constraints for branches have their target block stored in order 2611 // Constraints for branches have their target block stored in order
2613 // to find the the comparsion that generated the constraint: 2612 // to find the the comparsion that generated the constraint:
2614 // target->predecessor->last_instruction->comparison. 2613 // target->predecessor->last_instruction->comparison.
(...skipping 24 matching lines...) Expand all
2639 virtual CompileType ComputeType() const; 2638 virtual CompileType ComputeType() const;
2640 2639
2641 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2640 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2642 2641
2643 const Object& value() const { return value_; } 2642 const Object& value() const { return value_; }
2644 2643
2645 virtual void PrintOperandsTo(BufferFormatter* f) const; 2644 virtual void PrintOperandsTo(BufferFormatter* f) const;
2646 2645
2647 virtual bool CanDeoptimize() const { return false; } 2646 virtual bool CanDeoptimize() const { return false; }
2648 2647
2649 virtual void InferRange(Range* range); 2648 virtual void InferRange();
2650 2649
2651 virtual bool AllowsCSE() const { return true; } 2650 virtual bool AllowsCSE() const { return true; }
2652 virtual EffectSet Effects() const { return EffectSet::None(); } 2651 virtual EffectSet Effects() const { return EffectSet::None(); }
2653 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2652 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2654 virtual bool AttributesEqual(Instruction* other) const; 2653 virtual bool AttributesEqual(Instruction* other) const;
2655 2654
2656 virtual bool MayThrow() const { return false; } 2655 virtual bool MayThrow() const { return false; }
2657 2656
2658 private: 2657 private:
2659 const Object& value_; 2658 const Object& value_;
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
3276 } 3275 }
3277 3276
3278 virtual Representation RequiredInputRepresentation(intptr_t i) const { 3277 virtual Representation RequiredInputRepresentation(intptr_t i) const {
3279 return comparison()->RequiredInputRepresentation(i); 3278 return comparison()->RequiredInputRepresentation(i);
3280 } 3279 }
3281 3280
3282 virtual void PrintOperandsTo(BufferFormatter* f) const; 3281 virtual void PrintOperandsTo(BufferFormatter* f) const;
3283 3282
3284 virtual CompileType ComputeType() const; 3283 virtual CompileType ComputeType() const;
3285 3284
3286 virtual void InferRange(Range* range); 3285 virtual void InferRange();
3287 3286
3288 ComparisonInstr* comparison() const { return comparison_; } 3287 ComparisonInstr* comparison() const { return comparison_; }
3289 intptr_t if_true() const { return if_true_; } 3288 intptr_t if_true() const { return if_true_; }
3290 intptr_t if_false() const { return if_false_; } 3289 intptr_t if_false() const { return if_false_; }
3291 3290
3292 virtual bool AllowsCSE() const { return comparison()->AllowsCSE(); } 3291 virtual bool AllowsCSE() const { return comparison()->AllowsCSE(); }
3293 virtual EffectSet Effects() const { return comparison()->Effects(); } 3292 virtual EffectSet Effects() const { return comparison()->Effects(); }
3294 virtual EffectSet Dependencies() const { 3293 virtual EffectSet Dependencies() const {
3295 return comparison()->Dependencies(); 3294 return comparison()->Dependencies();
3296 } 3295 }
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
3910 3909
3911 virtual bool CanDeoptimize() const { 3910 virtual bool CanDeoptimize() const {
3912 return deopt_id_ != Isolate::kNoDeoptId; 3911 return deopt_id_ != Isolate::kNoDeoptId;
3913 } 3912 }
3914 3913
3915 bool Typed32BitIsSmi() const { 3914 bool Typed32BitIsSmi() const {
3916 return kSmiBits >= 32; 3915 return kSmiBits >= 32;
3917 } 3916 }
3918 3917
3919 virtual Representation representation() const; 3918 virtual Representation representation() const;
3920 virtual void InferRange(Range* range); 3919 virtual void InferRange();
3921 3920
3922 virtual bool AllowsCSE() const { return false; } 3921 virtual bool AllowsCSE() const { return false; }
3923 virtual EffectSet Effects() const { return EffectSet::None(); } 3922 virtual EffectSet Effects() const { return EffectSet::None(); }
3924 virtual EffectSet Dependencies() const; 3923 virtual EffectSet Dependencies() const;
3925 virtual bool AttributesEqual(Instruction* other) const; 3924 virtual bool AttributesEqual(Instruction* other) const;
3926 3925
3927 virtual bool MayThrow() const { return false; } 3926 virtual bool MayThrow() const { return false; }
3928 3927
3929 private: 3928 private:
3930 const intptr_t index_scale_; 3929 const intptr_t index_scale_;
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
4479 return recognized_kind_; 4478 return recognized_kind_;
4480 } 4479 }
4481 4480
4482 DECLARE_INSTRUCTION(LoadField) 4481 DECLARE_INSTRUCTION(LoadField)
4483 virtual CompileType ComputeType() const; 4482 virtual CompileType ComputeType() const;
4484 4483
4485 virtual void PrintOperandsTo(BufferFormatter* f) const; 4484 virtual void PrintOperandsTo(BufferFormatter* f) const;
4486 4485
4487 virtual bool CanDeoptimize() const { return false; } 4486 virtual bool CanDeoptimize() const { return false; }
4488 4487
4489 virtual void InferRange(Range* range); 4488 virtual void InferRange();
4490 4489
4491 bool IsImmutableLengthLoad() const; 4490 bool IsImmutableLengthLoad() const;
4492 4491
4493 virtual Definition* Canonicalize(FlowGraph* flow_graph); 4492 virtual Definition* Canonicalize(FlowGraph* flow_graph);
4494 4493
4495 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid); 4494 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid);
4496 4495
4497 static bool IsFixedLengthArrayCid(intptr_t cid); 4496 static bool IsFixedLengthArrayCid(intptr_t cid);
4498 4497
4499 virtual bool AllowsCSE() const { return immutable_; } 4498 virtual bool AllowsCSE() const { return immutable_; }
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
4878 4877
4879 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4878 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4880 ASSERT(idx == 0); 4879 ASSERT(idx == 0);
4881 return kUnboxedMint; 4880 return kUnboxedMint;
4882 } 4881 }
4883 4882
4884 DECLARE_INSTRUCTION(BoxInteger) 4883 DECLARE_INSTRUCTION(BoxInteger)
4885 virtual CompileType ComputeType() const; 4884 virtual CompileType ComputeType() const;
4886 virtual bool RecomputeType(); 4885 virtual bool RecomputeType();
4887 4886
4888 virtual void InferRange(Range* range); 4887 virtual void InferRange();
4889 4888
4890 virtual bool AllowsCSE() const { return true; } 4889 virtual bool AllowsCSE() const { return true; }
4891 virtual EffectSet Effects() const { return EffectSet::None(); } 4890 virtual EffectSet Effects() const { return EffectSet::None(); }
4892 virtual EffectSet Dependencies() const { return EffectSet::None(); } 4891 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4893 virtual bool AttributesEqual(Instruction* other) const { return true; } 4892 virtual bool AttributesEqual(Instruction* other) const { return true; }
4894 4893
4895 virtual bool MayThrow() const { return false; } 4894 virtual bool MayThrow() const { return false; }
4896 4895
4897 private: 4896 private:
4898 bool is_smi_; 4897 bool is_smi_;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
5051 return (value()->Type()->ToCid() != kSmiCid) 5050 return (value()->Type()->ToCid() != kSmiCid)
5052 && (value()->Type()->ToCid() != kMintCid); 5051 && (value()->Type()->ToCid() != kMintCid);
5053 } 5052 }
5054 5053
5055 virtual Representation representation() const { 5054 virtual Representation representation() const {
5056 return kUnboxedMint; 5055 return kUnboxedMint;
5057 } 5056 }
5058 5057
5059 intptr_t deopt_id() const { return deopt_id_; } 5058 intptr_t deopt_id() const { return deopt_id_; }
5060 5059
5061 virtual void InferRange(Range* range); 5060 virtual void InferRange();
5062 5061
5063 DECLARE_INSTRUCTION(UnboxInteger) 5062 DECLARE_INSTRUCTION(UnboxInteger)
5064 virtual CompileType ComputeType() const; 5063 virtual CompileType ComputeType() const;
5065 5064
5066 virtual bool AllowsCSE() const { return true; } 5065 virtual bool AllowsCSE() const { return true; }
5067 virtual EffectSet Effects() const { return EffectSet::None(); } 5066 virtual EffectSet Effects() const { return EffectSet::None(); }
5068 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5067 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5069 virtual bool AttributesEqual(Instruction* other) const { return true; } 5068 virtual bool AttributesEqual(Instruction* other) const { return true; }
5070 5069
5071 virtual bool MayThrow() const { return false; } 5070 virtual bool MayThrow() const { return false; }
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
6897 ASSERT((idx == 0) || (idx == 1)); 6896 ASSERT((idx == 0) || (idx == 1));
6898 return kUnboxedMint; 6897 return kUnboxedMint;
6899 } 6898 }
6900 6899
6901 virtual intptr_t DeoptimizationTarget() const { 6900 virtual intptr_t DeoptimizationTarget() const {
6902 // Direct access since this instruction cannot deoptimize, and the deopt-id 6901 // Direct access since this instruction cannot deoptimize, and the deopt-id
6903 // was inherited from another instruction that could deoptimize. 6902 // was inherited from another instruction that could deoptimize.
6904 return deopt_id_; 6903 return deopt_id_;
6905 } 6904 }
6906 6905
6907 virtual void InferRange(Range* range); 6906 virtual void InferRange();
6908 6907
6909 virtual Definition* Canonicalize(FlowGraph* flow_graph); 6908 virtual Definition* Canonicalize(FlowGraph* flow_graph);
6910 6909
6911 DECLARE_INSTRUCTION(BinaryMintOp) 6910 DECLARE_INSTRUCTION(BinaryMintOp)
6912 virtual CompileType ComputeType() const; 6911 virtual CompileType ComputeType() const;
6913 6912
6914 virtual bool AllowsCSE() const { return true; } 6913 virtual bool AllowsCSE() const { return true; }
6915 virtual EffectSet Effects() const { return EffectSet::None(); } 6914 virtual EffectSet Effects() const { return EffectSet::None(); }
6916 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6915 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6917 virtual bool AttributesEqual(Instruction* other) const { 6916 virtual bool AttributesEqual(Instruction* other) const {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
6971 ASSERT((idx == 0) || (idx == 1)); 6970 ASSERT((idx == 0) || (idx == 1));
6972 return (idx == 0) ? kUnboxedMint : kTagged; 6971 return (idx == 0) ? kUnboxedMint : kTagged;
6973 } 6972 }
6974 6973
6975 virtual intptr_t DeoptimizationTarget() const { 6974 virtual intptr_t DeoptimizationTarget() const {
6976 // Direct access since this instruction cannot deoptimize, and the deopt-id 6975 // Direct access since this instruction cannot deoptimize, and the deopt-id
6977 // was inherited from another instruction that could deoptimize. 6976 // was inherited from another instruction that could deoptimize.
6978 return deopt_id_; 6977 return deopt_id_;
6979 } 6978 }
6980 6979
6981 virtual void InferRange(Range* range); 6980 virtual void InferRange();
6982 6981
6983 DECLARE_INSTRUCTION(ShiftMintOp) 6982 DECLARE_INSTRUCTION(ShiftMintOp)
6984 6983
6985 virtual bool AllowsCSE() const { return true; } 6984 virtual bool AllowsCSE() const { return true; }
6986 virtual EffectSet Effects() const { return EffectSet::None(); } 6985 virtual EffectSet Effects() const { return EffectSet::None(); }
6987 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6986 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6988 virtual bool AttributesEqual(Instruction* other) const { 6987 virtual bool AttributesEqual(Instruction* other) const {
6989 return op_kind() == other->AsShiftMintOp()->op_kind(); 6988 return op_kind() == other->AsShiftMintOp()->op_kind();
6990 } 6989 }
6991 6990
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
7088 7087
7089 virtual bool CanDeoptimize() const; 7088 virtual bool CanDeoptimize() const;
7090 7089
7091 virtual bool AllowsCSE() const { return true; } 7090 virtual bool AllowsCSE() const { return true; }
7092 virtual EffectSet Effects() const { return EffectSet::None(); } 7091 virtual EffectSet Effects() const { return EffectSet::None(); }
7093 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7092 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7094 virtual bool AttributesEqual(Instruction* other) const; 7093 virtual bool AttributesEqual(Instruction* other) const;
7095 7094
7096 void PrintTo(BufferFormatter* f) const; 7095 void PrintTo(BufferFormatter* f) const;
7097 7096
7098 virtual void InferRange(Range* range); 7097 virtual void InferRange();
7099 7098
7100 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7099 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7101 7100
7102 // Returns true if right is a non-zero Smi constant which absolute value is 7101 // Returns true if right is a non-zero Smi constant which absolute value is
7103 // a power of two. 7102 // a power of two.
7104 bool RightIsPowerOfTwoConstant() const; 7103 bool RightIsPowerOfTwoConstant() const;
7105 7104
7106 virtual bool MayThrow() const { return false; } 7105 virtual bool MayThrow() const { return false; }
7107 7106
7108 private: 7107 private:
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
8368 ForwardInstructionIterator* current_iterator_; 8367 ForwardInstructionIterator* current_iterator_;
8369 8368
8370 private: 8369 private:
8371 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 8370 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
8372 }; 8371 };
8373 8372
8374 8373
8375 } // namespace dart 8374 } // namespace dart
8376 8375
8377 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8376 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_range_analysis_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698