| 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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { | 1562 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { |
| 1563 return TypeUnaryOp(node, StringFromCharCodeTyper); | 1563 return TypeUnaryOp(node, StringFromCharCodeTyper); |
| 1564 } | 1564 } |
| 1565 | 1565 |
| 1566 Type* Typer::Visitor::TypeCheckBounds(Node* node) { | 1566 Type* Typer::Visitor::TypeCheckBounds(Node* node) { |
| 1567 Type* index = Operand(node, 0); | 1567 Type* index = Operand(node, 0); |
| 1568 Type* length = Operand(node, 1); | 1568 Type* length = Operand(node, 1); |
| 1569 index = Type::Intersect(index, Type::Integral32(), zone()); | 1569 index = Type::Intersect(index, Type::Integral32(), zone()); |
| 1570 if (!index->IsInhabited() || !length->IsInhabited()) return Type::None(); | 1570 if (!index->IsInhabited() || !length->IsInhabited()) return Type::None(); |
| 1571 double min = std::max(index->Min(), 0.0); | 1571 double min = std::max(index->Min(), 0.0); |
| 1572 double max = std::min(index->Max(), length->Min() - 1); | 1572 double max = std::min(index->Max(), length->Max() - 1); |
| 1573 if (max < min) return Type::None(); | 1573 if (max < min) return Type::None(); |
| 1574 return Type::Range(min, max, zone()); | 1574 return Type::Range(min, max, zone()); |
| 1575 } | 1575 } |
| 1576 | 1576 |
| 1577 Type* Typer::Visitor::TypeCheckMaps(Node* node) { | 1577 Type* Typer::Visitor::TypeCheckMaps(Node* node) { |
| 1578 UNREACHABLE(); | 1578 UNREACHABLE(); |
| 1579 return nullptr; | 1579 return nullptr; |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 Type* Typer::Visitor::TypeCheckNumber(Node* node) { | 1582 Type* Typer::Visitor::TypeCheckNumber(Node* node) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1719 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 1720 if (Type::IsInteger(*value)) { | 1720 if (Type::IsInteger(*value)) { |
| 1721 return Type::Range(value->Number(), value->Number(), zone()); | 1721 return Type::Range(value->Number(), value->Number(), zone()); |
| 1722 } | 1722 } |
| 1723 return Type::Constant(value, zone()); | 1723 return Type::Constant(value, zone()); |
| 1724 } | 1724 } |
| 1725 | 1725 |
| 1726 } // namespace compiler | 1726 } // namespace compiler |
| 1727 } // namespace internal | 1727 } // namespace internal |
| 1728 } // namespace v8 | 1728 } // namespace v8 |
| OLD | NEW |