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

Side by Side Diff: src/compiler/typer.cc

Issue 2066223002: [turbofan] Introduce CheckHole and CheckHoleNaN operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Blacklist test Created 4 years, 6 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
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 static Type* ToName(Type*, Typer*); 241 static Type* ToName(Type*, Typer*);
242 static Type* ToNumber(Type*, Typer*); 242 static Type* ToNumber(Type*, Typer*);
243 static Type* ToObject(Type*, Typer*); 243 static Type* ToObject(Type*, Typer*);
244 static Type* ToString(Type*, Typer*); 244 static Type* ToString(Type*, Typer*);
245 static Type* NumberCeil(Type*, Typer*); 245 static Type* NumberCeil(Type*, Typer*);
246 static Type* NumberFloor(Type*, Typer*); 246 static Type* NumberFloor(Type*, Typer*);
247 static Type* NumberRound(Type*, Typer*); 247 static Type* NumberRound(Type*, Typer*);
248 static Type* NumberTrunc(Type*, Typer*); 248 static Type* NumberTrunc(Type*, Typer*);
249 static Type* NumberToInt32(Type*, Typer*); 249 static Type* NumberToInt32(Type*, Typer*);
250 static Type* NumberToUint32(Type*, Typer*); 250 static Type* NumberToUint32(Type*, Typer*);
251 static Type* NumberConvertHoleNaN(Type*, Typer*);
252 251
253 static Type* ObjectIsCallable(Type*, Typer*); 252 static Type* ObjectIsCallable(Type*, Typer*);
254 static Type* ObjectIsNumber(Type*, Typer*); 253 static Type* ObjectIsNumber(Type*, Typer*);
255 static Type* ObjectIsReceiver(Type*, Typer*); 254 static Type* ObjectIsReceiver(Type*, Typer*);
256 static Type* ObjectIsSmi(Type*, Typer*); 255 static Type* ObjectIsSmi(Type*, Typer*);
257 static Type* ObjectIsString(Type*, Typer*); 256 static Type* ObjectIsString(Type*, Typer*);
258 static Type* ObjectIsUndetectable(Type*, Typer*); 257 static Type* ObjectIsUndetectable(Type*, Typer*);
259 258
260 static Type* JSAddRanger(RangeType*, RangeType*, Typer*); 259 static Type* JSAddRanger(RangeType*, RangeType*, Typer*);
261 static Type* JSSubtractRanger(RangeType*, RangeType*, Typer*); 260 static Type* JSSubtractRanger(RangeType*, RangeType*, Typer*);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 if (type->Is(Type::Unsigned32())) return type; 549 if (type->Is(Type::Unsigned32())) return type;
551 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero; 550 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero;
552 if (type->Is(t->unsigned32ish_)) { 551 if (type->Is(t->unsigned32ish_)) {
553 return Type::Intersect( 552 return Type::Intersect(
554 Type::Union(type, t->cache_.kSingletonZero, t->zone()), 553 Type::Union(type, t->cache_.kSingletonZero, t->zone()),
555 Type::Unsigned32(), t->zone()); 554 Type::Unsigned32(), t->zone());
556 } 555 }
557 return Type::Unsigned32(); 556 return Type::Unsigned32();
558 } 557 }
559 558
560 Type* Typer::Visitor::NumberConvertHoleNaN(Type* type, Typer* t) {
561 return Type::Union(type, Type::Undefined(), t->zone());
562 }
563
564 // Type checks. 559 // Type checks.
565 560
566 Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) { 561 Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) {
567 if (type->Is(Type::Function())) return t->singleton_true_; 562 if (type->Is(Type::Function())) return t->singleton_true_;
568 if (type->Is(Type::Primitive())) return t->singleton_false_; 563 if (type->Is(Type::Primitive())) return t->singleton_false_;
569 return Type::Boolean(); 564 return Type::Boolean();
570 } 565 }
571 566
572 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { 567 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) {
573 if (type->Is(Type::Number())) return t->singleton_true_; 568 if (type->Is(Type::Number())) return t->singleton_true_;
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 Type* Typer::Visitor::TypeNumberToInt32(Node* node) { 1806 Type* Typer::Visitor::TypeNumberToInt32(Node* node) {
1812 return TypeUnaryOp(node, NumberToInt32); 1807 return TypeUnaryOp(node, NumberToInt32);
1813 } 1808 }
1814 1809
1815 1810
1816 Type* Typer::Visitor::TypeNumberToUint32(Node* node) { 1811 Type* Typer::Visitor::TypeNumberToUint32(Node* node) {
1817 return TypeUnaryOp(node, NumberToUint32); 1812 return TypeUnaryOp(node, NumberToUint32);
1818 } 1813 }
1819 1814
1820 1815
1821 Type* Typer::Visitor::TypeNumberIsHoleNaN(Node* node) {
1822 return Type::Boolean();
1823 }
1824
1825 Type* Typer::Visitor::TypeNumberConvertHoleNaN(Node* node) {
1826 return TypeUnaryOp(node, NumberConvertHoleNaN);
1827 }
1828
1829 // static 1816 // static
1830 Type* Typer::Visitor::ReferenceEqualTyper(Type* lhs, Type* rhs, Typer* t) { 1817 Type* Typer::Visitor::ReferenceEqualTyper(Type* lhs, Type* rhs, Typer* t) {
1831 if (lhs->IsConstant() && rhs->Is(lhs)) { 1818 if (lhs->IsConstant() && rhs->Is(lhs)) {
1832 return t->singleton_true_; 1819 return t->singleton_true_;
1833 } 1820 }
1834 return Type::Boolean(); 1821 return Type::Boolean();
1835 } 1822 }
1836 1823
1837 1824
1838 Type* Typer::Visitor::TypeReferenceEqual(Node* node) { 1825 Type* Typer::Visitor::TypeReferenceEqual(Node* node) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 } 1954 }
1968 1955
1969 Type* Typer::Visitor::TypeCheckedTaggedToInt32(Node* node) { 1956 Type* Typer::Visitor::TypeCheckedTaggedToInt32(Node* node) {
1970 return Type::Signed32(); 1957 return Type::Signed32();
1971 } 1958 }
1972 1959
1973 Type* Typer::Visitor::TypeCheckedTaggedToFloat64(Node* node) { 1960 Type* Typer::Visitor::TypeCheckedTaggedToFloat64(Node* node) {
1974 return Type::Number(); 1961 return Type::Number();
1975 } 1962 }
1976 1963
1964 Type* Typer::Visitor::TypeCheckFloat64Hole(Node* node) {
1965 Type* type = Operand(node, 0);
1966 return type;
1967 }
1968
1969 Type* Typer::Visitor::TypeCheckTaggedHole(Node* node) {
1970 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op());
1971 Type* type = Operand(node, 0);
1972 type = Type::Intersect(type, Type::NonInternal(), zone());
1973 switch (mode) {
1974 case CheckTaggedHoleMode::kConvertHoleToUndefined: {
1975 // The hole is turned into undefined.
1976 type = Type::Union(type, Type::Undefined(), zone());
1977 break;
1978 }
1979 case CheckTaggedHoleMode::kNeverReturnHole: {
1980 // We deoptimize in case of the hole.
1981 break;
1982 }
1983 }
1984 return type;
1985 }
1986
1977 Type* Typer::Visitor::TypeCheckIf(Node* node) { 1987 Type* Typer::Visitor::TypeCheckIf(Node* node) {
1978 UNREACHABLE(); 1988 UNREACHABLE();
1979 return nullptr; 1989 return nullptr;
1980 } 1990 }
1981 1991
1982 Type* Typer::Visitor::TypeTruncateTaggedToWord32(Node* node) { 1992 Type* Typer::Visitor::TypeTruncateTaggedToWord32(Node* node) {
1983 Type* arg = Operand(node, 0); 1993 Type* arg = Operand(node, 0);
1984 // TODO(jarin): DCHECK(arg->Is(Type::NumberOrUndefined())); 1994 // TODO(jarin): DCHECK(arg->Is(Type::NumberOrUndefined()));
1985 // Several mjsunit and cctest tests fail this check. For instance, 1995 // Several mjsunit and cctest tests fail this check. For instance,
1986 // mjsunit/compiler/regress-607493 fails with Any/Any in simplified-lowering 1996 // mjsunit/compiler/regress-607493 fails with Any/Any in simplified-lowering
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 } 2704 }
2695 if (Type::IsInteger(*value)) { 2705 if (Type::IsInteger(*value)) {
2696 return Type::Range(value->Number(), value->Number(), zone()); 2706 return Type::Range(value->Number(), value->Number(), zone());
2697 } 2707 }
2698 return Type::Constant(value, zone()); 2708 return Type::Constant(value, zone());
2699 } 2709 }
2700 2710
2701 } // namespace compiler 2711 } // namespace compiler
2702 } // namespace internal 2712 } // namespace internal
2703 } // namespace v8 2713 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698