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/compiler/typer.h" | 5 #include "src/compiler/typer.h" |
6 | 6 |
7 #include "src/base/flags.h" | 7 #include "src/base/flags.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 flags_(flags), | 36 flags_(flags), |
37 dependencies_(dependencies), | 37 dependencies_(dependencies), |
38 function_type_(function_type), | 38 function_type_(function_type), |
39 decorator_(nullptr), | 39 decorator_(nullptr), |
40 cache_(TypeCache::Get()) { | 40 cache_(TypeCache::Get()) { |
41 Zone* zone = this->zone(); | 41 Zone* zone = this->zone(); |
42 Factory* const factory = isolate->factory(); | 42 Factory* const factory = isolate->factory(); |
43 | 43 |
44 Type* infinity = Type::Constant(factory->infinity_value(), zone); | 44 Type* infinity = Type::Constant(factory->infinity_value(), zone); |
45 Type* minus_infinity = Type::Constant(factory->minus_infinity_value(), zone); | 45 Type* minus_infinity = Type::Constant(factory->minus_infinity_value(), zone); |
46 // TODO(neis): Unfortunately, the infinities created in other places might | 46 // Unfortunately, the infinities created in other places might be different |
47 // be different ones (eg the result of NewNumber in TypeNumberConstant). | 47 // ones (eg the result of NewNumber in TypeNumberConstant). |
48 Type* truncating_to_zero = | 48 Type* truncating_to_zero = |
49 Type::Union(Type::Union(infinity, minus_infinity, zone), | 49 Type::Union(Type::Union(infinity, minus_infinity, zone), |
50 Type::MinusZeroOrNaN(), zone); | 50 Type::MinusZeroOrNaN(), zone); |
51 DCHECK(!truncating_to_zero->Maybe(Type::Integral32())); | 51 DCHECK(!truncating_to_zero->Maybe(Type::Integral32())); |
52 | 52 |
53 singleton_false_ = Type::Constant(factory->false_value(), zone); | 53 singleton_false_ = Type::Constant(factory->false_value(), zone); |
54 singleton_true_ = Type::Constant(factory->true_value(), zone); | 54 singleton_true_ = Type::Constant(factory->true_value(), zone); |
55 singleton_the_hole_ = Type::Constant(factory->the_hole_value(), zone); | 55 singleton_the_hole_ = Type::Constant(factory->the_hole_value(), zone); |
56 signed32ish_ = Type::Union(Type::Signed32(), truncating_to_zero, zone); | 56 signed32ish_ = Type::Union(Type::Signed32(), truncating_to_zero, zone); |
57 unsigned32ish_ = Type::Union(Type::Unsigned32(), truncating_to_zero, zone); | 57 unsigned32ish_ = Type::Union(Type::Unsigned32(), truncating_to_zero, zone); |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 527 |
528 // static | 528 // static |
529 Type* Typer::Visitor::NumberTrunc(Type* type, Typer* t) { | 529 Type* Typer::Visitor::NumberTrunc(Type* type, Typer* t) { |
530 DCHECK(type->Is(Type::Number())); | 530 DCHECK(type->Is(Type::Number())); |
531 if (type->Is(t->cache_.kIntegerOrMinusZeroOrNaN)) return type; | 531 if (type->Is(t->cache_.kIntegerOrMinusZeroOrNaN)) return type; |
532 // TODO(bmeurer): We could infer a more precise type here. | 532 // TODO(bmeurer): We could infer a more precise type here. |
533 return t->cache_.kIntegerOrMinusZeroOrNaN; | 533 return t->cache_.kIntegerOrMinusZeroOrNaN; |
534 } | 534 } |
535 | 535 |
536 Type* Typer::Visitor::NumberToInt32(Type* type, Typer* t) { | 536 Type* Typer::Visitor::NumberToInt32(Type* type, Typer* t) { |
537 // TODO(neis): DCHECK(type->Is(Type::Number())); | |
538 if (type->Is(Type::Signed32())) return type; | 537 if (type->Is(Type::Signed32())) return type; |
539 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero; | 538 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero; |
540 if (type->Is(t->signed32ish_)) { | 539 if (type->Is(t->signed32ish_)) { |
541 return Type::Intersect( | 540 return Type::Intersect( |
542 Type::Union(type, t->cache_.kSingletonZero, t->zone()), | 541 Type::Union(type, t->cache_.kSingletonZero, t->zone()), |
543 Type::Signed32(), t->zone()); | 542 Type::Signed32(), t->zone()); |
544 } | 543 } |
545 return Type::Signed32(); | 544 return Type::Signed32(); |
546 } | 545 } |
547 | 546 |
548 | 547 |
549 Type* Typer::Visitor::NumberToUint32(Type* type, Typer* t) { | 548 Type* Typer::Visitor::NumberToUint32(Type* type, Typer* t) { |
550 // TODO(neis): DCHECK(type->Is(Type::Number())); | |
551 if (type->Is(Type::Unsigned32())) return type; | 549 if (type->Is(Type::Unsigned32())) return type; |
552 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero; | 550 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero; |
553 if (type->Is(t->unsigned32ish_)) { | 551 if (type->Is(t->unsigned32ish_)) { |
554 return Type::Intersect( | 552 return Type::Intersect( |
555 Type::Union(type, t->cache_.kSingletonZero, t->zone()), | 553 Type::Union(type, t->cache_.kSingletonZero, t->zone()), |
556 Type::Unsigned32(), t->zone()); | 554 Type::Unsigned32(), t->zone()); |
557 } | 555 } |
558 return Type::Unsigned32(); | 556 return Type::Unsigned32(); |
559 } | 557 } |
560 | 558 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 if (lhs->Is(Type::NullOrUndefined()) && rhs->Is(Type::NullOrUndefined())) { | 757 if (lhs->Is(Type::NullOrUndefined()) && rhs->Is(Type::NullOrUndefined())) { |
760 return t->singleton_true_; | 758 return t->singleton_true_; |
761 } | 759 } |
762 if (lhs->Is(Type::Number()) && rhs->Is(Type::Number()) && | 760 if (lhs->Is(Type::Number()) && rhs->Is(Type::Number()) && |
763 (lhs->Max() < rhs->Min() || lhs->Min() > rhs->Max())) { | 761 (lhs->Max() < rhs->Min() || lhs->Min() > rhs->Max())) { |
764 return t->singleton_false_; | 762 return t->singleton_false_; |
765 } | 763 } |
766 if (lhs->IsConstant() && rhs->Is(lhs)) { | 764 if (lhs->IsConstant() && rhs->Is(lhs)) { |
767 // Types are equal and are inhabited only by a single semantic value, | 765 // Types are equal and are inhabited only by a single semantic value, |
768 // which is not nan due to the earlier check. | 766 // which is not nan due to the earlier check. |
769 // TODO(neis): Extend this to Range(x,x), MinusZero, ...? | |
770 return t->singleton_true_; | 767 return t->singleton_true_; |
771 } | 768 } |
772 return Type::Boolean(); | 769 return Type::Boolean(); |
773 } | 770 } |
774 | 771 |
775 | 772 |
776 Type* Typer::Visitor::JSNotEqualTyper(Type* lhs, Type* rhs, Typer* t) { | 773 Type* Typer::Visitor::JSNotEqualTyper(Type* lhs, Type* rhs, Typer* t) { |
777 return Invert(JSEqualTyper(lhs, rhs, t), t); | 774 return Invert(JSEqualTyper(lhs, rhs, t), t); |
778 } | 775 } |
779 | 776 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 min = rmin; | 900 min = rmin; |
904 max = rmax; | 901 max = rmax; |
905 } | 902 } |
906 | 903 |
907 if (lmax < 0 || rmax < 0) { | 904 if (lmax < 0 || rmax < 0) { |
908 // Or-ing two values of which at least one is negative results in a negative | 905 // Or-ing two values of which at least one is negative results in a negative |
909 // value. | 906 // value. |
910 max = std::min(max, -1.0); | 907 max = std::min(max, -1.0); |
911 } | 908 } |
912 return Type::Range(min, max, t->zone()); | 909 return Type::Range(min, max, t->zone()); |
913 // TODO(neis): Be precise for singleton inputs, here and elsewhere. | |
914 } | 910 } |
915 | 911 |
916 | 912 |
917 Type* Typer::Visitor::JSBitwiseAndTyper(Type* lhs, Type* rhs, Typer* t) { | 913 Type* Typer::Visitor::JSBitwiseAndTyper(Type* lhs, Type* rhs, Typer* t) { |
918 lhs = NumberToInt32(ToNumber(lhs, t), t); | 914 lhs = NumberToInt32(ToNumber(lhs, t), t); |
919 rhs = NumberToInt32(ToNumber(rhs, t), t); | 915 rhs = NumberToInt32(ToNumber(rhs, t), t); |
920 double lmin = lhs->Min(); | 916 double lmin = lhs->Min(); |
921 double rmin = rhs->Min(); | 917 double rmin = rhs->Min(); |
922 double lmax = lhs->Max(); | 918 double lmax = lhs->Max(); |
923 double rmax = rhs->Max(); | 919 double rmax = rhs->Max(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } else { | 1074 } else { |
1079 return Type::NumberOrString(); | 1075 return Type::NumberOrString(); |
1080 } | 1076 } |
1081 } | 1077 } |
1082 lhs = Rangify(ToNumber(lhs, t), t); | 1078 lhs = Rangify(ToNumber(lhs, t), t); |
1083 rhs = Rangify(ToNumber(rhs, t), t); | 1079 rhs = Rangify(ToNumber(rhs, t), t); |
1084 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN(); | 1080 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN(); |
1085 if (lhs->IsRange() && rhs->IsRange()) { | 1081 if (lhs->IsRange() && rhs->IsRange()) { |
1086 return JSAddRanger(lhs->AsRange(), rhs->AsRange(), t); | 1082 return JSAddRanger(lhs->AsRange(), rhs->AsRange(), t); |
1087 } | 1083 } |
1088 // TODO(neis): Deal with numeric bitsets here and elsewhere. | |
1089 return Type::Number(); | 1084 return Type::Number(); |
1090 } | 1085 } |
1091 | 1086 |
1092 Type* Typer::Visitor::JSSubtractRanger(RangeType* lhs, RangeType* rhs, | 1087 Type* Typer::Visitor::JSSubtractRanger(RangeType* lhs, RangeType* rhs, |
1093 Typer* t) { | 1088 Typer* t) { |
1094 double results[4]; | 1089 double results[4]; |
1095 results[0] = lhs->Min() - rhs->Min(); | 1090 results[0] = lhs->Min() - rhs->Min(); |
1096 results[1] = lhs->Min() - rhs->Max(); | 1091 results[1] = lhs->Min() - rhs->Max(); |
1097 results[2] = lhs->Max() - rhs->Min(); | 1092 results[2] = lhs->Max() - rhs->Min(); |
1098 results[3] = lhs->Max() - rhs->Max(); | 1093 results[3] = lhs->Max() - rhs->Max(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 } | 1157 } |
1163 return Type::Number(); | 1158 return Type::Number(); |
1164 } | 1159 } |
1165 | 1160 |
1166 | 1161 |
1167 Type* Typer::Visitor::JSDivideTyper(Type* lhs, Type* rhs, Typer* t) { | 1162 Type* Typer::Visitor::JSDivideTyper(Type* lhs, Type* rhs, Typer* t) { |
1168 lhs = ToNumber(lhs, t); | 1163 lhs = ToNumber(lhs, t); |
1169 rhs = ToNumber(rhs, t); | 1164 rhs = ToNumber(rhs, t); |
1170 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN(); | 1165 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN(); |
1171 // Division is tricky, so all we do is try ruling out nan. | 1166 // Division is tricky, so all we do is try ruling out nan. |
1172 // TODO(neis): try ruling out -0 as well? | |
1173 bool maybe_nan = | 1167 bool maybe_nan = |
1174 lhs->Maybe(Type::NaN()) || rhs->Maybe(t->cache_.kZeroish) || | 1168 lhs->Maybe(Type::NaN()) || rhs->Maybe(t->cache_.kZeroish) || |
1175 ((lhs->Min() == -V8_INFINITY || lhs->Max() == +V8_INFINITY) && | 1169 ((lhs->Min() == -V8_INFINITY || lhs->Max() == +V8_INFINITY) && |
1176 (rhs->Min() == -V8_INFINITY || rhs->Max() == +V8_INFINITY)); | 1170 (rhs->Min() == -V8_INFINITY || rhs->Max() == +V8_INFINITY)); |
1177 return maybe_nan ? Type::Number() : Type::OrderedNumber(); | 1171 return maybe_nan ? Type::Number() : Type::OrderedNumber(); |
1178 } | 1172 } |
1179 | 1173 |
1180 Type* Typer::Visitor::JSModulusRanger(RangeType* lhs, RangeType* rhs, | 1174 Type* Typer::Visitor::JSModulusRanger(RangeType* lhs, RangeType* rhs, |
1181 Typer* t) { | 1175 Typer* t) { |
1182 double lmin = lhs->Min(); | 1176 double lmin = lhs->Min(); |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 | 1841 |
1848 Type* ChangeRepresentation(Type* type, Type* rep, Zone* zone) { | 1842 Type* ChangeRepresentation(Type* type, Type* rep, Zone* zone) { |
1849 return Type::Union(Type::Semantic(type, zone), | 1843 return Type::Union(Type::Semantic(type, zone), |
1850 Type::Representation(rep, zone), zone); | 1844 Type::Representation(rep, zone), zone); |
1851 } | 1845 } |
1852 | 1846 |
1853 } // namespace | 1847 } // namespace |
1854 | 1848 |
1855 Type* Typer::Visitor::TypeChangeTaggedSignedToInt32(Node* node) { | 1849 Type* Typer::Visitor::TypeChangeTaggedSignedToInt32(Node* node) { |
1856 Type* arg = Operand(node, 0); | 1850 Type* arg = Operand(node, 0); |
1857 // TODO(neis): DCHECK(arg->Is(Type::Signed32())); | 1851 // TODO(jarin): DCHECK(arg->Is(Type::Signed32())); |
| 1852 // Many tests fail this check. |
1858 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); | 1853 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); |
1859 } | 1854 } |
1860 | 1855 |
1861 Type* Typer::Visitor::TypeChangeTaggedToInt32(Node* node) { | 1856 Type* Typer::Visitor::TypeChangeTaggedToInt32(Node* node) { |
1862 Type* arg = Operand(node, 0); | 1857 Type* arg = Operand(node, 0); |
1863 // TODO(neis): DCHECK(arg->Is(Type::Signed32())); | 1858 DCHECK(arg->Is(Type::Signed32())); |
1864 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); | 1859 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); |
1865 } | 1860 } |
1866 | 1861 |
1867 | 1862 |
1868 Type* Typer::Visitor::TypeChangeTaggedToUint32(Node* node) { | 1863 Type* Typer::Visitor::TypeChangeTaggedToUint32(Node* node) { |
1869 Type* arg = Operand(node, 0); | 1864 Type* arg = Operand(node, 0); |
1870 // TODO(neis): DCHECK(arg->Is(Type::Unsigned32())); | 1865 DCHECK(arg->Is(Type::Unsigned32())); |
1871 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); | 1866 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); |
1872 } | 1867 } |
1873 | 1868 |
1874 | 1869 |
1875 Type* Typer::Visitor::TypeChangeTaggedToFloat64(Node* node) { | 1870 Type* Typer::Visitor::TypeChangeTaggedToFloat64(Node* node) { |
1876 Type* arg = Operand(node, 0); | 1871 Type* arg = Operand(node, 0); |
1877 // TODO(neis): DCHECK(arg->Is(Type::Number())); | 1872 DCHECK(arg->Is(Type::Number())); |
1878 return ChangeRepresentation(arg, Type::UntaggedFloat64(), zone()); | 1873 return ChangeRepresentation(arg, Type::UntaggedFloat64(), zone()); |
1879 } | 1874 } |
1880 | 1875 |
1881 Type* Typer::Visitor::TypeTruncateTaggedToFloat64(Node* node) { | 1876 Type* Typer::Visitor::TypeTruncateTaggedToFloat64(Node* node) { |
1882 Type* arg = Operand(node, 0); | 1877 Type* arg = Operand(node, 0); |
1883 // TODO(neis): DCHECK(arg->Is(Type::NumberOrUndefined())); | 1878 DCHECK(arg->Is(Type::NumberOrUndefined())); |
1884 return ChangeRepresentation(arg, Type::UntaggedFloat64(), zone()); | 1879 return ChangeRepresentation(arg, Type::UntaggedFloat64(), zone()); |
1885 } | 1880 } |
1886 | 1881 |
1887 Type* Typer::Visitor::TypeChangeInt31ToTaggedSigned(Node* node) { | 1882 Type* Typer::Visitor::TypeChangeInt31ToTaggedSigned(Node* node) { |
1888 Type* arg = Operand(node, 0); | 1883 Type* arg = Operand(node, 0); |
1889 // TODO(neis): DCHECK(arg->Is(Type::Signed31())); | 1884 // TODO(jarin): DCHECK(arg->Is(Type::Signed31())); |
| 1885 // Some mjsunit/asm and mjsunit/wasm tests fail this check. |
| 1886 // For instance, asm/int32-umod fails with Signed32/UntaggedIntegral32 in |
| 1887 // simplified-lowering (after propagation). |
1890 Type* rep = | 1888 Type* rep = |
1891 arg->Is(Type::SignedSmall()) ? Type::TaggedSigned() : Type::Tagged(); | 1889 arg->Is(Type::SignedSmall()) ? Type::TaggedSigned() : Type::Tagged(); |
1892 return ChangeRepresentation(arg, rep, zone()); | 1890 return ChangeRepresentation(arg, rep, zone()); |
1893 } | 1891 } |
1894 | 1892 |
1895 Type* Typer::Visitor::TypeChangeInt32ToTagged(Node* node) { | 1893 Type* Typer::Visitor::TypeChangeInt32ToTagged(Node* node) { |
1896 Type* arg = Operand(node, 0); | 1894 Type* arg = Operand(node, 0); |
1897 // TODO(neis): DCHECK(arg->Is(Type::Signed32())); | 1895 // TODO(jarin): DCHECK(arg->Is(Type::Signed32())); |
| 1896 // Two tests fail this check: mjsunit/asm/sqlite3/sqlite-safe-heap and |
| 1897 // mjsunit/wasm/embenchen/lua_binarytrees. The first one fails with Any/Any in |
| 1898 // simplified-lowering (after propagation). |
1898 Type* rep = | 1899 Type* rep = |
1899 arg->Is(Type::SignedSmall()) ? Type::TaggedSigned() : Type::Tagged(); | 1900 arg->Is(Type::SignedSmall()) ? Type::TaggedSigned() : Type::Tagged(); |
1900 return ChangeRepresentation(arg, rep, zone()); | 1901 return ChangeRepresentation(arg, rep, zone()); |
1901 } | 1902 } |
1902 | 1903 |
1903 | |
1904 Type* Typer::Visitor::TypeChangeUint32ToTagged(Node* node) { | 1904 Type* Typer::Visitor::TypeChangeUint32ToTagged(Node* node) { |
1905 Type* arg = Operand(node, 0); | 1905 Type* arg = Operand(node, 0); |
1906 // TODO(neis): DCHECK(arg->Is(Type::Unsigned32())); | 1906 // TODO(jarin): DCHECK(arg->Is(Type::Unsigned32())); |
| 1907 // This fails in benchmarks/octane/mandreel (--turbo). |
1907 return ChangeRepresentation(arg, Type::Tagged(), zone()); | 1908 return ChangeRepresentation(arg, Type::Tagged(), zone()); |
1908 } | 1909 } |
1909 | 1910 |
1910 | |
1911 Type* Typer::Visitor::TypeChangeFloat64ToTagged(Node* node) { | 1911 Type* Typer::Visitor::TypeChangeFloat64ToTagged(Node* node) { |
1912 Type* arg = Operand(node, 0); | 1912 Type* arg = Operand(node, 0); |
1913 // TODO(neis): CHECK(arg.upper->Is(Type::Number())); | 1913 // TODO(jarin): DCHECK(arg->Is(Type::Number())); |
| 1914 // Some (or all) mjsunit/wasm/embenchen/ tests fail this check when run with |
| 1915 // --turbo and --always-opt. |
1914 return ChangeRepresentation(arg, Type::Tagged(), zone()); | 1916 return ChangeRepresentation(arg, Type::Tagged(), zone()); |
1915 } | 1917 } |
1916 | 1918 |
1917 Type* Typer::Visitor::TypeChangeTaggedToBit(Node* node) { | 1919 Type* Typer::Visitor::TypeChangeTaggedToBit(Node* node) { |
1918 Type* arg = Operand(node, 0); | 1920 Type* arg = Operand(node, 0); |
1919 // TODO(neis): DCHECK(arg.upper->Is(Type::Boolean())); | 1921 DCHECK(arg->Is(Type::Boolean())); |
1920 return ChangeRepresentation(arg, Type::UntaggedBit(), zone()); | 1922 return ChangeRepresentation(arg, Type::UntaggedBit(), zone()); |
1921 } | 1923 } |
1922 | 1924 |
1923 Type* Typer::Visitor::TypeChangeBitToTagged(Node* node) { | 1925 Type* Typer::Visitor::TypeChangeBitToTagged(Node* node) { |
1924 Type* arg = Operand(node, 0); | 1926 Type* arg = Operand(node, 0); |
1925 // TODO(neis): DCHECK(arg.upper->Is(Type::Boolean())); | |
1926 return ChangeRepresentation(arg, Type::TaggedPointer(), zone()); | 1927 return ChangeRepresentation(arg, Type::TaggedPointer(), zone()); |
1927 } | 1928 } |
1928 | 1929 |
1929 Type* Typer::Visitor::TypeCheckedUint32ToInt32(Node* node) { | 1930 Type* Typer::Visitor::TypeCheckedUint32ToInt32(Node* node) { |
1930 return Type::Signed32(); | 1931 return Type::Signed32(); |
1931 } | 1932 } |
1932 | 1933 |
1933 Type* Typer::Visitor::TypeCheckedFloat64ToInt32(Node* node) { | 1934 Type* Typer::Visitor::TypeCheckedFloat64ToInt32(Node* node) { |
1934 return Type::Signed32(); | 1935 return Type::Signed32(); |
1935 } | 1936 } |
1936 | 1937 |
1937 Type* Typer::Visitor::TypeCheckedTaggedToInt32(Node* node) { | 1938 Type* Typer::Visitor::TypeCheckedTaggedToInt32(Node* node) { |
1938 return Type::Signed32(); | 1939 return Type::Signed32(); |
1939 } | 1940 } |
1940 | 1941 |
1941 Type* Typer::Visitor::TypeCheckedTaggedToFloat64(Node* node) { | 1942 Type* Typer::Visitor::TypeCheckedTaggedToFloat64(Node* node) { |
1942 return Type::Number(); | 1943 return Type::Number(); |
1943 } | 1944 } |
1944 | 1945 |
1945 Type* Typer::Visitor::TypeTruncateTaggedToWord32(Node* node) { | 1946 Type* Typer::Visitor::TypeTruncateTaggedToWord32(Node* node) { |
1946 Type* arg = Operand(node, 0); | 1947 Type* arg = Operand(node, 0); |
1947 // TODO(neis): DCHECK(arg->Is(Type::Number())); | 1948 // TODO(jarin): DCHECK(arg->Is(Type::NumberOrUndefined())); |
| 1949 // Several mjsunit and cctest tests fail this check. For instance, |
| 1950 // mjsunit/compiler/regress-607493 fails with Any/Any in simplified-lowering |
| 1951 // (after propagation). |
1948 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); | 1952 return ChangeRepresentation(arg, Type::UntaggedIntegral32(), zone()); |
1949 } | 1953 } |
1950 | 1954 |
1951 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::TaggedPointer(); } | 1955 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::TaggedPointer(); } |
1952 | 1956 |
1953 | 1957 |
1954 namespace { | 1958 namespace { |
1955 | 1959 |
1956 MaybeHandle<Map> GetStableMapFromObjectType(Type* object_type) { | 1960 MaybeHandle<Map> GetStableMapFromObjectType(Type* object_type) { |
1957 if (object_type->IsConstant() && | 1961 if (object_type->IsConstant() && |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 } | 2643 } |
2640 if (Type::IsInteger(*value)) { | 2644 if (Type::IsInteger(*value)) { |
2641 return Type::Range(value->Number(), value->Number(), zone()); | 2645 return Type::Range(value->Number(), value->Number(), zone()); |
2642 } | 2646 } |
2643 return Type::Constant(value, zone()); | 2647 return Type::Constant(value, zone()); |
2644 } | 2648 } |
2645 | 2649 |
2646 } // namespace compiler | 2650 } // namespace compiler |
2647 } // namespace internal | 2651 } // namespace internal |
2648 } // namespace v8 | 2652 } // namespace v8 |
OLD | NEW |