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

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

Issue 2320473003: [turbofan] Typer changes to avoid Type representation dimension (Closed)
Patch Set: quick fix. Created 4 years, 3 months 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/memory-optimizer.cc ('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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 510
511 Type* Typer::Visitor::ObjectIsReceiver(Type* type, Typer* t) { 511 Type* Typer::Visitor::ObjectIsReceiver(Type* type, Typer* t) {
512 if (type->Is(Type::Receiver())) return t->singleton_true_; 512 if (type->Is(Type::Receiver())) return t->singleton_true_;
513 if (!type->Maybe(Type::Receiver())) return t->singleton_false_; 513 if (!type->Maybe(Type::Receiver())) return t->singleton_false_;
514 return Type::Boolean(); 514 return Type::Boolean();
515 } 515 }
516 516
517 517
518 Type* Typer::Visitor::ObjectIsSmi(Type* type, Typer* t) { 518 Type* Typer::Visitor::ObjectIsSmi(Type* type, Typer* t) {
519 if (type->Is(Type::TaggedSigned())) return t->singleton_true_; 519 if (!type->Maybe(Type::SignedSmall())) return t->singleton_false_;
520 if (type->Is(Type::TaggedPointer())) return t->singleton_false_;
521 return Type::Boolean(); 520 return Type::Boolean();
522 } 521 }
523 522
524 Type* Typer::Visitor::ObjectIsString(Type* type, Typer* t) { 523 Type* Typer::Visitor::ObjectIsString(Type* type, Typer* t) {
525 if (type->Is(Type::String())) return t->singleton_true_; 524 if (type->Is(Type::String())) return t->singleton_true_;
526 if (!type->Maybe(Type::String())) return t->singleton_false_; 525 if (!type->Maybe(Type::String())) return t->singleton_false_;
527 return Type::Boolean(); 526 return Type::Boolean();
528 } 527 }
529 528
530 Type* Typer::Visitor::ObjectIsUndetectable(Type* type, Typer* t) { 529 Type* Typer::Visitor::ObjectIsUndetectable(Type* type, Typer* t) {
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 Type* arg = Operand(node, 0); 1585 Type* arg = Operand(node, 0);
1587 return Type::Intersect(arg, Type::String(), zone()); 1586 return Type::Intersect(arg, Type::String(), zone());
1588 } 1587 }
1589 1588
1590 Type* Typer::Visitor::TypeCheckIf(Node* node) { 1589 Type* Typer::Visitor::TypeCheckIf(Node* node) {
1591 UNREACHABLE(); 1590 UNREACHABLE();
1592 return nullptr; 1591 return nullptr;
1593 } 1592 }
1594 1593
1595 Type* Typer::Visitor::TypeCheckTaggedPointer(Node* node) { 1594 Type* Typer::Visitor::TypeCheckTaggedPointer(Node* node) {
1596 Type* arg = Operand(node, 0); 1595 Type* type = Operand(node, 0);
1597 return Type::Intersect(arg, Type::TaggedPointer(), zone()); 1596 return type;
1598 } 1597 }
1599 1598
1600 Type* Typer::Visitor::TypeCheckTaggedSigned(Node* node) { 1599 Type* Typer::Visitor::TypeCheckTaggedSigned(Node* node) {
1601 Type* arg = Operand(node, 0); 1600 Type* arg = Operand(node, 0);
1602 return Type::Intersect(arg, typer_->cache_.kSmi, zone()); 1601 return Type::Intersect(arg, typer_->cache_.kSmi, zone());
1603 } 1602 }
1604 1603
1605 Type* Typer::Visitor::TypeCheckFloat64Hole(Node* node) { 1604 Type* Typer::Visitor::TypeCheckFloat64Hole(Node* node) {
1606 Type* type = Operand(node, 0); 1605 Type* type = Operand(node, 0);
1607 return type; 1606 return type;
1608 } 1607 }
1609 1608
1610 Type* Typer::Visitor::TypeCheckTaggedHole(Node* node) { 1609 Type* Typer::Visitor::TypeCheckTaggedHole(Node* node) {
1611 Type* type = Operand(node, 0); 1610 Type* type = Operand(node, 0);
1612 type = Type::Intersect(type, Type::NonInternal(), zone()); 1611 type = Type::Intersect(type, Type::NonInternal(), zone());
1613 return type; 1612 return type;
1614 } 1613 }
1615 1614
1616 Type* Typer::Visitor::TypeConvertTaggedHoleToUndefined(Node* node) { 1615 Type* Typer::Visitor::TypeConvertTaggedHoleToUndefined(Node* node) {
1617 Type* type = Operand(node, 0); 1616 Type* type = Operand(node, 0);
1618 if (type->Maybe(Type::Hole())) { 1617 if (type->Maybe(Type::Hole())) {
1619 // Turn "the hole" into undefined. 1618 // Turn "the hole" into undefined.
1620 type = Type::Intersect(type, Type::NonInternal(), zone()); 1619 type = Type::Intersect(type, Type::NonInternal(), zone());
1621 type = Type::Union(type, Type::Undefined(), zone()); 1620 type = Type::Union(type, Type::Undefined(), zone());
1622 } 1621 }
1623 return type; 1622 return type;
1624 } 1623 }
1625 1624
1626 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::TaggedPointer(); } 1625 Type* Typer::Visitor::TypeAllocate(Node* node) { return Type::Any(); }
1627 1626
1628 Type* Typer::Visitor::TypeLoadField(Node* node) { 1627 Type* Typer::Visitor::TypeLoadField(Node* node) {
1629 return FieldAccessOf(node->op()).type; 1628 return FieldAccessOf(node->op()).type;
1630 } 1629 }
1631 1630
1632 Type* Typer::Visitor::TypeLoadBuffer(Node* node) { 1631 Type* Typer::Visitor::TypeLoadBuffer(Node* node) {
1633 // TODO(bmeurer): This typing is not yet correct. Since we can still access 1632 // TODO(bmeurer): This typing is not yet correct. Since we can still access
1634 // out of bounds, the type in the general case has to include Undefined. 1633 // out of bounds, the type in the general case has to include Undefined.
1635 switch (BufferAccessOf(node->op()).external_array_type()) { 1634 switch (BufferAccessOf(node->op()).external_array_type()) {
1636 #define TYPED_ARRAY_CASE(ElemType, type, TYPE, ctype, size) \ 1635 #define TYPED_ARRAY_CASE(ElemType, type, TYPE, ctype, size) \
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { 1716 Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
1718 if (Type::IsInteger(*value)) { 1717 if (Type::IsInteger(*value)) {
1719 return Type::Range(value->Number(), value->Number(), zone()); 1718 return Type::Range(value->Number(), value->Number(), zone());
1720 } 1719 }
1721 return Type::Constant(value, zone()); 1720 return Type::Constant(value, zone());
1722 } 1721 }
1723 1722
1724 } // namespace compiler 1723 } // namespace compiler
1725 } // namespace internal 1724 } // namespace internal
1726 } // namespace v8 1725 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/memory-optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698