| 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 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 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2684 const RangeBoundary& overflow); | 2684 const RangeBoundary& overflow); |
| 2685 | 2685 |
| 2686 static RangeBoundary Sub(const RangeBoundary& a, | 2686 static RangeBoundary Sub(const RangeBoundary& a, |
| 2687 const RangeBoundary& b, | 2687 const RangeBoundary& b, |
| 2688 const RangeBoundary& overflow); | 2688 const RangeBoundary& overflow); |
| 2689 | 2689 |
| 2690 static RangeBoundary Shl(const RangeBoundary& value_boundary, | 2690 static RangeBoundary Shl(const RangeBoundary& value_boundary, |
| 2691 int64_t shift_count, | 2691 int64_t shift_count, |
| 2692 const RangeBoundary& overflow); | 2692 const RangeBoundary& overflow); |
| 2693 | 2693 |
| 2694 static RangeBoundary Shr(const RangeBoundary& value_boundary, |
| 2695 intptr_t shift_count) { |
| 2696 ASSERT(value_boundary.IsConstant()); |
| 2697 ASSERT(shift_count >= 0); |
| 2698 int64_t value = static_cast<int64_t>(value_boundary.ConstantValue()); |
| 2699 int64_t result = value >> shift_count; |
| 2700 return RangeBoundary(result); |
| 2701 } |
| 2702 |
| 2694 // Attempts to calculate a + b when: | 2703 // Attempts to calculate a + b when: |
| 2695 // a is a symbol and b is a constant OR | 2704 // a is a symbol and b is a constant OR |
| 2696 // a is a constant and b is a symbol | 2705 // a is a constant and b is a symbol |
| 2697 // returns true if it succeeds, output is in result. | 2706 // returns true if it succeeds, output is in result. |
| 2698 static bool SymbolicAdd(const RangeBoundary& a, | 2707 static bool SymbolicAdd(const RangeBoundary& a, |
| 2699 const RangeBoundary& b, | 2708 const RangeBoundary& b, |
| 2700 RangeBoundary* result); | 2709 RangeBoundary* result); |
| 2701 | 2710 |
| 2702 // Attempts to calculate a - b when: | 2711 // Attempts to calculate a - b when: |
| 2703 // a is a symbol and b is a constant | 2712 // a is a symbol and b is a constant |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2799 static void Sub(const Range* left_range, | 2808 static void Sub(const Range* left_range, |
| 2800 const Range* right_range, | 2809 const Range* right_range, |
| 2801 RangeBoundary* min, | 2810 RangeBoundary* min, |
| 2802 RangeBoundary* max, | 2811 RangeBoundary* max, |
| 2803 Definition* left_defn); | 2812 Definition* left_defn); |
| 2804 | 2813 |
| 2805 static bool Mul(const Range* left_range, | 2814 static bool Mul(const Range* left_range, |
| 2806 const Range* right_range, | 2815 const Range* right_range, |
| 2807 RangeBoundary* min, | 2816 RangeBoundary* min, |
| 2808 RangeBoundary* max); | 2817 RangeBoundary* max); |
| 2818 static void Shr(const Range* left_range, |
| 2819 const Range* right_range, |
| 2820 RangeBoundary* min, |
| 2821 RangeBoundary* max); |
| 2809 | 2822 |
| 2810 static void Shl(const Range* left_range, | 2823 static void Shl(const Range* left_range, |
| 2811 const Range* right_range, | 2824 const Range* right_range, |
| 2812 RangeBoundary* min, | 2825 RangeBoundary* min, |
| 2813 RangeBoundary* max); | 2826 RangeBoundary* max); |
| 2814 | 2827 |
| 2815 static bool And(const Range* left_range, | 2828 static bool And(const Range* left_range, |
| 2816 const Range* right_range, | 2829 const Range* right_range, |
| 2817 RangeBoundary* min, | 2830 RangeBoundary* min, |
| 2818 RangeBoundary* max); | 2831 RangeBoundary* max); |
| (...skipping 4398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7217 | 7230 |
| 7218 Value* left() const { return inputs_[0]; } | 7231 Value* left() const { return inputs_[0]; } |
| 7219 Value* right() const { return inputs_[1]; } | 7232 Value* right() const { return inputs_[1]; } |
| 7220 | 7233 |
| 7221 virtual intptr_t token_pos() const { return token_pos_; } | 7234 virtual intptr_t token_pos() const { return token_pos_; } |
| 7222 Token::Kind op_kind() const { return op_kind_; } | 7235 Token::Kind op_kind() const { return op_kind_; } |
| 7223 | 7236 |
| 7224 void set_overflow(bool overflow) { overflow_ = overflow; } | 7237 void set_overflow(bool overflow) { overflow_ = overflow; } |
| 7225 | 7238 |
| 7226 void set_is_truncating(bool value) { is_truncating_ = value; } | 7239 void set_is_truncating(bool value) { is_truncating_ = value; } |
| 7227 bool is_truncating() const { return is_truncating_; } | 7240 bool IsTruncating() const { return is_truncating_ || !overflow_; } |
| 7228 | 7241 |
| 7229 virtual void PrintOperandsTo(BufferFormatter* f) const; | 7242 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 7230 | 7243 |
| 7231 DECLARE_INSTRUCTION(BinarySmiOp) | 7244 DECLARE_INSTRUCTION(BinarySmiOp) |
| 7232 virtual CompileType ComputeType() const; | 7245 virtual CompileType ComputeType() const; |
| 7233 | 7246 |
| 7234 virtual bool CanDeoptimize() const; | 7247 virtual bool CanDeoptimize() const; |
| 7235 | 7248 |
| 7236 virtual bool AllowsCSE() const { return true; } | 7249 virtual bool AllowsCSE() const { return true; } |
| 7237 virtual EffectSet Effects() const { return EffectSet::None(); } | 7250 virtual EffectSet Effects() const { return EffectSet::None(); } |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8180 ForwardInstructionIterator* current_iterator_; | 8193 ForwardInstructionIterator* current_iterator_; |
| 8181 | 8194 |
| 8182 private: | 8195 private: |
| 8183 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 8196 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 8184 }; | 8197 }; |
| 8185 | 8198 |
| 8186 | 8199 |
| 8187 } // namespace dart | 8200 } // namespace dart |
| 8188 | 8201 |
| 8189 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8202 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |