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

Side by Side Diff: test/cctest/test-types.cc

Issue 650513003: Again reland "Refine expression typing, esp. by propagating range information." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/compiler/test-typer.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <vector> 5 #include <vector>
6 6
7 #include "src/hydrogen-types.h" 7 #include "src/hydrogen-types.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/types.h" 9 #include "src/types.h"
10 #include "test/cctest/cctest.h" 10 #include "test/cctest/cctest.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 }; 90 };
91 91
92 92
93 template<class Type, class TypeHandle, class Region> 93 template<class Type, class TypeHandle, class Region>
94 class Types { 94 class Types {
95 public: 95 public:
96 Types(Region* region, Isolate* isolate) 96 Types(Region* region, Isolate* isolate)
97 : region_(region), rng_(isolate->random_number_generator()) { 97 : region_(region), rng_(isolate->random_number_generator()) {
98 #define DECLARE_TYPE(name, value) \ 98 #define DECLARE_TYPE(name, value) \
99 name = Type::name(region); \ 99 name = Type::name(region); \
100 types.push_back(name); 100 if (SmiValuesAre31Bits() || \
101 (!Type::name(region)->Equals(Type::OtherSigned32()) && \
102 !Type::name(region)->Equals(Type::OtherUnsigned31()))) { \
103 /* Hack: Avoid generating those empty bitset types. */ \
104 types.push_back(name); \
105 }
101 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) 106 PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
102 #undef DECLARE_TYPE 107 #undef DECLARE_TYPE
103 108
104 object_map = isolate->factory()->NewMap( 109 object_map = isolate->factory()->NewMap(
105 JS_OBJECT_TYPE, JSObject::kHeaderSize); 110 JS_OBJECT_TYPE, JSObject::kHeaderSize);
106 array_map = isolate->factory()->NewMap( 111 array_map = isolate->factory()->NewMap(
107 JS_ARRAY_TYPE, JSArray::kSize); 112 JS_ARRAY_TYPE, JSArray::kSize);
108 number_map = isolate->factory()->NewMap( 113 number_map = isolate->factory()->NewMap(
109 HEAP_NUMBER_TYPE, HeapNumber::kSize); 114 HEAP_NUMBER_TYPE, HeapNumber::kSize);
110 uninitialized_map = isolate->factory()->uninitialized_map(); 115 uninitialized_map = isolate->factory()->uninitialized_map();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 case 0: { // bitset 282 case 0: { // bitset
278 #define COUNT_BITSET_TYPES(type, value) + 1 283 #define COUNT_BITSET_TYPES(type, value) + 1
279 int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES); 284 int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES);
280 #undef COUNT_BITSET_TYPES 285 #undef COUNT_BITSET_TYPES
281 // Pick a bunch of named bitsets and return their intersection. 286 // Pick a bunch of named bitsets and return their intersection.
282 TypeHandle result = Type::Any(region_); 287 TypeHandle result = Type::Any(region_);
283 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) { 288 for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) {
284 int j = rng_->NextInt(n); 289 int j = rng_->NextInt(n);
285 #define PICK_BITSET_TYPE(type, value) \ 290 #define PICK_BITSET_TYPE(type, value) \
286 if (j-- == 0) { \ 291 if (j-- == 0) { \
292 if (!SmiValuesAre31Bits() && \
293 (Type::type(region_)->Equals(Type::OtherSigned32()) || \
294 Type::type(region_)->Equals(Type::OtherUnsigned31()))) { \
295 /* Hack: Avoid generating those empty bitset types. */ \
296 continue; \
297 } \
287 TypeHandle tmp = Type::Intersect( \ 298 TypeHandle tmp = Type::Intersect( \
288 result, Type::type(region_), region_); \ 299 result, Type::type(region_), region_); \
289 if (tmp->Is(Type::None()) && i != 0) { \ 300 if (tmp->Is(Type::None()) && i != 0) { \
290 break; \ 301 break; \
291 } { \ 302 } else { \
292 result = tmp; \ 303 result = tmp; \
293 continue; \ 304 continue; \
294 } \ 305 } \
295 } 306 }
296 PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE) 307 PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE)
297 #undef PICK_BITSET_TYPE 308 #undef PICK_BITSET_TYPE
298 } 309 }
299 return result; 310 return result;
300 } 311 }
301 case 1: { // class 312 case 1: { // class
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 } 2183 }
2173 2184
2174 2185
2175 TEST(NowOf) { 2186 TEST(NowOf) {
2176 CcTest::InitializeVM(); 2187 CcTest::InitializeVM();
2177 ZoneTests().NowOf(); 2188 ZoneTests().NowOf();
2178 HeapTests().NowOf(); 2189 HeapTests().NowOf();
2179 } 2190 }
2180 2191
2181 2192
2193 TEST(MinMax) {
2194 CcTest::InitializeVM();
2195 ZoneTests().MinMax();
2196 HeapTests().MinMax();
2197 }
2198
2199
2182 TEST(BitsetGlb) { 2200 TEST(BitsetGlb) {
2183 CcTest::InitializeVM(); 2201 CcTest::InitializeVM();
2184 ZoneTests().BitsetGlb(); 2202 ZoneTests().BitsetGlb();
2185 HeapTests().BitsetGlb(); 2203 HeapTests().BitsetGlb();
2186 } 2204 }
2187 2205
2188 2206
2189 TEST(BitsetLub) { 2207 TEST(BitsetLub) {
2190 CcTest::InitializeVM(); 2208 CcTest::InitializeVM();
2191 ZoneTests().BitsetLub(); 2209 ZoneTests().BitsetLub();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); 2302 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>();
2285 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); 2303 HeapTests().Convert<Type, Type*, Zone, ZoneRep>();
2286 } 2304 }
2287 2305
2288 2306
2289 TEST(HTypeFromType) { 2307 TEST(HTypeFromType) {
2290 CcTest::InitializeVM(); 2308 CcTest::InitializeVM();
2291 ZoneTests().HTypeFromType(); 2309 ZoneTests().HTypeFromType();
2292 HeapTests().HTypeFromType(); 2310 HeapTests().HTypeFromType();
2293 } 2311 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698