| 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 <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { | 1759 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { |
| 1760 return TypeUnaryOp(node, StringFromCharCodeTyper); | 1760 return TypeUnaryOp(node, StringFromCharCodeTyper); |
| 1761 } | 1761 } |
| 1762 | 1762 |
| 1763 Type* Typer::Visitor::TypeStringFromCodePoint(Node* node) { | 1763 Type* Typer::Visitor::TypeStringFromCodePoint(Node* node) { |
| 1764 return TypeUnaryOp(node, StringFromCodePointTyper); | 1764 return TypeUnaryOp(node, StringFromCodePointTyper); |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 Type* Typer::Visitor::TypeStringIndexOf(Node* node) { |
| 1768 return Type::Range(-1.0, String::kMaxLength - 1.0, zone()); |
| 1769 } |
| 1770 |
| 1767 Type* Typer::Visitor::TypeCheckBounds(Node* node) { | 1771 Type* Typer::Visitor::TypeCheckBounds(Node* node) { |
| 1768 Type* index = Operand(node, 0); | 1772 Type* index = Operand(node, 0); |
| 1769 Type* length = Operand(node, 1); | 1773 Type* length = Operand(node, 1); |
| 1770 index = Type::Intersect(index, Type::Integral32(), zone()); | 1774 index = Type::Intersect(index, Type::Integral32(), zone()); |
| 1771 if (!index->IsInhabited() || !length->IsInhabited()) return Type::None(); | 1775 if (!index->IsInhabited() || !length->IsInhabited()) return Type::None(); |
| 1772 double min = std::max(index->Min(), 0.0); | 1776 double min = std::max(index->Min(), 0.0); |
| 1773 double max = std::min(index->Max(), length->Max() - 1); | 1777 double max = std::min(index->Max(), length->Max() - 1); |
| 1774 if (max < min) return Type::None(); | 1778 if (max < min) return Type::None(); |
| 1775 return Type::Range(min, max, zone()); | 1779 return Type::Range(min, max, zone()); |
| 1776 } | 1780 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1944 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 1941 if (Type::IsInteger(*value)) { | 1945 if (Type::IsInteger(*value)) { |
| 1942 return Type::Range(value->Number(), value->Number(), zone()); | 1946 return Type::Range(value->Number(), value->Number(), zone()); |
| 1943 } | 1947 } |
| 1944 return Type::NewConstant(value, zone()); | 1948 return Type::NewConstant(value, zone()); |
| 1945 } | 1949 } |
| 1946 | 1950 |
| 1947 } // namespace compiler | 1951 } // namespace compiler |
| 1948 } // namespace internal | 1952 } // namespace internal |
| 1949 } // namespace v8 | 1953 } // namespace v8 |
| OLD | NEW |