Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: src/compiler/typer.cc

Issue 2488183002: [turbofan] Address a couple of Type-related TODOs. (Closed)
Patch Set: Now with green bots. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/type-cache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 1466
1467 1467
1468 Type* Typer::Visitor::TypeJSForInNext(Node* node) { 1468 Type* Typer::Visitor::TypeJSForInNext(Node* node) {
1469 return Type::Union(Type::Name(), Type::Undefined(), zone()); 1469 return Type::Union(Type::Name(), Type::Undefined(), zone());
1470 } 1470 }
1471 1471
1472 1472
1473 Type* Typer::Visitor::TypeJSForInPrepare(Node* node) { 1473 Type* Typer::Visitor::TypeJSForInPrepare(Node* node) {
1474 STATIC_ASSERT(Map::EnumLengthBits::kMax <= FixedArray::kMaxLength); 1474 STATIC_ASSERT(Map::EnumLengthBits::kMax <= FixedArray::kMaxLength);
1475 Type* const cache_type = 1475 Type* const cache_type =
1476 Type::Union(typer_->cache_.kSmi, Type::OtherInternal(), zone()); 1476 Type::Union(Type::SignedSmall(), Type::OtherInternal(), zone());
1477 Type* const cache_array = Type::OtherInternal(); 1477 Type* const cache_array = Type::OtherInternal();
1478 Type* const cache_length = typer_->cache_.kFixedArrayLengthType; 1478 Type* const cache_length = typer_->cache_.kFixedArrayLengthType;
1479 return Type::Tuple(cache_type, cache_array, cache_length, zone()); 1479 return Type::Tuple(cache_type, cache_array, cache_length, zone());
1480 } 1480 }
1481 1481
1482 1482
1483 Type* Typer::Visitor::TypeJSLoadMessage(Node* node) { return Type::Any(); } 1483 Type* Typer::Visitor::TypeJSLoadMessage(Node* node) { return Type::Any(); }
1484 1484
1485 1485
1486 Type* Typer::Visitor::TypeJSStoreMessage(Node* node) { 1486 Type* Typer::Visitor::TypeJSStoreMessage(Node* node) {
1487 UNREACHABLE(); 1487 UNREACHABLE();
1488 return nullptr; 1488 return nullptr;
1489 } 1489 }
1490 1490
1491 Type* Typer::Visitor::TypeJSGeneratorStore(Node* node) { 1491 Type* Typer::Visitor::TypeJSGeneratorStore(Node* node) {
1492 UNREACHABLE(); 1492 UNREACHABLE();
1493 return nullptr; 1493 return nullptr;
1494 } 1494 }
1495 1495
1496 Type* Typer::Visitor::TypeJSGeneratorRestoreContinuation(Node* node) { 1496 Type* Typer::Visitor::TypeJSGeneratorRestoreContinuation(Node* node) {
1497 return typer_->cache_.kSmi; 1497 return Type::SignedSmall();
1498 } 1498 }
1499 1499
1500 Type* Typer::Visitor::TypeJSGeneratorRestoreRegister(Node* node) { 1500 Type* Typer::Visitor::TypeJSGeneratorRestoreRegister(Node* node) {
1501 return Type::Any(); 1501 return Type::Any();
1502 } 1502 }
1503 1503
1504 Type* Typer::Visitor::TypeJSStackCheck(Node* node) { return Type::Any(); } 1504 Type* Typer::Visitor::TypeJSStackCheck(Node* node) { return Type::Any(); }
1505 1505
1506 // Simplified operators. 1506 // Simplified operators.
1507 1507
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1562
1563 Type* Typer::Visitor::StringFromCharCodeTyper(Type* type, Typer* t) { 1563 Type* Typer::Visitor::StringFromCharCodeTyper(Type* type, Typer* t) {
1564 return Type::String(); 1564 return Type::String();
1565 } 1565 }
1566 1566
1567 Type* Typer::Visitor::StringFromCodePointTyper(Type* type, Typer* t) { 1567 Type* Typer::Visitor::StringFromCodePointTyper(Type* type, Typer* t) {
1568 return Type::String(); 1568 return Type::String();
1569 } 1569 }
1570 1570
1571 Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) { 1571 Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) {
1572 // TODO(bmeurer): We could do better here based on inputs. 1572 return typer_->cache_.kUint16;
1573 return Type::Range(0, kMaxUInt16, zone());
1574 } 1573 }
1575 1574
1576 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { 1575 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) {
1577 return TypeUnaryOp(node, StringFromCharCodeTyper); 1576 return TypeUnaryOp(node, StringFromCharCodeTyper);
1578 } 1577 }
1579 1578
1580 Type* Typer::Visitor::TypeStringFromCodePoint(Node* node) { 1579 Type* Typer::Visitor::TypeStringFromCodePoint(Node* node) {
1581 return TypeUnaryOp(node, StringFromCodePointTyper); 1580 return TypeUnaryOp(node, StringFromCodePointTyper);
1582 } 1581 }
1583 1582
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 return type; 1642 return type;
1644 } 1643 }
1645 1644
1646 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::Any(); } 1645 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::Any(); }
1647 1646
1648 Type* Typer::Visitor::TypeLoadField(Node* node) { 1647 Type* Typer::Visitor::TypeLoadField(Node* node) {
1649 return FieldAccessOf(node->op()).type; 1648 return FieldAccessOf(node->op()).type;
1650 } 1649 }
1651 1650
1652 Type* Typer::Visitor::TypeLoadBuffer(Node* node) { 1651 Type* Typer::Visitor::TypeLoadBuffer(Node* node) {
1653 // TODO(bmeurer): This typing is not yet correct. Since we can still access
1654 // out of bounds, the type in the general case has to include Undefined.
1655 switch (BufferAccessOf(node->op()).external_array_type()) { 1652 switch (BufferAccessOf(node->op()).external_array_type()) {
1656 #define TYPED_ARRAY_CASE(ElemType, type, TYPE, ctype, size) \ 1653 #define TYPED_ARRAY_CASE(ElemType, type, TYPE, ctype, size) \
1657 case kExternal##ElemType##Array: \ 1654 case kExternal##ElemType##Array: \
1658 return Type::Union(typer_->cache_.k##ElemType, Type::Undefined(), zone()); 1655 return Type::Union(typer_->cache_.k##ElemType, Type::Undefined(), zone());
1659 TYPED_ARRAYS(TYPED_ARRAY_CASE) 1656 TYPED_ARRAYS(TYPED_ARRAY_CASE)
1660 #undef TYPED_ARRAY_CASE 1657 #undef TYPED_ARRAY_CASE
1661 } 1658 }
1662 UNREACHABLE(); 1659 UNREACHABLE();
1663 return nullptr; 1660 return nullptr;
1664 } 1661 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { 1734 Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
1738 if (Type::IsInteger(*value)) { 1735 if (Type::IsInteger(*value)) {
1739 return Type::Range(value->Number(), value->Number(), zone()); 1736 return Type::Range(value->Number(), value->Number(), zone());
1740 } 1737 }
1741 return Type::NewConstant(value, zone()); 1738 return Type::NewConstant(value, zone());
1742 } 1739 }
1743 1740
1744 } // namespace compiler 1741 } // namespace compiler
1745 } // namespace internal 1742 } // namespace internal
1746 } // namespace v8 1743 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/type-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698