| 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 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2291 | 2290 |
| 2292 Type* Typer::Visitor::TypeChangeFloat32ToFloat64(Node* node) { | 2291 Type* Typer::Visitor::TypeChangeFloat32ToFloat64(Node* node) { |
| 2293 return Type::Intersect(Type::Number(), Type::UntaggedFloat64(), zone()); | 2292 return Type::Intersect(Type::Number(), Type::UntaggedFloat64(), zone()); |
| 2294 } | 2293 } |
| 2295 | 2294 |
| 2296 | 2295 |
| 2297 Type* Typer::Visitor::TypeChangeFloat64ToInt32(Node* node) { | 2296 Type* Typer::Visitor::TypeChangeFloat64ToInt32(Node* node) { |
| 2298 return Type::Intersect(Type::Signed32(), Type::UntaggedIntegral32(), zone()); | 2297 return Type::Intersect(Type::Signed32(), Type::UntaggedIntegral32(), zone()); |
| 2299 } | 2298 } |
| 2300 | 2299 |
| 2300 Type* Typer::Visitor::TypeNumberSilenceNaN(Node* node) { |
| 2301 return Type::Number(); |
| 2302 } |
| 2301 | 2303 |
| 2302 Type* Typer::Visitor::TypeChangeFloat64ToUint32(Node* node) { | 2304 Type* Typer::Visitor::TypeChangeFloat64ToUint32(Node* node) { |
| 2303 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), | 2305 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), |
| 2304 zone()); | 2306 zone()); |
| 2305 } | 2307 } |
| 2306 | 2308 |
| 2307 Type* Typer::Visitor::TypeTruncateFloat64ToUint32(Node* node) { | 2309 Type* Typer::Visitor::TypeTruncateFloat64ToUint32(Node* node) { |
| 2308 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), | 2310 return Type::Intersect(Type::Unsigned32(), Type::UntaggedIntegral32(), |
| 2309 zone()); | 2311 zone()); |
| 2310 } | 2312 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2337 | 2339 |
| 2338 Type* Typer::Visitor::TypeTryTruncateFloat64ToUint64(Node* node) { | 2340 Type* Typer::Visitor::TypeTryTruncateFloat64ToUint64(Node* node) { |
| 2339 return Type::Internal(); | 2341 return Type::Internal(); |
| 2340 } | 2342 } |
| 2341 | 2343 |
| 2342 | 2344 |
| 2343 Type* Typer::Visitor::TypeChangeInt32ToFloat64(Node* node) { | 2345 Type* Typer::Visitor::TypeChangeInt32ToFloat64(Node* node) { |
| 2344 return Type::Intersect(Type::Signed32(), Type::UntaggedFloat64(), zone()); | 2346 return Type::Intersect(Type::Signed32(), Type::UntaggedFloat64(), zone()); |
| 2345 } | 2347 } |
| 2346 | 2348 |
| 2349 Type* Typer::Visitor::TypeFloat64SilenceNaN(Node* node) { |
| 2350 return Type::UntaggedFloat64(); |
| 2351 } |
| 2347 | 2352 |
| 2348 Type* Typer::Visitor::TypeChangeInt32ToInt64(Node* node) { | 2353 Type* Typer::Visitor::TypeChangeInt32ToInt64(Node* node) { |
| 2349 return Type::Internal(); | 2354 return Type::Internal(); |
| 2350 } | 2355 } |
| 2351 | 2356 |
| 2352 | 2357 |
| 2353 Type* Typer::Visitor::TypeChangeUint32ToFloat64(Node* node) { | 2358 Type* Typer::Visitor::TypeChangeUint32ToFloat64(Node* node) { |
| 2354 return Type::Intersect(Type::Unsigned32(), Type::UntaggedFloat64(), zone()); | 2359 return Type::Intersect(Type::Unsigned32(), Type::UntaggedFloat64(), zone()); |
| 2355 } | 2360 } |
| 2356 | 2361 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2669 } | 2674 } |
| 2670 if (Type::IsInteger(*value)) { | 2675 if (Type::IsInteger(*value)) { |
| 2671 return Type::Range(value->Number(), value->Number(), zone()); | 2676 return Type::Range(value->Number(), value->Number(), zone()); |
| 2672 } | 2677 } |
| 2673 return Type::Constant(value, zone()); | 2678 return Type::Constant(value, zone()); |
| 2674 } | 2679 } |
| 2675 | 2680 |
| 2676 } // namespace compiler | 2681 } // namespace compiler |
| 2677 } // namespace internal | 2682 } // namespace internal |
| 2678 } // namespace v8 | 2683 } // namespace v8 |
| OLD | NEW |