| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 if (type->Is(Type::Unsigned32())) return type; | 549 if (type->Is(Type::Unsigned32())) return type; |
| 550 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero; | 550 if (type->Is(t->cache_.kZeroish)) return t->cache_.kSingletonZero; |
| 551 if (type->Is(t->unsigned32ish_)) { | 551 if (type->Is(t->unsigned32ish_)) { |
| 552 return Type::Intersect( | 552 return Type::Intersect( |
| 553 Type::Union(type, t->cache_.kSingletonZero, t->zone()), | 553 Type::Union(type, t->cache_.kSingletonZero, t->zone()), |
| 554 Type::Unsigned32(), t->zone()); | 554 Type::Unsigned32(), t->zone()); |
| 555 } | 555 } |
| 556 return Type::Unsigned32(); | 556 return Type::Unsigned32(); |
| 557 } | 557 } |
| 558 | 558 |
| 559 | |
| 560 // Type checks. | 559 // Type checks. |
| 561 | 560 |
| 562 Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) { | 561 Type* Typer::Visitor::ObjectIsCallable(Type* type, Typer* t) { |
| 563 if (type->Is(Type::Function())) return t->singleton_true_; | 562 if (type->Is(Type::Function())) return t->singleton_true_; |
| 564 if (type->Is(Type::Primitive())) return t->singleton_false_; | 563 if (type->Is(Type::Primitive())) return t->singleton_false_; |
| 565 return Type::Boolean(); | 564 return Type::Boolean(); |
| 566 } | 565 } |
| 567 | 566 |
| 568 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { | 567 Type* Typer::Visitor::ObjectIsNumber(Type* type, Typer* t) { |
| 569 if (type->Is(Type::Number())) return t->singleton_true_; | 568 if (type->Is(Type::Number())) return t->singleton_true_; |
| (...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2294 | 2293 |
| 2295 Type* Typer::Visitor::TypeChangeFloat32ToFloat64(Node* node) { | 2294 Type* Typer::Visitor::TypeChangeFloat32ToFloat64(Node* node) { |
| 2296 return Type::Intersect(Type::Number(), Type::UntaggedFloat64(), zone()); | 2295 return Type::Intersect(Type::Number(), Type::UntaggedFloat64(), zone()); |
| 2297 } | 2296 } |
| 2298 | 2297 |
| 2299 | 2298 |
| 2300 Type* Typer::Visitor::TypeChangeFloat64ToInt32(Node* node) { | 2299 Type* Typer::Visitor::TypeChangeFloat64ToInt32(Node* node) { |
| 2301 return Type::Intersect(Type::Signed32(), Type::UntaggedIntegral32(), zone()); | 2300 return Type::Intersect(Type::Signed32(), Type::UntaggedIntegral32(), zone()); |
| 2302 } | 2301 } |
| 2303 | 2302 |
| 2303 Type* Typer::Visitor::TypeNumberSilenceNaN(Node* node) { |
| 2304 return Type::Number(); |
| 2305 } |
| 2304 | 2306 |
| 2305 Type* Typer::Visitor::TypeChangeFloat64ToUint32(Node* node) { | 2307 Type* Typer::Visitor::TypeChangeFloat64ToUint32(Node* node) { |
| 2306 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), | 2308 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), |
| 2307 zone()); | 2309 zone()); |
| 2308 } | 2310 } |
| 2309 | 2311 |
| 2310 Type* Typer::Visitor::TypeTruncateFloat64ToUint32(Node* node) { | 2312 Type* Typer::Visitor::TypeTruncateFloat64ToUint32(Node* node) { |
| 2311 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), | 2313 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), |
| 2312 zone()); | 2314 zone()); |
| 2313 } | 2315 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2340 | 2342 |
| 2341 Type* Typer::Visitor::TypeTryTruncateFloat64ToUint64(Node* node) { | 2343 Type* Typer::Visitor::TypeTryTruncateFloat64ToUint64(Node* node) { |
| 2342 return Type::Internal(); | 2344 return Type::Internal(); |
| 2343 } | 2345 } |
| 2344 | 2346 |
| 2345 | 2347 |
| 2346 Type* Typer::Visitor::TypeChangeInt32ToFloat64(Node* node) { | 2348 Type* Typer::Visitor::TypeChangeInt32ToFloat64(Node* node) { |
| 2347 return Type::Intersect(Type::Signed32(), Type::UntaggedFloat64(), zone()); | 2349 return Type::Intersect(Type::Signed32(), Type::UntaggedFloat64(), zone()); |
| 2348 } | 2350 } |
| 2349 | 2351 |
| 2352 Type* Typer::Visitor::TypeFloat64SilenceNaN(Node* node) { |
| 2353 return Type::UntaggedFloat64(); |
| 2354 } |
| 2350 | 2355 |
| 2351 Type* Typer::Visitor::TypeChangeInt32ToInt64(Node* node) { | 2356 Type* Typer::Visitor::TypeChangeInt32ToInt64(Node* node) { |
| 2352 return Type::Internal(); | 2357 return Type::Internal(); |
| 2353 } | 2358 } |
| 2354 | 2359 |
| 2355 | 2360 |
| 2356 Type* Typer::Visitor::TypeChangeUint32ToFloat64(Node* node) { | 2361 Type* Typer::Visitor::TypeChangeUint32ToFloat64(Node* node) { |
| 2357 return Type::Intersect(Type::Unsigned32(), Type::UntaggedFloat64(), zone()); | 2362 return Type::Intersect(Type::Unsigned32(), Type::UntaggedFloat64(), zone()); |
| 2358 } | 2363 } |
| 2359 | 2364 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 } | 2681 } |
| 2677 if (Type::IsInteger(*value)) { | 2682 if (Type::IsInteger(*value)) { |
| 2678 return Type::Range(value->Number(), value->Number(), zone()); | 2683 return Type::Range(value->Number(), value->Number(), zone()); |
| 2679 } | 2684 } |
| 2680 return Type::Constant(value, zone()); | 2685 return Type::Constant(value, zone()); |
| 2681 } | 2686 } |
| 2682 | 2687 |
| 2683 } // namespace compiler | 2688 } // namespace compiler |
| 2684 } // namespace internal | 2689 } // namespace internal |
| 2685 } // namespace v8 | 2690 } // namespace v8 |
| OLD | NEW |