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

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

Issue 968773004: [turbofan] Use the typer to statically detect Smis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/simplified-lowering.cc ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | 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/base/flags.h" 5 #include "src/base/flags.h"
6 #include "src/bootstrapper.h" 6 #include "src/bootstrapper.h"
7 #include "src/compiler/graph-reducer.h" 7 #include "src/compiler/graph-reducer.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 Bounds Typer::Visitor::TypeStringLessThanOrEqual(Node* node) { 1609 Bounds Typer::Visitor::TypeStringLessThanOrEqual(Node* node) {
1610 return Bounds(Type::None(zone()), Type::Boolean(zone())); 1610 return Bounds(Type::None(zone()), Type::Boolean(zone()));
1611 } 1611 }
1612 1612
1613 1613
1614 Bounds Typer::Visitor::TypeStringAdd(Node* node) { 1614 Bounds Typer::Visitor::TypeStringAdd(Node* node) {
1615 return Bounds(Type::None(zone()), Type::String(zone())); 1615 return Bounds(Type::None(zone()), Type::String(zone()));
1616 } 1616 }
1617 1617
1618 1618
1619 static Type* ChangeRepresentation(Type* type, Type* rep, Zone* zone) { 1619 namespace {
1620 // TODO(neis): Enable when expressible. 1620
1621 /* 1621 Type* ChangeRepresentation(Type* type, Type* rep, Zone* zone) {
1622 return Type::Union( 1622 return Type::Union(Type::Semantic(type, zone),
1623 Type::Intersect(type, Type::Semantic(), zone), 1623 Type::Representation(rep, zone), zone);
1624 Type::Intersect(rep, Type::Representation(), zone), zone);
1625 */
1626 return type;
1627 } 1624 }
1628 1625
1626 } // namespace
1627
1629 1628
1630 Bounds Typer::Visitor::TypeChangeTaggedToInt32(Node* node) { 1629 Bounds Typer::Visitor::TypeChangeTaggedToInt32(Node* node) {
1631 Bounds arg = Operand(node, 0); 1630 Bounds arg = Operand(node, 0);
1632 // TODO(neis): DCHECK(arg.upper->Is(Type::Signed32())); 1631 // TODO(neis): DCHECK(arg.upper->Is(Type::Signed32()));
1633 return Bounds( 1632 return Bounds(
1634 ChangeRepresentation(arg.lower, Type::UntaggedSigned32(), zone()), 1633 ChangeRepresentation(arg.lower, Type::UntaggedSigned32(), zone()),
1635 ChangeRepresentation(arg.upper, Type::UntaggedSigned32(), zone())); 1634 ChangeRepresentation(arg.upper, Type::UntaggedSigned32(), zone()));
1636 } 1635 }
1637 1636
1638 1637
(...skipping 11 matching lines...) Expand all
1650 // TODO(neis): DCHECK(arg.upper->Is(Type::Number())); 1649 // TODO(neis): DCHECK(arg.upper->Is(Type::Number()));
1651 return Bounds( 1650 return Bounds(
1652 ChangeRepresentation(arg.lower, Type::UntaggedFloat64(), zone()), 1651 ChangeRepresentation(arg.lower, Type::UntaggedFloat64(), zone()),
1653 ChangeRepresentation(arg.upper, Type::UntaggedFloat64(), zone())); 1652 ChangeRepresentation(arg.upper, Type::UntaggedFloat64(), zone()));
1654 } 1653 }
1655 1654
1656 1655
1657 Bounds Typer::Visitor::TypeChangeInt32ToTagged(Node* node) { 1656 Bounds Typer::Visitor::TypeChangeInt32ToTagged(Node* node) {
1658 Bounds arg = Operand(node, 0); 1657 Bounds arg = Operand(node, 0);
1659 // TODO(neis): DCHECK(arg.upper->Is(Type::Signed32())); 1658 // TODO(neis): DCHECK(arg.upper->Is(Type::Signed32()));
1660 return Bounds( 1659 Type* lower_rep = arg.lower->Is(Type::SignedSmall()) ? Type::TaggedSigned()
1661 ChangeRepresentation(arg.lower, Type::Tagged(), zone()), 1660 : Type::Tagged();
1662 ChangeRepresentation(arg.upper, Type::Tagged(), zone())); 1661 Type* upper_rep = arg.upper->Is(Type::SignedSmall()) ? Type::TaggedSigned()
1662 : Type::Tagged();
1663 return Bounds(ChangeRepresentation(arg.lower, lower_rep, zone()),
1664 ChangeRepresentation(arg.upper, upper_rep, zone()));
1663 } 1665 }
1664 1666
1665 1667
1666 Bounds Typer::Visitor::TypeChangeUint32ToTagged(Node* node) { 1668 Bounds Typer::Visitor::TypeChangeUint32ToTagged(Node* node) {
1667 Bounds arg = Operand(node, 0); 1669 Bounds arg = Operand(node, 0);
1668 // TODO(neis): DCHECK(arg.upper->Is(Type::Unsigned32())); 1670 // TODO(neis): DCHECK(arg.upper->Is(Type::Unsigned32()));
1669 return Bounds( 1671 return Bounds(
1670 ChangeRepresentation(arg.lower, Type::Tagged(), zone()), 1672 ChangeRepresentation(arg.lower, Type::Tagged(), zone()),
1671 ChangeRepresentation(arg.upper, Type::Tagged(), zone())); 1673 ChangeRepresentation(arg.upper, Type::Tagged(), zone()));
1672 } 1674 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 TYPED_ARRAYS(TYPED_ARRAY_CASE) 2186 TYPED_ARRAYS(TYPED_ARRAY_CASE)
2185 #undef TYPED_ARRAY_CASE 2187 #undef TYPED_ARRAY_CASE
2186 } 2188 }
2187 } 2189 }
2188 return Type::Constant(value, zone()); 2190 return Type::Constant(value, zone());
2189 } 2191 }
2190 2192
2191 } // namespace compiler 2193 } // namespace compiler
2192 } // namespace internal 2194 } // namespace internal
2193 } // namespace v8 2195 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698