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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 | 402 |
403 Type* Typer::Visitor::FalsifyUndefined(Type* type, Typer* t) { | 403 Type* Typer::Visitor::FalsifyUndefined(Type* type, Typer* t) { |
404 if (type->Is(Type::Undefined())) return t->singleton_false; | 404 if (type->Is(Type::Undefined())) return t->singleton_false; |
405 return type; | 405 return type; |
406 } | 406 } |
407 | 407 |
408 | 408 |
409 Type* Typer::Visitor::Rangify(Type* type, Typer* t) { | 409 Type* Typer::Visitor::Rangify(Type* type, Typer* t) { |
410 if (type->IsRange()) return type; // Shortcut. | 410 if (type->IsRange()) return type; // Shortcut. |
411 if (!type->Is(t->integer)) return type; // Give up. | 411 if (!type->Is(t->integer) && !type->Is(Type::Integral32())) { |
| 412 return type; // Give up on non-integer types. |
| 413 } |
| 414 double min = type->Min(); |
| 415 double max = type->Max(); |
| 416 // Handle the degenerate case of empty bitset types (such as |
| 417 // OtherUnsigned31 and OtherSigned32 on 64-bit architectures). |
| 418 if (std::isnan(min)) { |
| 419 DCHECK(std::isnan(max)); |
| 420 return type; |
| 421 } |
412 Factory* f = t->isolate()->factory(); | 422 Factory* f = t->isolate()->factory(); |
413 return Type::Range(f->NewNumber(type->Min()), f->NewNumber(type->Max()), | 423 return Type::Range(f->NewNumber(min), f->NewNumber(max), t->zone()); |
414 t->zone()); | |
415 } | 424 } |
416 | 425 |
417 | 426 |
418 // Type conversion. | 427 // Type conversion. |
419 | 428 |
420 | 429 |
421 Type* Typer::Visitor::ToPrimitive(Type* type, Typer* t) { | 430 Type* Typer::Visitor::ToPrimitive(Type* type, Typer* t) { |
422 if (type->Is(Type::Primitive()) && !type->Maybe(Type::Receiver())) { | 431 if (type->Is(Type::Primitive()) && !type->Maybe(Type::Receiver())) { |
423 return type; | 432 return type; |
424 } | 433 } |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 return typer_->float64_array_fun_; | 1891 return typer_->float64_array_fun_; |
1883 } | 1892 } |
1884 } | 1893 } |
1885 } | 1894 } |
1886 return Type::Constant(value, zone()); | 1895 return Type::Constant(value, zone()); |
1887 } | 1896 } |
1888 | 1897 |
1889 } | 1898 } |
1890 } | 1899 } |
1891 } // namespace v8::internal::compiler | 1900 } // namespace v8::internal::compiler |
OLD | NEW |