Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 #include "src/compiler/graph-inl.h" | 6 #include "src/compiler/graph-inl.h" |
| 7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
| 8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
| 9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 | 154 |
| 155 Type* number = Type::Number(); | 155 Type* number = Type::Number(); |
| 156 Type* signed32 = Type::Signed32(); | 156 Type* signed32 = Type::Signed32(); |
| 157 Type* unsigned32 = Type::Unsigned32(); | 157 Type* unsigned32 = Type::Unsigned32(); |
| 158 Type* nan_or_minuszero = Type::Union(Type::NaN(), Type::MinusZero(), zone); | 158 Type* nan_or_minuszero = Type::Union(Type::NaN(), Type::MinusZero(), zone); |
| 159 Type* truncating_to_zero = | 159 Type* truncating_to_zero = |
| 160 Type::Union(Type::Union(Type::Constant(infinity, zone), | 160 Type::Union(Type::Union(Type::Constant(infinity, zone), |
| 161 Type::Constant(minusinfinity, zone), zone), | 161 Type::Constant(minusinfinity, zone), zone), |
| 162 nan_or_minuszero, zone); | 162 nan_or_minuszero, zone); |
| 163 | 163 |
| 164 negative_signed32 = Type::Union( | |
| 165 Type::SignedSmall(), Type::OtherSigned32(), zone); | |
| 166 non_negative_signed32 = Type::Union( | |
| 167 Type::UnsignedSmall(), Type::OtherUnsigned31(), zone); | |
| 168 undefined_or_null = Type::Union(Type::Undefined(), Type::Null(), zone); | 164 undefined_or_null = Type::Union(Type::Undefined(), Type::Null(), zone); |
| 169 singleton_false = Type::Constant(f->false_value(), zone); | 165 singleton_false = Type::Constant(f->false_value(), zone); |
| 170 singleton_true = Type::Constant(f->true_value(), zone); | 166 singleton_true = Type::Constant(f->true_value(), zone); |
| 171 singleton_zero = Type::Range(zero, zero, zone); | 167 singleton_zero = Type::Range(zero, zero, zone); |
| 172 singleton_one = Type::Range(one, one, zone); | 168 singleton_one = Type::Range(one, one, zone); |
| 173 zero_or_one = Type::Union(singleton_zero, singleton_one, zone); | 169 zero_or_one = Type::Union(singleton_zero, singleton_one, zone); |
| 174 zeroish = Type::Union(singleton_zero, nan_or_minuszero, zone); | 170 zeroish = Type::Union(singleton_zero, nan_or_minuszero, zone); |
| 175 signed32ish = Type::Union(signed32, truncating_to_zero, zone); | 171 signed32ish = Type::Union(signed32, truncating_to_zero, zone); |
| 176 unsigned32ish = Type::Union(unsigned32, truncating_to_zero, zone); | 172 unsigned32ish = Type::Union(unsigned32, truncating_to_zero, zone); |
| 177 falsish = Type::Union(Type::Undetectable(), | 173 falsish = Type::Union(Type::Undetectable(), |
| 178 Type::Union(zeroish, undefined_or_null, zone), zone); | 174 Type::Union(zeroish, undefined_or_null, zone), zone); |
| 179 integer = Type::Range(minusinfinity, infinity, zone); | 175 integer = Type::Range(minusinfinity, infinity, zone); |
| 180 weakint = Type::Union(integer, nan_or_minuszero, zone); | 176 weakint = Type::Union(integer, nan_or_minuszero, zone); |
| 181 | 177 |
| 182 signed8_ = Type::Range(f->NewNumber(kMinInt8), f->NewNumber(kMaxInt8), zone); | 178 signed8_ = Type::Range(f->NewNumber(kMinInt8), f->NewNumber(kMaxInt8), zone); |
| 183 unsigned8_ = Type::Range(zero, f->NewNumber(kMaxUInt8), zone); | 179 unsigned8_ = Type::Range(zero, f->NewNumber(kMaxUInt8), zone); |
| 184 signed16_ = | 180 signed16_ = |
| 185 Type::Range(f->NewNumber(kMinInt16), f->NewNumber(kMaxInt16), zone); | 181 Type::Range(f->NewNumber(kMinInt16), f->NewNumber(kMaxInt16), zone); |
| 186 unsigned16_ = Type::Range(zero, f->NewNumber(kMaxUInt16), zone); | 182 unsigned16_ = Type::Range(zero, f->NewNumber(kMaxUInt16), zone); |
| 187 | 183 |
| 188 number_fun0_ = Type::Function(number, zone); | 184 number_fun0_ = Type::Function(number, zone); |
| 189 number_fun1_ = Type::Function(number, number, zone); | 185 number_fun1_ = Type::Function(number, number, zone); |
| 190 number_fun2_ = Type::Function(number, number, number, zone); | 186 number_fun2_ = Type::Function(number, number, number, zone); |
| 191 | 187 |
| 192 weakint_fun1_ = Type::Function(weakint, number, zone); | 188 weakint_fun1_ = Type::Function(weakint, number, zone); |
| 193 random_fun_ = Type::Function(Type::Union( | 189 random_fun_ = Type::Function(Type::OrderedNumber(), zone); |
|
Jarin
2014/12/02 20:46:19
I am not sure about the right type here.
| |
| 194 Type::UnsignedSmall(), Type::OtherNumber(), zone), zone); | |
| 195 | 190 |
| 196 const int limits_count = 20; | 191 const int limits_count = 20; |
| 197 | 192 |
| 198 weaken_min_limits_.reserve(limits_count + 1); | 193 weaken_min_limits_.reserve(limits_count + 1); |
| 199 weaken_max_limits_.reserve(limits_count + 1); | 194 weaken_max_limits_.reserve(limits_count + 1); |
| 200 | 195 |
| 201 double limit = 1 << 30; | 196 double limit = 1 << 30; |
| 202 weaken_min_limits_.push_back(f->NewNumber(0)); | 197 weaken_min_limits_.push_back(f->NewNumber(0)); |
| 203 weaken_max_limits_.push_back(f->NewNumber(0)); | 198 weaken_max_limits_.push_back(f->NewNumber(0)); |
| 204 for (int i = 0; i < limits_count; i++) { | 199 for (int i = 0; i < limits_count; i++) { |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 854 | 849 |
| 855 Type* Typer::Visitor::JSBitwiseXorTyper(Type* lhs, Type* rhs, Typer* t) { | 850 Type* Typer::Visitor::JSBitwiseXorTyper(Type* lhs, Type* rhs, Typer* t) { |
| 856 lhs = NumberToInt32(ToNumber(lhs, t), t); | 851 lhs = NumberToInt32(ToNumber(lhs, t), t); |
| 857 rhs = NumberToInt32(ToNumber(rhs, t), t); | 852 rhs = NumberToInt32(ToNumber(rhs, t), t); |
| 858 double lmin = lhs->Min(); | 853 double lmin = lhs->Min(); |
| 859 double rmin = rhs->Min(); | 854 double rmin = rhs->Min(); |
| 860 double lmax = lhs->Max(); | 855 double lmax = lhs->Max(); |
| 861 double rmax = rhs->Max(); | 856 double rmax = rhs->Max(); |
| 862 if ((lmin >= 0 && rmin >= 0) || (lmax < 0 && rmax < 0)) { | 857 if ((lmin >= 0 && rmin >= 0) || (lmax < 0 && rmax < 0)) { |
| 863 // Xor-ing negative or non-negative values results in a non-negative value. | 858 // Xor-ing negative or non-negative values results in a non-negative value. |
| 864 return t->non_negative_signed32; | 859 return Type::NonNegativeSigned32(); |
| 865 } | 860 } |
| 866 if ((lmax < 0 && rmin >= 0) || (lmin >= 0 && rmax < 0)) { | 861 if ((lmax < 0 && rmin >= 0) || (lmin >= 0 && rmax < 0)) { |
| 867 // Xor-ing a negative and a non-negative value results in a negative value. | 862 // Xor-ing a negative and a non-negative value results in a negative value. |
| 868 return t->negative_signed32; | 863 // TODO(jarin) Use a range here. |
| 864 return Type::NegativeSigned32(); | |
| 869 } | 865 } |
| 870 return Type::Signed32(); | 866 return Type::Signed32(); |
| 871 } | 867 } |
| 872 | 868 |
| 873 | 869 |
| 874 Type* Typer::Visitor::JSShiftLeftTyper(Type* lhs, Type* rhs, Typer* t) { | 870 Type* Typer::Visitor::JSShiftLeftTyper(Type* lhs, Type* rhs, Typer* t) { |
| 875 return Type::Signed32(); | 871 return Type::Signed32(); |
| 876 } | 872 } |
| 877 | 873 |
| 878 | 874 |
| (...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2074 return typer_->cache_->Get(kFloat64ArrayFunc); | 2070 return typer_->cache_->Get(kFloat64ArrayFunc); |
| 2075 } | 2071 } |
| 2076 } | 2072 } |
| 2077 } | 2073 } |
| 2078 return Type::Constant(value, zone()); | 2074 return Type::Constant(value, zone()); |
| 2079 } | 2075 } |
| 2080 | 2076 |
| 2081 } // namespace compiler | 2077 } // namespace compiler |
| 2082 } // namespace internal | 2078 } // namespace internal |
| 2083 } // namespace v8 | 2079 } // namespace v8 |
| OLD | NEW |