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

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

Issue 768543002: [WIP] TrapHandler 2014/11/27. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/typer.h ('k') | src/compiler/verifier.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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 #include "src/compiler/graph-inl.h" 6 #include "src/compiler/graph-inl.h"
7 #include "src/compiler/js-operator.h" 7 #include "src/compiler/js-operator.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 singleton_one = Type::Range(one, one, zone); 62 singleton_one = Type::Range(one, one, zone);
63 zero_or_one = Type::Union(singleton_zero, singleton_one, zone); 63 zero_or_one = Type::Union(singleton_zero, singleton_one, zone);
64 zeroish = Type::Union(singleton_zero, nan_or_minuszero, zone); 64 zeroish = Type::Union(singleton_zero, nan_or_minuszero, zone);
65 signed32ish = Type::Union(signed32, truncating_to_zero, zone); 65 signed32ish = Type::Union(signed32, truncating_to_zero, zone);
66 unsigned32ish = Type::Union(unsigned32, truncating_to_zero, zone); 66 unsigned32ish = Type::Union(unsigned32, truncating_to_zero, zone);
67 falsish = Type::Union(Type::Undetectable(), 67 falsish = Type::Union(Type::Undetectable(),
68 Type::Union(zeroish, undefined_or_null, zone), zone); 68 Type::Union(zeroish, undefined_or_null, zone), zone);
69 integer = Type::Range(minusinfinity, infinity, zone); 69 integer = Type::Range(minusinfinity, infinity, zone);
70 weakint = Type::Union(integer, nan_or_minuszero, zone); 70 weakint = Type::Union(integer, nan_or_minuszero, zone);
71 71
72 signed8_ = Type::Range(f->NewNumber(-0x7F), f->NewNumber(0x7F - 1), zone);
73 unsigned8_ = Type::Range(zero, f->NewNumber(0xFF - 1), zone);
74 signed16_ =
75 Type::Range(f->NewNumber(-0x7FFF), f->NewNumber(0x7FFF - 1), zone);
76 unsigned16_ = Type::Range(zero, f->NewNumber(0xFFFF - 1), zone);
77
72 number_fun0_ = Type::Function(number, zone); 78 number_fun0_ = Type::Function(number, zone);
73 number_fun1_ = Type::Function(number, number, zone); 79 number_fun1_ = Type::Function(number, number, zone);
74 number_fun2_ = Type::Function(number, number, number, zone); 80 number_fun2_ = Type::Function(number, number, number, zone);
75 weakint_fun1_ = Type::Function(weakint, number, zone); 81 weakint_fun1_ = Type::Function(weakint, number, zone);
76 imul_fun_ = Type::Function(signed32, integral32, integral32, zone); 82 imul_fun_ = Type::Function(signed32, integral32, integral32, zone);
77 clz32_fun_ = Type::Function( 83 clz32_fun_ = Type::Function(
78 Type::Range(zero, f->NewNumber(32), zone), number, zone); 84 Type::Range(zero, f->NewNumber(32), zone), number, zone);
79 random_fun_ = Type::Function(Type::Union( 85 random_fun_ = Type::Function(Type::Union(
80 Type::UnsignedSmall(), Type::OtherNumber(), zone), zone); 86 Type::UnsignedSmall(), Type::OtherNumber(), zone), zone);
81 87
82 Type* int8 = Type::Intersect( 88 #define NATIVE_TYPE(sem, rep) Type::Intersect(sem, rep, zone)
83 Type::Range(f->NewNumber(-0x7F), f->NewNumber(0x7F-1), zone), 89 Type* int8 = NATIVE_TYPE(signed8_, Type::UntaggedInt8());
84 Type::UntaggedInt8(), zone); 90 Type* uint8 = NATIVE_TYPE(unsigned8_, Type::UntaggedInt8());
85 Type* int16 = Type::Intersect( 91 Type* int16 = NATIVE_TYPE(signed16_, Type::UntaggedInt16());
86 Type::Range(f->NewNumber(-0x7FFF), f->NewNumber(0x7FFF-1), zone), 92 Type* uint16 = NATIVE_TYPE(unsigned16_, Type::UntaggedInt16());
87 Type::UntaggedInt16(), zone); 93 Type* int32 = NATIVE_TYPE(Type::Signed32(), Type::UntaggedInt32());
88 Type* uint8 = Type::Intersect( 94 Type* uint32 = NATIVE_TYPE(Type::Unsigned32(), Type::UntaggedInt32());
89 Type::Range(zero, f->NewNumber(0xFF-1), zone), 95 Type* float32 = NATIVE_TYPE(Type::Number(), Type::UntaggedFloat32());
90 Type::UntaggedInt8(), zone); 96 Type* float64 = NATIVE_TYPE(Type::Number(), Type::UntaggedFloat64());
91 Type* uint16 = Type::Intersect(
92 Type::Range(zero, f->NewNumber(0xFFFF-1), zone),
93 Type::UntaggedInt16(), zone);
94
95 #define NATIVE_TYPE(sem, rep) \
96 Type::Intersect(Type::sem(), Type::rep(), zone)
97 Type* int32 = NATIVE_TYPE(Signed32, UntaggedInt32);
98 Type* uint32 = NATIVE_TYPE(Unsigned32, UntaggedInt32);
99 Type* float32 = NATIVE_TYPE(Number, UntaggedFloat32);
100 Type* float64 = NATIVE_TYPE(Number, UntaggedFloat64);
101 #undef NATIVE_TYPE 97 #undef NATIVE_TYPE
102 98
103 Type* buffer = Type::Buffer(zone); 99 Type* buffer = Type::Buffer(zone);
104 Type* int8_array = Type::Array(int8, zone); 100 Type* int8_array = Type::Array(int8, zone);
105 Type* int16_array = Type::Array(int16, zone); 101 Type* int16_array = Type::Array(int16, zone);
106 Type* int32_array = Type::Array(int32, zone); 102 Type* int32_array = Type::Array(int32, zone);
107 Type* uint8_array = Type::Array(uint8, zone); 103 Type* uint8_array = Type::Array(uint8, zone);
108 Type* uint16_array = Type::Array(uint16, zone); 104 Type* uint16_array = Type::Array(uint16, zone);
109 Type* uint32_array = Type::Array(uint32, zone); 105 Type* uint32_array = Type::Array(uint32, zone);
110 Type* float32_array = Type::Array(float32, zone); 106 Type* float32_array = Type::Array(float32, zone);
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 Bounds Typer::Visitor::TypeObjectIsSmi(Node* node) { 1536 Bounds Typer::Visitor::TypeObjectIsSmi(Node* node) {
1541 return Bounds(Type::Boolean()); 1537 return Bounds(Type::Boolean());
1542 } 1538 }
1543 1539
1544 1540
1545 Bounds Typer::Visitor::TypeObjectIsNonNegativeSmi(Node* node) { 1541 Bounds Typer::Visitor::TypeObjectIsNonNegativeSmi(Node* node) {
1546 return Bounds(Type::Boolean()); 1542 return Bounds(Type::Boolean());
1547 } 1543 }
1548 1544
1549 1545
1546 Bounds Typer::Visitor::TypeLoadBuffer(Node* node) {
1547 switch (BufferAccessOf(node->op()).external_array_type()) {
1548 case kExternalInt8Array:
1549 return Bounds(typer_->signed8_);
1550 case kExternalUint8Array:
1551 case kExternalUint8ClampedArray:
1552 return Bounds(typer_->unsigned8_);
1553 case kExternalInt16Array:
1554 return Bounds(typer_->signed16_);
1555 case kExternalUint16Array:
1556 return Bounds(typer_->unsigned16_);
1557 case kExternalInt32Array:
1558 return Bounds(Type::Signed32());
1559 case kExternalUint32Array:
1560 return Bounds(Type::Unsigned32());
1561 case kExternalFloat32Array:
1562 return Bounds(Type::Number());
1563 case kExternalFloat64Array:
1564 return Bounds(Type::Number());
1565 }
1566 UNREACHABLE();
1567 return Bounds();
1568 }
1569
1570
1571 Bounds Typer::Visitor::TypeStoreBuffer(Node* node) {
1572 UNREACHABLE();
1573 return Bounds();
1574 }
1575
1576
1577 Bounds Typer::Visitor::TypeBoundsCheck(Node* node) {
1578 return Bounds(Type::Unsigned32());
1579 }
1580
1581
1550 // Machine operators. 1582 // Machine operators.
1551 1583
1552 Bounds Typer::Visitor::TypeLoad(Node* node) { 1584 Bounds Typer::Visitor::TypeLoad(Node* node) {
1553 return Bounds::Unbounded(zone()); 1585 return Bounds::Unbounded(zone());
1554 } 1586 }
1555 1587
1556 1588
1557 Bounds Typer::Visitor::TypeStore(Node* node) { 1589 Bounds Typer::Visitor::TypeStore(Node* node) {
1558 UNREACHABLE(); 1590 UNREACHABLE();
1559 return Bounds(); 1591 return Bounds();
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 return typer_->float64_array_fun_; 2005 return typer_->float64_array_fun_;
1974 } 2006 }
1975 } 2007 }
1976 } 2008 }
1977 return Type::Constant(value, zone()); 2009 return Type::Constant(value, zone());
1978 } 2010 }
1979 2011
1980 } 2012 }
1981 } 2013 }
1982 } // namespace v8::internal::compiler 2014 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/typer.h ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698